Initial commit

This commit is contained in:
belviskhoremk
2026-03-06 22:57:58 +00:00
commit c4d836a0f9
60 changed files with 5423 additions and 0 deletions

0
tests/__init__.py Normal file
View File

40
tests/conftest.py Normal file
View File

@@ -0,0 +1,40 @@
"""Test fixtures and configuration."""
import os
import pytest
from fastapi.testclient import TestClient
# Set test env vars before importing app
os.environ.setdefault("SUPABASE_URL", "https://test.supabase.co")
os.environ.setdefault("SUPABASE_KEY", "test-key")
os.environ.setdefault("SUPABASE_SERVICE_ROLE_KEY", "test-service-key")
os.environ.setdefault("SUPABASE_JWT_SECRET", "test-jwt-secret")
os.environ.setdefault("APP_ENV", "test")
os.environ.setdefault("DEBUG", "true")
@pytest.fixture
def app():
from app.main import create_app
return create_app()
@pytest.fixture
def client(app):
return TestClient(app)
@pytest.fixture
def auth_headers():
"""Generate auth headers with a Supabase-format test JWT."""
from datetime import datetime, timedelta, timezone
from jose import jwt
payload = {
"sub": "test-user-id",
"aud": "authenticated",
"role": "visitor",
"exp": datetime.now(timezone.utc) + timedelta(hours=1),
}
token = jwt.encode(payload, "test-jwt-secret", algorithm="HS256")
return {"Authorization": f"Bearer {token}"}

13
tests/test_health.py Normal file
View File

@@ -0,0 +1,13 @@
"""Basic smoke tests."""
def test_health_check(client):
response = client.get("/health")
assert response.status_code == 200
data = response.json()
assert data["status"] == "healthy"
def test_docs_available_in_debug(client):
response = client.get("/docs")
assert response.status_code == 200