19 lines
491 B
Python
19 lines
491 B
Python
from meshviz.main import app
|
|
from fastapi.testclient import TestClient
|
|
|
|
client = TestClient(app)
|
|
|
|
|
|
def test_delta_endpoint_creates_delta():
|
|
resp = client.post("/delta/device1", json={"ts": 1.0, "value": 5.5})
|
|
assert resp.status_code == 200
|
|
data = resp.json()
|
|
assert data["device"] == "device1"
|
|
assert "delta_id" in data
|
|
|
|
|
|
def test_state_endpoint_returns_state():
|
|
resp = client.get("/state")
|
|
assert resp.status_code == 200
|
|
assert isinstance(resp.json(), dict)
|