Add complete NexaFabric project structure including: - FastAPI backend with SQLAlchemy models, JWT auth, RBAC, audit logging, and provider interfaces - React + TypeScript frontend with Vite, Tailwind CSS, TanStack Query, and Zustand - Docker Compose configuration for PostgreSQL, Redis, API, worker, frontend, and nginx - GitHub Actions and GitLab CI workflows for testing, linting, building, and security scanning - Environment
27 lines
707 B
Python
27 lines
707 B
Python
from fastapi.testclient import TestClient
|
|
|
|
from app.main import app
|
|
|
|
|
|
client = TestClient(app)
|
|
|
|
|
|
def test_healthz() -> None:
|
|
response = client.get("/healthz")
|
|
assert response.status_code == 200
|
|
assert response.json() == {"status": "ok"}
|
|
|
|
|
|
def test_login_and_dashboard() -> None:
|
|
response = client.post(
|
|
"/api/v1/auth/login",
|
|
json={"email": "admin@nexafabric.local", "password": "ChangeMe_UseEnvInstead"},
|
|
)
|
|
assert response.status_code == 200
|
|
token = response.json()["access_token"]
|
|
|
|
dashboard = client.get("/api/v1/dashboard", headers={"Authorization": f"Bearer {token}"})
|
|
assert dashboard.status_code == 200
|
|
assert dashboard.json()["clusters"] >= 1
|
|
|