mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-23 01:57:03 +03:00
Merge pull request #381 from ad-m/patch-2
Add factories for model users.User
This commit is contained in:
commit
5079db3a4a
|
@ -0,0 +1,11 @@
|
||||||
|
import factory
|
||||||
|
|
||||||
|
|
||||||
|
class UserFactory(factory.django.DjangoModelFactory):
|
||||||
|
username = factory.Sequence(lambda n: 'user-{0}'.format(n))
|
||||||
|
email = factory.Sequence(lambda n: 'user-{0}@example.com'.format(n))
|
||||||
|
password = factory.PostGenerationMethodCall('set_password', 'password')
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = 'users.User'
|
||||||
|
django_get_or_create = ('username', )
|
Loading…
Reference in New Issue
Block a user