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

Commit

Permalink
Make fake_package more resilient
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Jun 9, 2017
1 parent e22cfe7 commit 6a8b4cb
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions gratipay/fake_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,16 @@ def random_country_id(db):


def fake_package(db):
insert_fake_data( db
, 'packages'
, package_manager='npm'
, name=faker.word()
, description=fake_sentence(stop=50)
, emails=[faker.email() for i in range(random.choice(range(10)))]
)
try:
insert_fake_data( db
, 'packages'
, package_manager='npm'
, name=faker.word()
, description=fake_sentence(stop=50)
, emails=[faker.email() for i in range(random.choice(range(10)))]
)
except IntegrityError:
return fake_package(db)


def prep_db(db):
Expand Down

0 comments on commit 6a8b4cb

Please sign in to comment.