From 1cfd48e99636d2410a09a84855806ee9231d4da2 Mon Sep 17 00:00:00 2001 From: Justin Bollinger Date: Fri, 24 Apr 2026 23:48:05 -0400 Subject: [PATCH] fix(tests): update test_download_keyboard_interrupt for new re-raise behaviour download_official_wordlist now propagates KeyboardInterrupt (via _streamed_download) so callers like list_and_download_official_wordlists can catch it and return to the menu. The old test expected False to be returned, which no longer matches the intended design. Co-Authored-By: Claude Sonnet 4.6 --- tests/test_api.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index 2a44c28..3b6fca9 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -70,15 +70,16 @@ def test_download_keyboard_interrupt(tmp_path, patch_dependencies): file_name = "wordlist.txt" out_path = str(tmp_path / file_name) - # Simulate KeyboardInterrupt in requests.get context manager + # The refactored code re-raises KeyboardInterrupt so callers (e.g. + # list_and_download_official_wordlists) can catch it and return to the menu. def raise_keyboard_interrupt(*a, **kw): raise KeyboardInterrupt() with mock.patch( "hate_crack.api.requests.get", side_effect=raise_keyboard_interrupt ): - result = api.download_official_wordlist(file_name, out_path) - assert result is False + with pytest.raises(KeyboardInterrupt): + api.download_official_wordlist(file_name, out_path) def test_download_exception(tmp_path, patch_dependencies):