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

Commit

Permalink
Improvements to fake_data.make_package
Browse files Browse the repository at this point in the history
- use a constant
- return Package
  • Loading branch information
chadwhitacre committed Mar 22, 2017
1 parent 11a436f commit b81cb7d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions gratipay/testing/harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from gratipay.exceptions import NoSelfTipping, NoTippee, BadAmount
from gratipay.models.account_elsewhere import AccountElsewhere
from gratipay.models.exchange_route import ExchangeRoute
from gratipay.models.package import NPM, Package
from gratipay.models.participant import Participant, MAX_TIP, MIN_TIP
from gratipay.security import user
from gratipay.testing.vcr import use_cassette
Expand Down Expand Up @@ -195,14 +196,15 @@ def make_team(self, *a, **kw):
return team


def make_package(self, package_manager='npm', name='foo', description='Foo',
def make_package(self, package_manager=NPM, name='foo', description='Foo',
emails=['[email protected]']):
"""Factory for packages.
"""
return self.db.one( 'INSERT INTO packages (package_manager, name, description, emails) '
'VALUES (%s, %s, %s, %s) RETURNING *'
, (package_manager, name, description, emails)
)
self.db.run( 'INSERT INTO packages (package_manager, name, description, emails) '
'VALUES (%s, %s, %s, %s) RETURNING *'
, (package_manager, name, description, emails)
)
return Package.from_names(NPM, name)


def make_participant(self, username, **kw):
Expand Down

0 comments on commit b81cb7d

Please sign in to comment.