|
3 | 3 | import io |
4 | 4 | import json |
5 | 5 | import pytest |
6 | | -from app.web import app, update_state, init_config, init_storage |
| 6 | +from app.web import app, update_state, init_config, init_storage, reset_modem_state, get_state |
7 | 7 | from app.config import ConfigManager |
8 | 8 | from app.storage import SnapshotStorage |
9 | 9 | from app.modules.bnetz.storage import BnetzStorage |
@@ -208,6 +208,24 @@ def test_health_ok(self, client, sample_analysis): |
208 | 208 | assert data["status"] == "ok" |
209 | 209 | assert data["docsis_health"] == "good" |
210 | 210 |
|
| 211 | + def test_reset_modem_state_clears_stale_dashboard_data(self, client, sample_analysis): |
| 212 | + update_state( |
| 213 | + analysis=sample_analysis, |
| 214 | + device_info={"model": "Generic Router"}, |
| 215 | + connection_info={"connection_type": "generic"}, |
| 216 | + speedtest_latest={"download_mbps": 230.5}, |
| 217 | + ) |
| 218 | + |
| 219 | + reset_modem_state() |
| 220 | + state = get_state() |
| 221 | + |
| 222 | + assert state["analysis"] is None |
| 223 | + assert state["device_info"] is None |
| 224 | + assert state["connection_info"] is None |
| 225 | + assert state["last_update"] is None |
| 226 | + assert state["error"] is None |
| 227 | + assert state["speedtest_latest"] == {"download_mbps": 230.5} |
| 228 | + |
211 | 229 |
|
212 | 230 | class TestExportEndpoint: |
213 | 231 | def test_export_no_data(self, client): |
|
0 commit comments