ccdb-api/ccdb/utils/tests/factories.py
Matthew Dillon 910d3b4beb Admin Section API (#11)
Models for managing admin pages
2016-09-05 17:03:01 -07:00

21 lines
569 B
Python

from factory import DjangoModelFactory, Sequence, SubFactory
from ..models import AdminSection, AdminEntry
class AdminSectionFactory(DjangoModelFactory):
class Meta:
model = AdminSection
name = Sequence(lambda n: 'section{}'.format(n))
sort = Sequence(lambda n: n)
class AdminEntryFactory(DjangoModelFactory):
class Meta:
model = AdminEntry
package = Sequence(lambda n: 'package{}'.format(n))
model = Sequence(lambda n: 'section{}'.format(n))
section = SubFactory(AdminSectionFactory)
sort = Sequence(lambda n: n)