Add utilities for testing
This commit is contained in:
parent
6942d66154
commit
6f75ce0adf
|
@ -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)
|
||||
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
],
|
||||
}
|
Loading…
Reference in New Issue