M8-R02: report DSMR MQTT source health
This commit is contained in:
@@ -302,6 +302,12 @@ def test_source_channel_binding_response_contract_and_discover_capabilities(auth
|
||||
_login(client)
|
||||
source = _create_source(client, config={"username": "private-user", "password": "private-secret"})
|
||||
channel_uuid = _add_channel(engine, source["uuid"])
|
||||
with Session(engine) as session:
|
||||
source_model = session.query(MeterSource).filter_by(uuid=source["uuid"]).one()
|
||||
source_model.status = "online"
|
||||
source_model.last_seen_at = datetime.now(UTC)
|
||||
source_model.last_error = None
|
||||
session.commit()
|
||||
listed = client.get("/api/energy/sources")
|
||||
assert listed.status_code == 200
|
||||
assert listed.json()["total"] >= 1
|
||||
@@ -332,7 +338,7 @@ def test_source_channel_binding_response_contract_and_discover_capabilities(auth
|
||||
"uuid", "label", "suggested_commodity", "unit", "device_type", "latest_value",
|
||||
"latest_at", "latest_quality", "binding_count", "bound_meter_ids", "binding_summary",
|
||||
}
|
||||
assert channels.json()["source_status"] == "unknown"
|
||||
assert channels.json()["source_status"] == "online"
|
||||
|
||||
meter = client.post("/api/energy/meters", headers={"X-CSRF-Token": _CSRF}, json={
|
||||
"label": "Contract meter", "started_at": "2030-01-01T00:00:00Z", "reason": "initial",
|
||||
|
||||
Reference in New Issue
Block a user