Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Start bringing back distributing/index.json
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Jul 1, 2016
1 parent 30f4554 commit 9c2c15c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 10 additions & 0 deletions tests/py/test_www_team_distributing.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@ def test_distributing_doesnt_redirect_when_money_is_available(self):
self.make_team()
self.db.run("UPDATE teams SET available=537")
assert self.client.GET('/TheEnterprise/distributing/').code == 200


def test_distributing_json_redirects_when_no_money_is_available(self):
self.make_team()
assert self.client.GxT('/TheEnterprise/distributing/index.json').code == 302

def test_distributing_json_doesnt_redirect_when_money_is_available(self):
self.make_team()
self.db.run("UPDATE teams SET available=537")
assert self.client.GET('/TheEnterprise/distributing/index.json', raise_immediately=False).code == 500
10 changes: 4 additions & 6 deletions www/%team/distributing/index.json.spt
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
"""Endpoint to list team members.
"""
from aspen import Response
from gratipay.utils import get_participant
from gratipay.utils import get_team

[--------------------]
website.redirect('..', base_url='') # XXX Migrating to Teams! Fix this up!
request.allow('GET')
team = get_participant(state, restrict=False)
if not team.show_as_team(user):
raise Response(404)
team = get_team(state)
if team.available == 0:
website.redirect('..', base_url='')

[--------------------] application/json via json_dump
team.get_members(user.participant)

0 comments on commit 9c2c15c

Please sign in to comment.