From 9f80bfca2e687f1fd4f062edbef5011526a1d06e Mon Sep 17 00:00:00 2001 From: Colin Goutte Date: Mon, 27 Sep 2021 16:48:27 +0200 Subject: [PATCH] Add notification route listing for probes --- papi/main.py | 5 +++++ tests/test_papi.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/papi/main.py b/papi/main.py index c69b432..20b08b5 100644 --- a/papi/main.py +++ b/papi/main.py @@ -43,6 +43,11 @@ def list_sonde(): return [x for x in sondes.values()] +@app.get("/notifications/{idsonde}/") +def list_notification(idsonde: str): + return [notifications[idsonde][::-1]] + + @app.post("/sonde/{idsonde}/") def post_sonde_data(idsonde: str, body: dict = Body(...)): if idsonde not in sondes: diff --git a/tests/test_papi.py b/tests/test_papi.py index 9a3ad9a..10bce9f 100644 --- a/tests/test_papi.py +++ b/tests/test_papi.py @@ -141,7 +141,7 @@ def test_onchange_notification(): jresp = response.json() assert not jresp["notify"] - notifs = client.get(f"notifications/{id_sonde}/") + notifs = client.get(f"/notifications/{id_sonde}/") assert notifs.ok assert len(notifs) == 1