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

Fix bug with closing account w/ closed project #4289

Merged
merged 2 commits into from
Jan 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gratipay/models/participant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ class BalanceIsNotZero(Exception): pass
def final_check(self, cursor):
"""Sanity-check that teams and balance have been dealt with.
"""
if self.get_teams(cursor=cursor):
if self.get_teams(cursor=cursor, only_open=True):
raise self.StillOnATeam
if self.balance != 0:
raise self.BalanceIsNotZero
Expand Down
6 changes: 6 additions & 0 deletions tests/py/test_close.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ def test_close_fails_if_still_owns_a_team(self):
with pytest.raises(alice.StillOnATeam):
alice.close()

def test_close_succeeds_if_team_is_closed(self):
alice = self.make_participant('alice', claimed_time='now')
self.make_team(owner=alice, is_closed=True)
alice.close()
assert P('alice').is_closed

def test_close_page_is_usually_available(self):
self.make_participant('alice', claimed_time='now')
body = self.client.GET('/~alice/settings/close', auth_as='alice').body
Expand Down