Spaces:
Running
Running
| import sys | |
| import os | |
| import json | |
| from fastapi.testclient import TestClient | |
| # Must run from inside gov_backend directory for imports to work | |
| sys.path.insert(0, os.path.abspath(".")) | |
| from api import app | |
| client = TestClient(app) | |
| print("--- Testing /health ---") | |
| response = client.get("/health") | |
| print(response.json()) | |
| print("\n--- Testing /api/gazette/search ---") | |
| payload = { | |
| "query": "solar power tax exemption", | |
| "limit": 5 | |
| } | |
| response = client.post("/api/gazette/search", json=payload) | |
| data = response.json() | |
| print(json.dumps(data, indent=2)) | |
| if data.get("results"): | |
| print("\nSUCCESS: Hybrid search pipeline integrated correctly with learned weights!") | |
| else: | |
| print("\nNo results found, but endpoint responded correctly.") | |