Historique supervision

This commit is contained in:
Colin Goutte 2021-09-27 16:21:21 +02:00
parent b729983b2a
commit baee17b37f
2 changed files with 21 additions and 2 deletions

View File

@ -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}")

View File

@ -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):