mirror of
https://github.com/Balshgit/gpt_chat_bot.git
synced 2025-09-10 17:20:41 +03:00
41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
import uuid
|
|
|
|
import factory
|
|
|
|
from core.auth.models.users import AccessToken, User, UserQuestionCount
|
|
from tests.integration.factories.utils import BaseModelFactory
|
|
|
|
|
|
class UserFactory(BaseModelFactory):
|
|
id = factory.Sequence(lambda n: n + 1)
|
|
email = factory.Faker("email")
|
|
username = factory.Faker("user_name", locale="en")
|
|
first_name = factory.Faker("word")
|
|
last_name = factory.Faker("word")
|
|
ban_reason = factory.Faker("text", max_nb_chars=100)
|
|
hashed_password = factory.Faker("word")
|
|
is_active = True
|
|
is_superuser = False
|
|
created_at = factory.Faker("past_datetime")
|
|
|
|
class Meta:
|
|
model = User
|
|
|
|
|
|
class AccessTokenFactory(BaseModelFactory):
|
|
user_id = factory.Sequence(lambda n: n + 1)
|
|
token = factory.LazyAttribute(lambda o: str(uuid.uuid4()))
|
|
created_at = factory.Faker("past_datetime")
|
|
|
|
class Meta:
|
|
model = AccessToken
|
|
|
|
|
|
class UserQuestionCountFactory(BaseModelFactory):
|
|
user_id = factory.Sequence(lambda n: n + 1)
|
|
question_count = factory.Faker("random_int")
|
|
last_question_at = factory.Faker("past_datetime")
|
|
|
|
class Meta:
|
|
model = UserQuestionCount
|