-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreproduce_generate_issue.py
More file actions
36 lines (31 loc) · 1.14 KB
/
reproduce_generate_issue.py
File metadata and controls
36 lines (31 loc) · 1.14 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
import requests
import sys
BASE_URL = "http://localhost:8000"
def log(msg):
print(f"[TEST] {msg}")
def reproduce_generate():
log("Attempting to generate demo data...")
try:
res = requests.post(f"{BASE_URL}/demo/generate")
if res.status_code != 200:
log(f"FAILED: Status Code {res.status_code}")
log(f"Response: {res.text}")
sys.exit(1)
else:
log(f"SUCCESS: {res.json()}")
# Check if sensors are hidden
res = requests.get(f"{BASE_URL}/sensors")
sensors = res.json()
demo_sensors = [s for s in sensors if s['unique_id'].startswith('demo-')]
for s in demo_sensors:
log(f"Sensor {s['name']} (ID: {s['id']}) is_hidden: {s.get('is_hidden')}")
if s.get('is_hidden'):
log("FAILURE: Demo sensor is hidden! Fix failed.")
sys.exit(1)
else:
log("VERIFIED: Sensor is visible.")
except Exception as e:
log(f"EXCEPTION: {e}")
sys.exit(1)
if __name__ == "__main__":
reproduce_generate()