mirror of
https://github.com/Balshgit/gpt_chat_bot.git
synced 2025-12-16 21:20:39 +03:00
close dangerous api methods under api auth (#78)
* close dangerous api methods under api auth * rename access_token method
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
import uuid
|
||||
|
||||
import factory
|
||||
|
||||
from core.auth.models.users import User
|
||||
from core.auth.models.users import AccessToken, User
|
||||
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_EN")
|
||||
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)
|
||||
@@ -18,3 +20,12 @@ class UserFactory(BaseModelFactory):
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user