diff --git a/tests/test_papi.py b/tests/test_papi.py index 8fbd9d4..9c7f78f 100644 --- a/tests/test_papi.py +++ b/tests/test_papi.py @@ -73,6 +73,23 @@ def test_sample_report(): assert rjson[0] == "-1#Test channel error" +def test_historique(): + id_sonde = "masonde_histo" + histo = {"identifiant": id_sonde, "nom": "Test historique"} + + assert client.post("/sonde/", json=histo).ok + + data = testutils.probe_sample_body( + channel_name="test_historique", channel_id=0, status="ok" + ) + response = client.post(f"/sonde/{id_sonde}/", json=data) + assert response.ok + + debut_supervision = client.get(f"/sonde/{id_sonde}/historique") + debut_supervision = debut_supervision.json() + assert len(debut_supervision) == 1 + assert debut_supervision[0] == f"{data['date']} test_historique absent ok" + class CodeCoverageTestCase(TestCase):