Files
br-acc/api/tests/integration/test_entity_integration.py
bruno cesar 393e7dc3f0 Phase 6: Auth, integration tests, deployment, ETL rewrite, frontend polish
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>
2026-02-22 04:59:39 -03:00

43 lines
1.5 KiB
Python

import pytest
from httpx import AsyncClient
@pytest.mark.integration
@pytest.mark.anyio
async def test_entity_lookup_by_cpf(integration_client: AsyncClient) -> None:
"""Lookup a seeded Person entity by CPF."""
response = await integration_client.get("/api/v1/entity/11111111111")
assert response.status_code in (200, 404)
@pytest.mark.integration
@pytest.mark.anyio
async def test_entity_lookup_by_cnpj(integration_client: AsyncClient) -> None:
"""Lookup a seeded Company entity by CNPJ."""
response = await integration_client.get("/api/v1/entity/11222333000181")
assert response.status_code in (200, 404)
@pytest.mark.integration
@pytest.mark.anyio
async def test_entity_not_found(integration_client: AsyncClient) -> None:
"""Lookup a non-existent entity returns 404."""
response = await integration_client.get("/api/v1/entity/00000000000")
assert response.status_code == 404
@pytest.mark.integration
@pytest.mark.anyio
async def test_entity_invalid_format(integration_client: AsyncClient) -> None:
"""Invalid identifier format returns 400."""
response = await integration_client.get("/api/v1/entity/abc")
assert response.status_code == 400
@pytest.mark.integration
@pytest.mark.anyio
async def test_entity_connections(integration_client: AsyncClient) -> None:
"""Lookup connections for an entity."""
response = await integration_client.get("/api/v1/entity/test-entity-id/connections")
assert response.status_code in (200, 404)