mirror of
https://github.com/kharonsec/br-acc
synced 2026-05-13 10:26:18 +02:00
Auth: JWT auth with python-jose + passlib, invite-code registration, user model + 3 Cypher queries, auth router, owner-scoped investigations. Rate limiting: slowapi on auth endpoints. Integration tests: testcontainers-based tests for entity, graph, search. Deployment: docker-compose.prod.yml, Caddyfile, backup + deploy scripts, GitHub Actions deploy workflow, deploy docs. ETL rewrite: CNPJ pipeline handles real Receita Federal CSV layout (37 cols), chunked file reading, proper field mapping. Download + explore scripts. Test fixtures with real CSV samples. Frontend polish: Spinner component, responsive CSS improvements across all pages, better navigation, visual refinements. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
from collections.abc import AsyncIterator
|
|
from unittest.mock import AsyncMock, MagicMock
|
|
|
|
import pytest
|
|
from httpx import ASGITransport, AsyncClient
|
|
|
|
from icarus.main import app
|
|
from icarus.services.auth_service import create_access_token
|
|
|
|
|
|
@pytest.fixture
|
|
async def client() -> AsyncIterator[AsyncClient]:
|
|
# Mock Neo4j driver so tests don't need a running database
|
|
mock_driver = MagicMock()
|
|
mock_driver.verify_connectivity = AsyncMock()
|
|
mock_driver.close = AsyncMock()
|
|
mock_session = AsyncMock()
|
|
mock_driver.session.return_value.__aenter__ = AsyncMock(return_value=mock_session)
|
|
mock_driver.session.return_value.__aexit__ = AsyncMock(return_value=None)
|
|
app.state.neo4j_driver = mock_driver
|
|
|
|
transport = ASGITransport(app=app) # type: ignore[arg-type]
|
|
async with AsyncClient(transport=transport, base_url="http://test") as ac:
|
|
yield ac
|
|
|
|
|
|
@pytest.fixture
|
|
def auth_headers() -> dict[str, str]:
|
|
token = create_access_token("test-user-id")
|
|
return {"Authorization": f"Bearer {token}"}
|