Commit Graph

4 Commits

Author SHA1 Message Date
Justin Bollinger 3d79d2d101 test: repair pre-existing flakes in cli_flags, fingerprint iter, submodule
Three unrelated test issues were masking the fingerprint regression
above and need to be green for the suite to be trustworthy:

1. tests/test_cli_flags.py: 7 tests monkeypatched input() to return "5",
   but in the no-hashfile main menu "5" enters the Wordlist Tools
   submenu and then loops forever on "Split by Length" / "File not
   found". Changed to "7" (Exit), the documented exit option.

2. tests/test_fingerprint_expander_and_hybrid.py: the iter-based
   lineCount mock (iter([1,1,1])) raised StopIteration because
   _run_hcat_cmd now also calls lineCount once per invocation when
   notifications fire. Replaced with a constant `lambda _p: 1` so the
   test no longer couples to internal call counts.

3. tests/test_submodule_hashcat_utils.py: `git submodule update --init`
   exits 0 in git worktrees but does not populate submodule
   directories. The test failed environmentally for anyone running it
   from a worktree. After the init attempt, if the dir is still empty,
   pytest.skip with a clear message rather than fail - preserves the
   original intent for normal checkouts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 14:57:22 -04:00
Justin Bollinger a014af5871 fix: correct download_left_hashes potfile merge bugs
- Delete block that wrongly appended found hashes back into the left
  (unsolved) file - found hashes belong only in the potfile
- Fix get_hcat_potfile_path() to return "" when config key is
  explicitly set to "", respecting user intent to disable potfile override
- Fix get_hcat_potfile_path() to resolve relative paths relative to the
  config file directory, matching main.py's hate_path resolution
- Add potfile_path parameter to download_left_hashes() and
  download_hashes_from_hashview() so CLI --potfile-path and
  --no-potfile-path overrides propagate to the API merge step
- Update main.py call sites to pass hcatPotfilePath through
- Add tests covering all four bug fixes
2026-03-19 19:13:41 -04:00
Justin Bollinger 5b0c119ec0 fix: handle Hashview create_job error response correctly
When the Hashview server returns HTTP 200 with an error message and no
job_id (due to its internal notify_email bug), the CLI and interactive
paths now:
- exit 1 (not 0) in the CLI path
- print "✗ Error" instead of "✓ Success"
- print a hint to check the Hashview UI before retrying, preventing
  duplicate job creation

Adds test for the error response path in test_cli_flags.py.
2026-03-09 13:17:50 -04:00
Justin Bollinger 63c3ab93d2 test: add 23 unit tests for all CLI flags and argparse errors
Cover --weakpass, --hashmob, --rules, --cleanup, --download-torrent,
--download-all-torrents, --hashview, --download-hashview, --rank,
--potfile-path, --no-potfile-path, --debug, positional hashfile/hashtype
args, hashview download-hashes subcommand, upload-hashfile-job with
--limit-recovered/--no-notify-email, and argparse error cases.
2026-03-02 21:23:28 -05:00