You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
634 B
30 lines
634 B
import pytz
|
|
|
|
import factory
|
|
import factory.fuzzy
|
|
|
|
from functools import partial
|
|
|
|
from django.contrib.auth import get_user_model
|
|
|
|
|
|
USER_PASSWORD = 'test'
|
|
|
|
Faker = partial(factory.Faker, locale='ru_RU')
|
|
|
|
|
|
class UserFactory(factory.django.DjangoModelFactory):
|
|
first_name = Faker('first_name')
|
|
last_name = Faker('last_name')
|
|
email = Faker('email')
|
|
password = factory.PostGenerationMethodCall('set_password', USER_PASSWORD)
|
|
is_active = True
|
|
is_staff = False
|
|
date_joined = Faker(
|
|
'past_datetime',
|
|
start_date='-30d',
|
|
tzinfo=pytz.UTC
|
|
)
|
|
|
|
class Meta:
|
|
model = get_user_model()
|
|
|