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

Commit

Permalink
Merge pull request #4097 from gratipay/fix-fakename-trip-up
Browse files Browse the repository at this point in the history
Fix for #3722
  • Loading branch information
chadwhitacre authored Aug 3, 2016
2 parents ca56e2a + b6645ed commit 7db4d94
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gratipay/utils/fake_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from gratipay.models.team import slugize, Team
from gratipay.models import community
from gratipay.models import check_db
from gratipay.exceptions import InvalidTeamName

faker = Factory.create()

Expand Down Expand Up @@ -141,7 +142,7 @@ def fake_team(db, teamowner, teamname=None):
, receiving=0.1
, nreceiving_from=3
)
except IntegrityError:
except (IntegrityError, InvalidTeamName):
return fake_team(db, teamowner)

return Team.from_slug(teamslug)
Expand Down
5 changes: 5 additions & 0 deletions tests/py/test_fake_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ def test_fake_participant_identity(self):
crusher = self.make_participant('crusher', email_address='[email protected]')
country_id = fake_data.fake_participant_identity(crusher)
assert [x.country.id for x in crusher.list_identity_metadata()] == [country_id]

def test_fake_team_doesnt_fail_for_name_with_apostrophe(self):
crusher = self.make_participant('crusher', email_address='[email protected]')
team = fake_data.fake_team(self.db, crusher, "D'Amorebury")
assert team.name != "d-amorebury"

0 comments on commit 7db4d94

Please sign in to comment.