From d9c85d93811b0aa000c04f14dc8bac923f67b13a Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Thu, 12 Jan 2017 17:32:28 -0500 Subject: [PATCH 1/2] Failing test for closing account w/ closed project --- tests/py/test_close.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/py/test_close.py b/tests/py/test_close.py index e70dcb3b7f..dd6dce3e60 100644 --- a/tests/py/test_close.py +++ b/tests/py/test_close.py @@ -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 From a4024486ada75d8245c01124a1e155a798edabf0 Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Thu, 12 Jan 2017 17:34:38 -0500 Subject: [PATCH 2/2] Allow closing account w/ closed teams --- gratipay/models/participant/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gratipay/models/participant/__init__.py b/gratipay/models/participant/__init__.py index 6158e000ef..04f7d81ff2 100644 --- a/gratipay/models/participant/__init__.py +++ b/gratipay/models/participant/__init__.py @@ -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