chore: update project structure and add testing framework

This commit is contained in:
Davidson Gomes
2025-04-28 20:41:10 -03:00
parent 7af234ef48
commit e7e030dfd5
49 changed files with 1261 additions and 619 deletions

1
tests/__init__.py Normal file
View File

@@ -0,0 +1 @@
# Package initialization for tests

1
tests/api/__init__.py Normal file
View File

@@ -0,0 +1 @@
# API tests package

11
tests/api/test_root.py Normal file
View File

@@ -0,0 +1,11 @@
def test_read_root(client):
"""
Test that the root endpoint returns the correct response.
"""
response = client.get("/")
assert response.status_code == 200
data = response.json()
assert "message" in data
assert "documentation" in data
assert "version" in data
assert "auth" in data

View File

@@ -0,0 +1 @@
# Services tests package

View File

@@ -0,0 +1,27 @@
from src.services.auth_service import create_access_token
from src.models.models import User
import uuid
def test_create_access_token():
"""
Test that an access token is created with the correct data.
"""
# Create a mock user
user = User(
id=uuid.uuid4(),
email="test@example.com",
hashed_password="hashed_password",
is_active=True,
is_admin=False,
name="Test User",
client_id=uuid.uuid4(),
)
# Create token
token = create_access_token(user)
# Simple validation
assert token is not None
assert isinstance(token, str)
assert len(token) > 0