From 16982f489ddbac12617fa5839b6157fef446ae76 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Mon, 14 Jul 2025 17:24:08 -0400 Subject: [PATCH] test: update helper PasswordManager mocks --- src/tests/test_background_relay_check.py | 4 ++++ src/tests/test_menu_notifications.py | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tests/test_background_relay_check.py b/src/tests/test_background_relay_check.py index f8a1347..d537c70 100644 --- a/src/tests/test_background_relay_check.py +++ b/src/tests/test_background_relay_check.py @@ -12,6 +12,8 @@ from constants import MIN_HEALTHY_RELAYS def test_background_relay_check_runs_async(monkeypatch): pm = PasswordManager.__new__(PasswordManager) + pm._current_notification = None + pm._notification_expiry = 0.0 called = {"args": None} pm.nostr_client = SimpleNamespace( check_relay_health=lambda min_relays: called.__setitem__("args", min_relays) @@ -26,6 +28,8 @@ def test_background_relay_check_runs_async(monkeypatch): def test_background_relay_check_warns_when_unhealthy(monkeypatch): pm = PasswordManager.__new__(PasswordManager) + pm._current_notification = None + pm._notification_expiry = 0.0 pm.notifications = queue.Queue() pm.nostr_client = SimpleNamespace(check_relay_health=lambda mr: mr - 1) diff --git a/src/tests/test_menu_notifications.py b/src/tests/test_menu_notifications.py index 95aa9be..402d4da 100644 --- a/src/tests/test_menu_notifications.py +++ b/src/tests/test_menu_notifications.py @@ -17,6 +17,8 @@ def _make_pm(msg): return SimpleNamespace( notifications=q, get_current_notification=lambda: q.queue[-1] if not q.empty() else None, + _current_notification=None, + _notification_expiry=0.0, is_dirty=False, last_update=time.time(), last_activity=time.time(), @@ -45,11 +47,7 @@ def test_display_menu_prints_notifications(monkeypatch, capsys): "clear_header_with_notification", lambda pm, *a, **k: ( print("HEADER"), - print( - pm.get_current_notification().message - if pm.get_current_notification() - else "" - ), + print(main.get_notification_text(pm)), ), ) monkeypatch.setattr(main, "timed_input", lambda *a, **k: "")