diff --git a/tests/test_hashview.py b/tests/test_hashview.py index 53ac183..8a1df3c 100644 --- a/tests/test_hashview.py +++ b/tests/test_hashview.py @@ -587,6 +587,10 @@ class TestHashviewAPI: # Set up session.get to return different responses api.session.get.side_effect = [mock_left_response, mock_found_response] + # Mock potfile path so cleanup isn't blocked by missing ~/.hashcat dir + potfile = str(tmp_path / "hashcat.potfile") + monkeypatch.setattr("hate_crack.api.get_hcat_potfile_path", lambda: potfile) + # Download left hashes (should auto-download and split found for hashcat) left_file = tmp_path / "left_1_2.txt" result = api.download_left_hashes(1, 2, output_file=str(left_file)) diff --git a/tests/test_pull_ollama_model.py b/tests/test_pull_ollama_model.py index 43b0d07..4d3cb6e 100644 --- a/tests/test_pull_ollama_model.py +++ b/tests/test_pull_ollama_model.py @@ -42,12 +42,15 @@ def ollama_env(tmp_path): @contextmanager def ollama_globals(tmp_path, tuning="", potfile=""): """Patch the hc_main globals that hcatOllama reads.""" + rules_dir = str(tmp_path / "rules") + os.makedirs(rules_dir, exist_ok=True) with mock.patch.object(hc_main, "ollamaUrl", OLLAMA_URL), \ mock.patch.object(hc_main, "ollamaModel", MODEL), \ mock.patch.object(hc_main, "hcatBin", "/usr/bin/hashcat"), \ mock.patch.object(hc_main, "hcatTuning", tuning), \ mock.patch.object(hc_main, "hcatPotfilePath", potfile), \ mock.patch.object(hc_main, "hate_path", str(tmp_path)), \ + mock.patch.object(hc_main, "rulesDirectory", rules_dir), \ mock.patch("hate_crack.main.generate_session_id", return_value="test_session"): yield