ccdb-api/ccdb/species/factories.py

15 lines
429 B
Python

from factory import DjangoModelFactory, Sequence
from factory.fuzzy import FuzzyText, FuzzyChoice
from .models import Species
class SpeciesFactory(DjangoModelFactory):
class Meta:
model = Species
common_name = Sequence(lambda n: 'species{}'.format(n))
genus = FuzzyText(length=50)
species = FuzzyText(length=50)
parasite = FuzzyChoice(choices=[True, False])
sort_order = Sequence(lambda n: n)