-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython-parse-support-responses.py
More file actions
34 lines (24 loc) · 964 Bytes
/
python-parse-support-responses.py
File metadata and controls
34 lines (24 loc) · 964 Bytes
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
from __future__ import annotations
import json
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[2]
def load_json(relative_path: str) -> dict:
return json.loads((REPO_ROOT / relative_path).read_text(encoding="utf-8"))
gates_response = load_json("examples/api/gates-response.sample.json")
stats_response = load_json("examples/api/stats-response.sample.json")
gate_ids = [gate["id"] for gate in gates_response["gates"]]
assert "G16" in gate_ids
assert stats_response["total"] >= stats_response["passed"]
assert stats_response["gates"][0]["gate"] == "G16"
summary = {
"gateCount": len(gates_response["gates"]),
"g16Present": "G16" in gate_ids,
"statsTotal": stats_response["total"],
"statsPassRate": stats_response["passRate"],
"recentCount": len(stats_response["recent"]),
"supportRoutes": [
"GET /api/validate/gates",
"GET /api/validate/stats",
],
}
print(json.dumps(summary, indent=2))