second round of review

This commit is contained in:
counterweight 2025-12-18 22:31:19 +01:00
parent da5a0d03eb
commit ca55932a41
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
10 changed files with 124 additions and 229 deletions

View file

@ -18,14 +18,13 @@ ACCESS_TOKEN_EXPIRE_MINUTES = 60 * 24 * 7 # 7 days
COOKIE_NAME = "auth_token"
class UserCreate(BaseModel):
class UserCredentials(BaseModel):
email: EmailStr
password: str
class UserLogin(BaseModel):
email: EmailStr
password: str
UserCreate = UserCredentials
UserLogin = UserCredentials
class UserResponse(BaseModel):

7
backend/tests/helpers.py Normal file
View file

@ -0,0 +1,7 @@
import uuid
def unique_email(prefix: str = "test") -> str:
"""Generate a unique email for tests sharing the same database."""
return f"{prefix}-{uuid.uuid4().hex[:8]}@example.com"

View file

@ -1,12 +1,7 @@
import pytest
import uuid
from auth import COOKIE_NAME
def unique_email(prefix: str = "test") -> str:
"""Generate a unique email for tests sharing the same database."""
return f"{prefix}-{uuid.uuid4().hex[:8]}@example.com"
from tests.helpers import unique_email
# Registration tests

View file

@ -1,12 +1,7 @@
import pytest
import uuid
from auth import COOKIE_NAME
def unique_email(prefix: str = "counter") -> str:
"""Generate a unique email for tests sharing the same database."""
return f"{prefix}-{uuid.uuid4().hex[:8]}@example.com"
from tests.helpers import unique_email
# Protected endpoint tests - without auth