mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-07-04 11:43:09 +02:00
Extracted from testsAndMisc monorepo. Changes: - Rewrote imports from python_pkg.screen_locker.* → screen_locker.* - Vendored python_pkg.shared.log_integrity → screen_locker._log_integrity - Vendored wake_alarm constants (ALARM_DAYS, WAKE_AFTER_HOURS, RTCWAKE_BIN) into _constants.py - Extracted has_workout_skip_today into new screen_locker._wake_state module - Added tests for _wake_state.py (392 tests, 100% branch coverage) - Moved scripts/service files to repo root - Added standalone pyproject.toml, requirements.txt, .pre-commit-config.yaml, .gitignore - Added GitHub Actions CI workflows Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""Tests for UI flows coverage gaps (part 2)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
from unittest.mock import MagicMock
|
|
|
|
from screen_locker.tests.conftest import create_locker
|
|
|
|
if TYPE_CHECKING:
|
|
from pathlib import Path
|
|
|
|
|
|
class TestUpdateSickCountdownAtZero:
|
|
"""Tests for _update_sick_countdown at zero remaining."""
|
|
|
|
def test_records_sick_day_and_unlocks_at_zero(
|
|
self,
|
|
mock_tk: MagicMock,
|
|
mock_sys_exit: MagicMock,
|
|
tmp_path: Path,
|
|
) -> None:
|
|
"""Test countdown at zero records sick day and calls unlock."""
|
|
locker = create_locker(mock_tk, tmp_path)
|
|
locker.sick_remaining_time = 0
|
|
locker.sick_countdown_label = MagicMock()
|
|
locker.workout_data = {}
|
|
locker.log_file = tmp_path / "workout_log.json"
|
|
object.__setattr__(locker, "unlock_screen", MagicMock())
|
|
|
|
locker._update_sick_countdown()
|
|
|
|
assert locker.workout_data["type"] == "sick_day"
|
|
assert locker.workout_data["note"] == "Sick day - shutdown moved earlier"
|
|
locker.unlock_screen.assert_called_once()
|