Skip to content

🕵️‍♂️ (2-in-1) Email & Username OSINT suite featuring native MCP support for deep data extraction just from a single Email/Username. Analyzes 2720+ actively maintained scan vectors (210+ email / 2510+ username) for security research, investigations, and digital footprinting.

test: add system-level check for Hudson Rock config defaults

kaifcodece7b33040d440
diff --git a/tests/test_helpers.py b/tests/test_helpers.py
index 6bd91d0..9ec5cd7 100644
--- a/tests/test_helpers.py
+++ b/tests/test_helpers.py
@@ -369,72 +369,69 @@ http://3""")
def test_get_config_path_default(monkeypatch):
- """Test that it returns the default path when no environment variable is set."""
monkeypatch.delenv("USER_SCANNER_CONFIG", raising=False)
path = _get_config_path()
- # This matches your default CONFIG_PATH logic
assert path == CONFIG_PATH
def test_get_config_path_env_override(monkeypatch, tmp_path):
- """Test that environment variable USER_SCANNER_CONFIG overrides the default path."""
custom_path = tmp_path / "custom_config.json"
monkeypatch.setenv("USER_SCANNER_CONFIG", str(custom_path))
path = _get_config_path()
assert path == custom_path
def test_load_config_creates_default(tmp_path):
- """Test that a default config is created with correct keys if the file doesn't exist."""
config_file = tmp_path / "new_config.json"
data = load_config(path=config_file)
-
+
assert config_file.exists()
assert data["auto_update_status"] is True
assert data["auto_hudson_prompt"] is True
def test_load_config_reads_existing(tmp_path):
- """Test that existing config data is correctly loaded from the file."""
config_file = tmp_path / "existing.json"
existing_data = {
- "auto_update_status": False,
+ "auto_update_status": False,
"auto_hudson_prompt": False
}
config_file.write_text(json.dumps(existing_data))
-
+
data = load_config(path=config_file)
assert data == existing_data
def test_save_config_value_updates_keys(tmp_path):
- """Test that save_config_value updates specific keys without losing others."""
config_file = tmp_path / "test_save.json"
-
- # 1. Update update_status to False
+
save_config_value("auto_update_status", False, path=config_file)
data = load_config(path=config_file)
assert data["auto_update_status"] is False
- assert data["auto_hudson_prompt"] is True # Should remain default
+ assert data["auto_hudson_prompt"] is True
- # 2. Update hudson_prompt to False
save_config_value("auto_hudson_prompt", False, path=config_file)
data = load_config(path=config_file)
assert data["auto_hudson_prompt"] is False
- assert data["auto_update_status"] is False # Should remain False from previous step
+ assert data["auto_update_status"] is False
def test_load_config_handles_corrupt_json(tmp_path):
- """Test that corrupted JSON in the config file triggers a reset to defaults."""
config_file = tmp_path / "corrupt.json"
- # Write invalid JSON content
- config_file.write_text("{ 'broken': true, }")
-
- # load_config should catch JSONDecodeError and return default dict
+ config_file.write_text("{ 'broken': true, }")
+
data = load_config(path=config_file)
assert data["auto_update_status"] is True
assert data["auto_hudson_prompt"] is True
def test_save_config_value_creates_directory(tmp_path):
- """Test that the helper creates the parent directory if it doesn't exist."""
nested_path = tmp_path / "subdir" / "nested_config.json"
-
+
save_config_value("auto_update_status", True, path=nested_path)
-
+
assert nested_path.exists()
assert nested_path.parent.is_dir()
+
+def test_hudson_config_value():
+ from user_scanner.core.helpers import _get_config_path, load_config
+
+ actual_path = _get_config_path()
+ data = load_config(path=actual_path)
+ status = data.get("auto_hudson_prompt")
+
+ assert status is True, f"FAIL: Actual config at {actual_path} has auto_hudson_prompt set to {status} (Expected: True)"