Download backend/test_openapi.py from shak3008/DocWeave: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/spaces/shak3008/DocWeave/resolve/main/backend/test_openapi.py
- Command line
-
hf download hf://spaces/shak3008/DocWeave/backend/test_openapi.py
-
curl -L -o test_openapi.py https://huggingface.co/spaces/shak3008/DocWeave/resolve/main/backend/test_openapi.py
1.54 kB
| """ | |
| Verify the OpenAPI schema generates correctly. | |
| This confirms all routers, schemas, and dependencies resolve. | |
| """ | |
| from app.main import app | |
| from fastapi.testclient import TestClient | |
| client = TestClient(app) | |
| # Get OpenAPI schema | |
| response = client.get("/openapi.json") | |
| assert response.status_code == 200, f"OpenAPI schema returned {response.status_code}" | |
| schema = response.json() | |
| paths = list(schema.get("paths", {}).keys()) | |
| print(f"Total API paths: {len(paths)}") | |
| print() | |
| # Verify all expected endpoints exist | |
| expected_endpoints = [ | |
| "/auth/signup", | |
| "/auth/login", | |
| "/auth/me", | |
| "/documents", | |
| "/documents/upload", | |
| "/workspaces", | |
| "/proposals", | |
| "/proposals/{proposal_id}/approve", | |
| "/proposals/{proposal_id}/reject", | |
| "/workflows", | |
| "/workflows/{workflow_id}", | |
| "/workflows/by-document-version/{document_version_id}", | |
| "/rules", | |
| "/rules/{rule_id}", | |
| "/rules/{rule_id}/enable", | |
| "/rules/{rule_id}/disable", | |
| "/knowledge", | |
| "/knowledge/search", | |
| "/knowledge/{item_id}", | |
| "/activity", | |
| "/dashboard/stats", | |
| ] | |
| missing = [] | |
| for ep in expected_endpoints: | |
| if ep not in paths: | |
| missing.append(ep) | |
| else: | |
| print(f" {ep}: OK") | |
| if missing: | |
| print(f"\nMISSING ENDPOINTS: {missing}") | |
| assert False, f"Missing endpoints: {missing}" | |
| else: | |
| print(f"\nAll {len(expected_endpoints)} expected endpoints registered.") | |
| print("\n===================================") | |
| print("OPENAPI SCHEMA VERIFICATION PASSED") | |
| print("===================================") | |