diff --git a/tests/test_papi.py b/tests/test_papi.py index d1dd02d..36263f6 100644 --- a/tests/test_papi.py +++ b/tests/test_papi.py @@ -1,3 +1,5 @@ +import pytest + from fastapi import FastAPI from fastapi.testclient import TestClient @@ -6,6 +8,7 @@ from papi.main import app from papi.main import sondes from papi import __version__ +from . import utils as testutils client = TestClient(app) diff --git a/tests/utils.py b/tests/utils.py new file mode 100644 index 0000000..4a1988f --- /dev/null +++ b/tests/utils.py @@ -0,0 +1,29 @@ +statuses = ("error", "warning", "pending", "ok") + + +def probe_sample_body( + *, channel_name: str = "Test channel", channel_id: int = -1, status: str = "ok" +): + if status not in statuses: + raise ValueError(f"{status} not in f{statuses}") + + return { + "date": "2021-09-16T14:17:33.563Z", + "channels": [ + { + "channelType": "fm", + "lastTimestamp": "2021-09-16T14:15:29.000Z", + "status": status, + "alarms": { + "noSignal": False, + "qualityIndexStatus": "warning", + "noWatermark": False, + "timestampDrift": True, + "unexpectedWatermark": False, + }, + "name": channel_name, + "lastWatermarkId": 33336, + "id": channel_id, + }, + ], + }