add blocker presets
This commit is contained in:
12 files changed
+426
-83
No files matched your search
@@ -2,10 +2,34 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from app.services import settings_service
|
||||
from app.services import pomodoro, settings_service
|
||||
from app.settings_schema import SECRET_MASK
|
||||
|
||||
|
||||
def test_a_preset_change_resizes_the_running_interval(session, settings):
|
||||
row = pomodoro.start(session, settings, kind="work")
|
||||
assert row.planned_seconds == settings.pomodoro.work_minutes * 60
|
||||
|
||||
updated = settings_service.apply_patch(
|
||||
session, {"pomodoro": {"work_minutes": 85, "short_break_minutes": 10}}
|
||||
)
|
||||
|
||||
current = pomodoro.current_session(session)
|
||||
assert current.id == row.id
|
||||
assert current.planned_seconds == 85 * 60
|
||||
# Elapsed time is wall-clock, not stored — resizing never has to touch it.
|
||||
assert pomodoro.elapsed_seconds(current) >= 0
|
||||
assert updated.pomodoro.work_minutes == 85
|
||||
|
||||
|
||||
def test_a_patch_unrelated_to_durations_leaves_the_running_interval_alone(session, settings):
|
||||
row = pomodoro.start(session, settings, kind="work")
|
||||
settings_service.apply_patch(session, {"pomodoro": {"daily_goal_pomodoros": 12}})
|
||||
current = pomodoro.current_session(session)
|
||||
assert current.id == row.id
|
||||
assert current.planned_seconds == row.planned_seconds
|
||||
|
||||
|
||||
def test_patch_merges_without_clobbering_siblings(session):
|
||||
settings_service.apply_patch(session, {"pomodoro": {"work_minutes": 50}})
|
||||
updated = settings_service.apply_patch(
|
||||
|
||||
Reference in new issue
Block a user