Refactor tests.db.fake_data.factories into a package
This commit is contained in:
parent
7e23033d84
commit
f891fac3dc
10 changed files with 236 additions and 172 deletions
24
tests/db/fake_data/factories/couriers.py
Normal file
24
tests/db/fake_data/factories/couriers.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
"""Factory to create `Courier` instances."""
|
||||
|
||||
|
||||
import factory
|
||||
from factory import alchemy
|
||||
|
||||
from tests.db.fake_data.factories import utils
|
||||
from urban_meal_delivery import db
|
||||
|
||||
|
||||
class CourierFactory(alchemy.SQLAlchemyModelFactory):
|
||||
"""Create instances of the `db.Courier` model."""
|
||||
|
||||
class Meta:
|
||||
model = db.Courier
|
||||
sqlalchemy_get_or_create = ('id',)
|
||||
|
||||
id = factory.Sequence(lambda num: num) # noqa:WPS125
|
||||
created_at = factory.LazyFunction(utils.early_in_the_morning)
|
||||
vehicle = 'bicycle'
|
||||
historic_speed = 7.89
|
||||
capacity = 100
|
||||
pay_per_hour = 750
|
||||
pay_per_order = 200
|
||||
Loading…
Add table
Add a link
Reference in a new issue