cookiecutter-django/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/factories.py
2016-04-20 10:00:35 -07:00

12 lines
376 B
Python

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', )