diff --git a/tests/test_papi.py b/tests/test_papi.py index e378b23..e551a57 100644 --- a/tests/test_papi.py +++ b/tests/test_papi.py @@ -50,3 +50,24 @@ def test_post_data(): assert response.json()["count"] == curlen + 1 +def test_sample_report(): + id_ = "masonde_001" + + data = testutils.probe_sample_body() + response = client.post(f"/sonde/{id_}/", json=data) + assert response.status_code == 200 + + report = client.get(f"/sonde/{id_}/rapport") + rjson = report.json() + assert len(rjson) == 1 + assert rjson[0] == "-1#Test channel ok" + + data["channels"][0]["status"] = "error" + response = client.post(f"/sonde/{id_}/", json=data) + + report = client.get(f"/sonde/{id_}/rapport") + rjson = report.json() + assert len(rjson) == 1 + assert rjson[0] == "-1#Test channel error" + +