From 723bdb5fca6dab939a4cf0e9f3f1e586897c7ff2 Mon Sep 17 00:00:00 2001 From: Colin Goutte Date: Mon, 27 Sep 2021 16:50:38 +0200 Subject: [PATCH] Fix test and code --- papi/main.py | 3 ++- tests/test_papi.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/papi/main.py b/papi/main.py index 20b08b5..a647e07 100644 --- a/papi/main.py +++ b/papi/main.py @@ -11,6 +11,7 @@ app = FastAPI() mesures = defaultdict(list) +notifications = defaultdict(list) class Sonde(BaseModel): @@ -45,7 +46,7 @@ def list_sonde(): @app.get("/notifications/{idsonde}/") def list_notification(idsonde: str): - return [notifications[idsonde][::-1]] + return notifications[idsonde][::-1] @app.post("/sonde/{idsonde}/") diff --git a/tests/test_papi.py b/tests/test_papi.py index 10bce9f..767dd55 100644 --- a/tests/test_papi.py +++ b/tests/test_papi.py @@ -143,7 +143,7 @@ def test_onchange_notification(): notifs = client.get(f"/notifications/{id_sonde}/") assert notifs.ok - assert len(notifs) == 1 + assert len(notifs.json()) == 1 class CodeCoverageTestCase(TestCase):