diff --git a/papi/main.py b/papi/main.py index 1415a2e..413fc7e 100644 --- a/papi/main.py +++ b/papi/main.py @@ -89,5 +89,3 @@ def historique(idsonde): for d in diff["changements"]: line = date, *utils.clean_state(d) yield " ".join(line) - else: - print(f"no change for {date}") diff --git a/tests/test_papi.py b/tests/test_papi.py index 9c7f78f..98ca4fe 100644 --- a/tests/test_papi.py +++ b/tests/test_papi.py @@ -90,6 +90,27 @@ def test_historique(): assert len(debut_supervision) == 1 assert debut_supervision[0] == f"{data['date']} test_historique absent ok" + data = testutils.probe_sample_body( + channel_name="test_historique", channel_id=0, status="error" + ) + response = client.post(f"/sonde/{id_sonde}/", json=data) + assert response.ok + + ok_erreur_supervision = client.get(f"/sonde/{id_sonde}/historique") + ok_erreur_supervision = ok_erreur_supervision.json() + assert ok_erreur_supervision[-1] == f"{data['date']} test_historique ok error" + + data = testutils.probe_sample_body( + channel_name="test_historique", channel_id=0, status="error" + ) + data["channels"] = [] + response = client.post(f"/sonde/{id_sonde}/", json=data) + assert response.ok + + perte_supervision = client.get(f"/sonde/{id_sonde}/historique") + perte_supervision = perte_supervision.json() + assert perte_supervision[-1] == f"{data['date']} test_historique error absent" + class CodeCoverageTestCase(TestCase):