feat: update project structure and docs

This commit is contained in:
2026-04-25 18:38:07 +03:00
parent 9c3b44b561
commit 9772c3c908
42 changed files with 1342 additions and 6 deletions
View File
+22
View File
@@ -0,0 +1,22 @@
# API test fixtures
# Provides: httpx.AsyncClient, authentication helpers, test API data
import pytest
from httpx import ASGITransport, AsyncClient
@pytest.fixture
async def client():
"""Create async HTTP client for API testing."""
from app.main import app_factory
app = app_factory()
transport = ASGITransport(app=app)
async with AsyncClient(transport=transport, base_url="http://test") as ac:
yield ac
@pytest.fixture
def auth_headers():
"""Return mock authentication headers."""
return {"Authorization": "Bearer test_token"}
+17
View File
@@ -0,0 +1,17 @@
# Global pytest fixtures and configuration
# Shared across all test types
import sys
import pytest
# Disable Python bytecode cache
sys.dont_write_bytecode = True
@pytest.fixture(scope="session")
def event_loop_policy():
"""Use default event loop policy for asyncio tests."""
import asyncio
return asyncio.DefaultEventLoopPolicy()
View File
+27
View File
@@ -0,0 +1,27 @@
# E2E test fixtures
# Provides: full application state, end-to-end workflows, cleanup
import pytest
@pytest.fixture
async def e2e_app():
"""Create full application instance for E2E testing."""
from app.main import app_factory
app = app_factory()
yield app
# Cleanup after E2E test
@pytest.fixture
def e2e_user_data():
"""Generate realistic user data for E2E scenarios."""
from mimesis import Person
person = Person()
return {
"username": person.username(),
"email": person.email(),
"password": "SecurePass123!",
}
View File
+18
View File
@@ -0,0 +1,18 @@
# Integration test fixtures
# Provides: test database, external service connections
import pytest
@pytest.fixture
def test_db_connection():
"""Create test database connection."""
# TODO: Implement when DB is added to project
yield "test_db"
@pytest.fixture
def cleanup_db():
"""Cleanup database after test."""
yield
# TODO: Implement cleanup logic
View File
+18
View File
@@ -0,0 +1,18 @@
# Unit test fixtures
# Provides: mocks, stubs, isolated test data
from unittest.mock import AsyncMock, Mock
import pytest
@pytest.fixture
def mock_service():
"""Create a mock service for unit testing."""
return Mock()
@pytest.fixture
def mock_async_service():
"""Create an async mock service for unit testing."""
return AsyncMock()