-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_debug_kanban.py
More file actions
55 lines (45 loc) · 1.59 KB
/
Copy path_debug_kanban.py
File metadata and controls
55 lines (45 loc) · 1.59 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
55
"""Debug kanban endpoints failure."""
import httpx
from gois.metrics import Metrics, run_http_server
def projects_handler(user=None) -> dict:
return {
"ok": True,
"projects": [{"workdir": "/tmp/app", "kanban_file": "kanban.yaml", "label": "App"}],
"agents": [{"slug": "maria-backend", "display_name": "Maria Backend", "mascot": "owl"}],
}
def get_handler(query: dict, user=None) -> dict:
return {
"ok": True,
"workdir": query.get("workdir"),
"kanban_file": query.get("kanban_file") or "kanban.yaml",
"columns": [{"id": "todo", "title": "A fazer"}],
"tasks": [],
}
def action_handler(payload: dict, user=None) -> dict:
return {
"ok": True,
"action": payload.get("action"),
"task_id": payload.get("task_id"),
"result_comment": payload.get("result_comment"),
"workdir": payload.get("workdir"),
"kanban_file": payload.get("kanban_file") or "kanban.yaml",
"columns": [{"id": "todo", "title": "A fazer"}],
"tasks": payload.get("task") and [payload.get("task")] or [],
}
metrics = Metrics()
server = run_http_server(
"127.0.0.1",
0,
metrics,
status_provider=lambda: {},
hermes_kanban_projects=projects_handler,
hermes_kanban_get=get_handler,
hermes_kanban_action=action_handler,
)
assert server is not None
host, port = server.server_address
with httpx.Client() as client:
rp = client.get(f"http://{host}:{port}/hermes/kanban/projects")
print(f"Projects Status: {rp.status_code}")
print(f"Projects Body: {rp.text}")
server.shutdown()