MAINT: Refactor, move factories into tests
This commit is contained in:
parent
31714215d0
commit
02a21306fe
16 changed files with 49 additions and 42 deletions
11
ccdb/users/tests/factories.py
Normal file
11
ccdb/users/tests/factories.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
from factory import DjangoModelFactory, Sequence
|
||||
|
||||
from ..models import User
|
||||
|
||||
|
||||
class UserFactory(DjangoModelFactory):
|
||||
class Meta:
|
||||
model = User
|
||||
|
||||
name = Sequence(lambda n: 'user{}'.format(n))
|
||||
username = Sequence(lambda n: 'username{}'.format(n))
|
|
@ -2,7 +2,7 @@ from django.test import TestCase
|
|||
from django.db import IntegrityError, transaction
|
||||
|
||||
from ..models import User
|
||||
from ..factories import UserFactory
|
||||
from .factories import UserFactory
|
||||
|
||||
|
||||
class UserTestCase(TestCase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue