Skip to content

Commit 711c25d

Browse files
test: fix timer hour calculation and log format assertions
- Use duration=120 to kill // 60 → // 61 mutant (120//60=2 vs 120//61=1) - Use exact log record message comparison to kill format string XX mutant Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a21260a commit 711c25d

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

tests/test_b2c_login.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,11 @@ def test_body_logged(self, caplog):
288288
resp = self._make_resp()
289289
with caplog.at_level(logging.DEBUG, "flameconnect"):
290290
_log_response(resp, "Hello body")
291-
# Exact format prefix (kills "<<< body: %s" → "XX<<< body: %sXX")
292-
assert "<<< body: Hello body" in caplog.text
291+
# Check exact log record message (kills "<<< body: %s" → "XX...")
292+
body_records = [r for r in caplog.records if "body" in r.getMessage().lower()]
293+
assert body_records
294+
msg = body_records[0].getMessage()
295+
assert msg == "<<< body: Hello body"
293296

294297
def test_long_body_truncated(self, caplog):
295298
resp = self._make_resp()

tests/test_cli_commands.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,13 +355,14 @@ def test_timer_disabled(self, capsys):
355355
def test_timer_enabled_with_duration(self, capsys):
356356
from datetime import datetime, timedelta
357357

358-
param = TimerParam(timer_status=TimerStatus.ENABLED, duration=90)
358+
param = TimerParam(timer_status=TimerStatus.ENABLED, duration=120)
359359
before = datetime.now()
360360
_display_timer(param)
361361
after = datetime.now()
362362
out = capsys.readouterr().out
363363
assert " Timer: Enabled" in out
364-
assert " Duration: 90 min (1h 30m)" in out
364+
# 120 // 60 = 2h (kills // 60 → // 61 since 120//61 = 1)
365+
assert " Duration: 120 min (2h 0m)" in out
365366
assert " Off at:" in out
366367
# Verify the off-at time is in the future (kills + → − mutant)
367368
off_line = [line for line in out.split("\n") if "Off at:" in line][0]
@@ -372,9 +373,9 @@ def test_timer_enabled_with_duration(self, capsys):
372373
hour, minute = int(off_time_str[:2]), int(off_time_str[3:])
373374
assert 0 <= hour <= 23
374375
assert 0 <= minute <= 59
375-
# Verify time is approximately now + 90 min (kills + → − and // 60 → // 61)
376-
expected_min = (before + timedelta(minutes=90)).strftime("%H:%M")
377-
expected_max = (after + timedelta(minutes=90)).strftime("%H:%M")
376+
# Verify time is approximately now + 120 min (kills + → − and // 60 → // 61)
377+
expected_min = (before + timedelta(minutes=120)).strftime("%H:%M")
378+
expected_max = (after + timedelta(minutes=120)).strftime("%H:%M")
378379
assert off_time_str in (expected_min, expected_max)
379380

380381
def test_timer_enabled_zero_duration(self, capsys):

0 commit comments

Comments
 (0)