-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_endpoints.py
More file actions
54 lines (45 loc) · 1.55 KB
/
Copy pathtest_endpoints.py
File metadata and controls
54 lines (45 loc) · 1.55 KB
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
45
46
47
48
49
50
51
52
53
54
import requests
import json
BASE_URL = "http://localhost:8001/api"
# Test data
run_id = "test_run_123"
current_state = {"narrator": "normal", "scene": "bright"}
print("Testing Edit Agent Endpoints\n")
# 1. POST /edit
print("1. POST /edit - 'Make the narrator sound more dramatic'")
data = {
"run_id": run_id,
"command": "Make the narrator sound more dramatic",
"current_state_json": current_state
}
response = requests.post(f"{BASE_URL}/edit", json=data)
print(f"Status: {response.status_code}")
print(f"Response: {json.dumps(response.json(), indent=2)}\n")
# Update current_state from response
if response.status_code == 200:
current_state = response.json()["result"]["updated_state"]
# 2. POST /edit again
print("2. POST /edit - 'The scene looks too bright'")
data = {
"run_id": run_id,
"command": "The scene looks too bright",
"current_state_json": current_state
}
response = requests.post(f"{BASE_URL}/edit", json=data)
print(f"Status: {response.status_code}")
print(f"Response: {json.dumps(response.json(), indent=2)}\n")
# 3. GET /history/{run_id}
print("3. GET /history/{run_id}")
response = requests.get(f"{BASE_URL}/history/{run_id}")
print(f"Status: {response.status_code}")
print(f"Response: {json.dumps(response.json(), indent=2)}\n")
# 4. POST /undo
print("4. POST /undo - revert to version 1")
data = {
"run_id": run_id,
"version": 1
}
response = requests.post(f"{BASE_URL}/undo", json=data)
print(f"Status: {response.status_code}")
print(f"Response: {json.dumps(response.json(), indent=2)}\n")
print("All tests completed!")