Spaces:
3SCError404
/
Paused

File size: 1,704 Bytes
b7980f7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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())