feat: add FastAPI app factory and health check endpoint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 09:12:31 -06:00
parent fb4b948681
commit b3b34222c8
6 changed files with 156 additions and 2 deletions

28
tests/conftest.py Normal file
View File

@@ -0,0 +1,28 @@
"""Shared test fixtures for the SneakySwole test suite."""
import os
from unittest.mock import patch
import pytest
from fastapi.testclient import TestClient
@pytest.fixture(autouse=True)
def _set_test_env() -> None:
"""Ensure required env vars are set for all tests."""
with patch.dict(os.environ, {
"ADMIN_USERNAME": "testadmin",
"ADMIN_PASSWORD": "testpass123",
"APP_ENV": "development",
"DATABASE_URL": "sqlite:///data/test_sneakyswole.db",
}, clear=False):
yield
@pytest.fixture
def client() -> TestClient:
"""Create a FastAPI TestClient for integration tests."""
from app.main import create_app
app = create_app()
return TestClient(app)