From 53dfbd18d69013fd13eb65740d186ed32b0a1bf2 Mon Sep 17 00:00:00 2001 From: Changaco Date: Sun, 14 Dec 2014 18:48:04 +0100 Subject: [PATCH] fix tests --- gratipay/utils/fake_data.py | 2 +- tests/py/test_close.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/gratipay/utils/fake_data.py b/gratipay/utils/fake_data.py index 75491f38d4..7366c8246e 100644 --- a/gratipay/utils/fake_data.py +++ b/gratipay/utils/fake_data.py @@ -70,7 +70,7 @@ def fake_participant(db, number="singular", is_admin=False): , is_admin=is_admin , balance=fake_balance() , anonymous_giving=(random.randrange(5) == 0) - , anonymous_receiving=(random.randrange(5) == 0) + , anonymous_receiving=(number != 'plural' and random.randrange(5) == 0) , goal=fake_balance() , balanced_customer_href=faker.uri() , last_ach_result='' diff --git a/tests/py/test_close.py b/tests/py/test_close.py index 2e7585ec54..c3e6eefab5 100644 --- a/tests/py/test_close.py +++ b/tests/py/test_close.py @@ -283,7 +283,6 @@ def test_cpi_clears_personal_information(self, mailer): , goal=100 , anonymous_giving=True , anonymous_receiving=True - , number='plural' , avatar_url='img-url' , email_address='alice@example.com' , claimed_time='now' @@ -294,7 +293,6 @@ def test_cpi_clears_personal_information(self, mailer): , receiving=40 , npatrons=21 ) - assert Participant.from_username('alice').number == 'plural' # sanity check alice.add_email('alice@example.net') with self.db.get_cursor() as cursor: @@ -303,8 +301,8 @@ def test_cpi_clears_personal_information(self, mailer): assert alice.statement == new_alice.statement == '' assert alice.goal == new_alice.goal == None - assert (alice.anonymous_giving, new_alice.anonymous_giving) == (False, False) - assert (alice.anonymous_receiving, new_alice.anonymous_giving) == (False, False) + assert alice.anonymous_giving == new_alice.anonymous_giving == False + assert alice.anonymous_receiving == new_alice.anonymous_receiving == False assert alice.number == new_alice.number == 'singular' assert alice.avatar_url == new_alice.avatar_url == None assert alice.email_address == new_alice.email_address == None @@ -317,6 +315,12 @@ def test_cpi_clears_personal_information(self, mailer): assert alice.session_expires.year == new_alice.session_expires.year == date.today().year assert not alice.get_emails() + team = self.make_participant('team', number='plural') + with self.db.get_cursor() as cursor: + team.clear_personal_information(cursor) + team2 = Participant.from_username('team') + assert team.number == team2.number == 'singular' + def test_cpi_clears_communities(self): alice = self.make_participant('alice') alice.insert_into_communities(True, 'test', 'test')