code quality run

This commit is contained in:
2025-09-13 21:58:54 +02:00
parent 0dfd885847
commit 3eb18ef91e
63 changed files with 1802 additions and 1289 deletions

View File

@@ -3,8 +3,8 @@ import pytest
from fastapi import HTTPException
from app.services.auth_service import AuthService
from models.api_models import UserLogin, UserRegister
from models.database_models import User
from models.api_models import UserRegister, UserLogin
class TestAuthService:
@@ -17,9 +17,7 @@ class TestAuthService:
def test_register_user_success(self, db):
"""Test successful user registration"""
user_data = UserRegister(
email="newuser@example.com",
username="newuser123",
password="securepass123"
email="newuser@example.com", username="newuser123", password="securepass123"
)
user = self.service.register_user(db, user_data)
@@ -36,7 +34,7 @@ class TestAuthService:
user_data = UserRegister(
email=test_user.email, # Use existing email
username="differentuser",
password="securepass123"
password="securepass123",
)
with pytest.raises(HTTPException) as exc_info:
@@ -50,7 +48,7 @@ class TestAuthService:
user_data = UserRegister(
email="different@example.com",
username=test_user.username, # Use existing username
password="securepass123"
password="securepass123",
)
with pytest.raises(HTTPException) as exc_info:
@@ -62,8 +60,7 @@ class TestAuthService:
def test_login_user_success(self, db, test_user):
"""Test successful user login"""
user_credentials = UserLogin(
username=test_user.username,
password="testpass123"
username=test_user.username, password="testpass123"
)
result = self.service.login_user(db, user_credentials)
@@ -78,10 +75,7 @@ class TestAuthService:
def test_login_user_wrong_username(self, db):
"""Test login fails with wrong username"""
user_credentials = UserLogin(
username="nonexistentuser",
password="testpass123"
)
user_credentials = UserLogin(username="nonexistentuser", password="testpass123")
with pytest.raises(HTTPException) as exc_info:
self.service.login_user(db, user_credentials)
@@ -92,8 +86,7 @@ class TestAuthService:
def test_login_user_wrong_password(self, db, test_user):
"""Test login fails with wrong password"""
user_credentials = UserLogin(
username=test_user.username,
password="wrongpassword"
username=test_user.username, password="wrongpassword"
)
with pytest.raises(HTTPException) as exc_info:
@@ -109,8 +102,7 @@ class TestAuthService:
db.commit()
user_credentials = UserLogin(
username=test_user.username,
password="testpass123"
username=test_user.username, password="testpass123"
)
with pytest.raises(HTTPException) as exc_info: