Added full suite of tests & added testing to CI/CD

This commit is contained in:
c-d-p
2025-04-23 00:51:14 +02:00
parent e15a5c7612
commit be00f021ba
27 changed files with 1035 additions and 48 deletions

View File

@@ -8,13 +8,14 @@ from modules.auth.models import User
from modules.auth.security import authenticate_user, create_access_token, create_refresh_token, hash_password
from modules.auth.schemas import UserRole
from tests.conftest import fake
from typing import Optional # Import Optional
def create_user(db: Session, is_admin: bool = False) -> User:
def create_user(db: Session, is_admin: bool = False, username: Optional[str] = None) -> User:
unhashed_password = fake.password()
_user = User(
name=fake.name(),
username=fake.user_name(),
username=username or fake.user_name(), # Use provided username or generate one
hashed_password=hash_password(unhashed_password),
uuid=uuid_pkg.uuid4(),
role=UserRole.ADMIN if is_admin else UserRole.USER,