Reset all app settings, dashboard starts empty
The reset disconnects all DSPs first and sends them nothing, asks for two random letters (and the PIN on the web), keeps a copy of the old config and reloads a fresh app. Refused during an audio test or mute all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6d53069380
commit
29a89af562
8 files changed
+117
-7
No files matched your search
@@ -241,6 +241,32 @@ def test_dj_brake_follows_music():
|
||||
assert abs(again.dj_cal["x:0"] - app.dj_cal["x:0"]) < 0.01
|
||||
|
||||
|
||||
def test_reset_config():
|
||||
import asyncio, json, server, tempfile
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
path = Path(d) / "c.json"
|
||||
app = server.App(path)
|
||||
app.load()
|
||||
app.set_pin("9999", save=False)
|
||||
app.djbrake, app.lang, app.dj_cal = True, "de", {"x:0": 5.0}
|
||||
app.dashboard = {"modules": []}
|
||||
app.app_token = "t"
|
||||
app.app_sessions, app.sessions = {"a"}, {"a": 9e12, "b": 9e12}
|
||||
app.save()
|
||||
app.mute_all["active"] = True
|
||||
try:
|
||||
asyncio.run(app.reset_config())
|
||||
raise AssertionError("mute all must block the reset")
|
||||
except ValueError:
|
||||
assert app.djbrake
|
||||
app.mute_all["active"] = False
|
||||
app.remote["enabled"] = False
|
||||
asyncio.run(app.reset_config())
|
||||
assert not app.djbrake and app.lang == "" and app.dashboard is None and app.dj_cal == {} and app.check_pin("1234")
|
||||
assert app.app_token == "t" and app.app_sessions == {"a"} and set(app.sessions) == {"a"}
|
||||
assert json.loads(path.with_name("config.before-reset.json").read_text())["djbrake"] is True
|
||||
|
||||
|
||||
def test_looks_follow_presets():
|
||||
from dsp.device import Device
|
||||
d = Device("x", "x", "127.0.0.1")
|
||||
|
||||
Reference in new issue
Block a user