initial commit

This commit is contained in:
2025-10-19 22:09:35 +03:00
commit 6d593b4554
114 changed files with 23622 additions and 0 deletions

View File

@ -0,0 +1,25 @@
from uuid6 import uuid7 #126
from sqlalchemy.orm import Session
from src.app import models
from src.app.core.security import get_password_hash
from tests.conftest import fake
def create_user(db: Session, is_super_user: bool = False) -> models.User:
_user = models.User(
name=fake.name(),
username=fake.user_name(),
email=fake.email(),
hashed_password=get_password_hash(fake.password()),
profile_image_url=fake.image_url(),
uuid=uuid7,
is_superuser=is_super_user,
)
db.add(_user)
db.commit()
db.refresh(_user)
return _user

17
tests/helpers/mocks.py Normal file
View File

@ -0,0 +1,17 @@
from typing import Any
from fastapi.encoders import jsonable_encoder
from src.app import models
from tests.conftest import fake
def get_current_user(user: models.User) -> dict[str, Any]:
return jsonable_encoder(user)
def oauth2_scheme() -> str:
token = fake.sha256()
if isinstance(token, bytes):
token = token.decode("utf-8")
return token # type: ignore