import asyncio import httpx async def verify_fix(): # Use a real admin login to get token async with httpx.AsyncClient(base_url="http://localhost:8000") as client: # Note: This assumes the server is running locally on port 8000 # If not, this is just a template for the user or for me if I can start it. try: resp = await client.post( "/api/v1/auth/login", data={"username": "admin@a.com", "password": "password123"}, headers={"X-Nexus-Portal": "internal"} ) if resp.status_code != 200: print(f"Login failed: {resp.text}") return token = resp.json()["access_token"] headers = {"Authorization": f"Bearer {token}", "X-Nexus-Portal": "internal"} # Test invalid workspace payload = { "name": "Manual Test Rule", "priority_level": "P1", "threshold_minutes": 30, "is_active": True, "workspace_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } resp = await client.post("/api/v1/escalations/rules", json=payload, headers=headers) print(f"Status Code: {resp.status_code}") print(f"Response: {resp.json()}") if resp.status_code == 404: print("SUCCESS: Received 404 Not Found as expected.") else: print(f"FAILURE: Received {resp.status_code}") except Exception as e: print(f"Error during verification: {e}") if __name__ == "__main__": asyncio.run(verify_fix())