disallow to disable guard during focus
docker / image (push) Failing after 24s
lint / ruff (push) Failing after 28s
tests / backend (push) Successful in 37s
tests / desktop (push) Successful in 22s
tests / android-core (push) Successful in 49s
tests / web (push) Successful in 1m20s
android / apk (push) Successful in 8m49s
docker / image (push) Failing after 24s
lint / ruff (push) Failing after 28s
tests / backend (push) Successful in 37s
tests / desktop (push) Successful in 22s
tests / android-core (push) Successful in 49s
tests / web (push) Successful in 1m20s
android / apk (push) Successful in 8m49s
This commit is contained in:
21 files changed
+481
-43
No files matched your search
@@ -125,6 +125,36 @@ def test_invalid_settings_are_rejected(client):
|
||||
assert client.put("/api/settings", json={"timezone": "Mars/Olympus"}).status_code == 422
|
||||
|
||||
|
||||
def test_switching_the_guard_off_mid_interval_is_a_409(client):
|
||||
assert client.put("/api/settings", json={"blocker": {"enabled": True}}).status_code == 200
|
||||
client.post("/api/timer/start", json={"kind": "work"})
|
||||
|
||||
assert client.get("/api/blocker/policy").json()["locked"] is True
|
||||
|
||||
refused = client.put("/api/settings", json={"blocker": {"enabled": False}})
|
||||
assert refused.status_code == 409
|
||||
assert "focus guard" in refused.json()["detail"]
|
||||
|
||||
# Turning it on, and editing anything else, are both still fine.
|
||||
assert client.put("/api/settings", json={"blocker": {"enabled": True}}).status_code == 200
|
||||
lists = client.put("/api/settings", json={"blocker": {"blocked_apps": ["steam"]}})
|
||||
assert lists.status_code == 200
|
||||
assert lists.json()["settings"]["blocker"]["enabled"] is True
|
||||
|
||||
client.post("/api/timer/complete", json={"auto_next": False})
|
||||
assert client.put("/api/settings", json={"blocker": {"enabled": False}}).status_code == 200
|
||||
|
||||
|
||||
def test_resetting_the_settings_cannot_unguard_a_live_interval(client):
|
||||
client.put("/api/settings", json={"blocker": {"enabled": True}})
|
||||
client.post("/api/timer/start", json={"kind": "short_break"})
|
||||
|
||||
assert client.post("/api/settings/reset").status_code == 409
|
||||
|
||||
client.post("/api/timer/complete", json={"auto_next": False})
|
||||
assert client.post("/api/settings/reset").status_code == 200
|
||||
|
||||
|
||||
def test_notification_test_endpoint_falls_back_to_the_log(client):
|
||||
body = client.post("/api/notifications/test", json={}).json()
|
||||
assert body["deliveries"][0]["channel"] == "log"
|
||||
Reference in new issue
Block a user