From c5510678f9a0a3b254516368a60dc7e53d3122a2 Mon Sep 17 00:00:00 2001 From: Colin Goutte Date: Mon, 27 Sep 2021 15:25:07 +0200 Subject: [PATCH] Check that repost is fine --- tests/test_papi.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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" + +