36 lines
909 B
Python
36 lines
909 B
Python
from fastapi.testclient import TestClient
|
|
|
|
from esp32_http_server import app
|
|
|
|
|
|
def test_dashboard_and_list_endpoints_exist():
|
|
client = TestClient(app)
|
|
|
|
r = client.get("/")
|
|
assert r.status_code == 200
|
|
assert "ESP32 Face Dashboard" in r.text
|
|
|
|
r = client.get("/health")
|
|
assert r.status_code == 200
|
|
|
|
r = client.get("/api/rfid/users?limit=1")
|
|
# DB might not be configured in CI/dev env; endpoint should not 404.
|
|
assert r.status_code != 404
|
|
|
|
r = client.get("/api/attendance?limit=1")
|
|
assert r.status_code != 404
|
|
|
|
|
|
def test_arm_and_capture_endpoints_exist():
|
|
client = TestClient(app)
|
|
|
|
r = client.post("/arm/enroll?name=TEST")
|
|
assert r.status_code == 200
|
|
|
|
r = client.post("/job/capture_enroll")
|
|
# Might fail if server side changed, but should not 404
|
|
assert r.status_code != 404
|
|
|
|
r = client.delete("/arm/enroll")
|
|
assert r.status_code == 200
|