mirror of
https://github.com/trustedsec/hate_crack.git
synced 2026-06-21 22:32:05 -07:00
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 <noreply@anthropic.com>
This commit is contained in:
+4
-3
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user