This commit is contained in:
Jonas Bengtsson
2026-09-19 09:40:24 +02:00
parent ee4800993d
commit 19bccce083
13 changed files with 435 additions and 43 deletions
+31
View File
@@ -180,6 +180,37 @@ def test_listener_management_and_preview(admin_client):
assert delete.status_code == 204
def test_listener_update_and_preview(admin_client):
listener_id = admin_client.post(
"/api/v1/broker/listeners",
json={"name": "Production MQTT", "port": 1883, "protocol": "mqtt"},
).json()["id"]
updated = admin_client.put(
f"/api/v1/broker/listeners/{listener_id}",
json={
"name": "Production MQTT",
"port": 1884,
"bind_address": "127.0.0.1",
"protocol": "websockets",
"allow_anonymous": True,
},
)
assert updated.status_code == 200, updated.text
body = updated.json()
assert body["port"] == 1884
assert body["bind_address"] == "127.0.0.1"
assert body["protocol"] == "websockets"
assert body["allow_anonymous"] is True
config_text = admin_client.get("/api/v1/broker/config/preview").json()[
"config_text"
]
assert "listener 1884 127.0.0.1" in config_text
assert "protocol websockets" in config_text
assert "listener_allow_anonymous true" in config_text
def test_audit_events_recorded(admin_client, db_session):
from sqlalchemy import select