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>
53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
import pytest
|
|
from httpx import AsyncClient
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.anyio
|
|
async def test_graph_expand_depth_1(integration_client: AsyncClient) -> None:
|
|
"""Expand graph from a seeded entity at depth 1."""
|
|
response = await integration_client.get(
|
|
"/api/v1/graph/11111111111", params={"depth": 1}
|
|
)
|
|
assert response.status_code in (200, 404)
|
|
if response.status_code == 200:
|
|
data = response.json()
|
|
assert "nodes" in data
|
|
assert "edges" in data
|
|
assert "center_id" in data
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.anyio
|
|
async def test_graph_expand_depth_2(integration_client: AsyncClient) -> None:
|
|
"""Expand graph from a seeded entity at depth 2."""
|
|
response = await integration_client.get(
|
|
"/api/v1/graph/11222333000181", params={"depth": 2}
|
|
)
|
|
assert response.status_code in (200, 404)
|
|
if response.status_code == 200:
|
|
data = response.json()
|
|
assert len(data["nodes"]) >= 1
|
|
assert isinstance(data["edges"], list)
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.anyio
|
|
async def test_graph_node_not_found(integration_client: AsyncClient) -> None:
|
|
"""Graph expand for nonexistent entity returns 404."""
|
|
response = await integration_client.get(
|
|
"/api/v1/graph/00000000000000", params={"depth": 1}
|
|
)
|
|
assert response.status_code == 404
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.anyio
|
|
async def test_graph_with_type_filter(integration_client: AsyncClient) -> None:
|
|
"""Graph expand with entity type filter."""
|
|
response = await integration_client.get(
|
|
"/api/v1/graph/11111111111",
|
|
params={"depth": 2, "entity_types": "company"},
|
|
)
|
|
assert response.status_code in (200, 404)
|