Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_quick_check_failure(self):
"""Quick check subcommand fails if ip address validation fails."""
with pytest.raises(SystemExit):
parse_arguments(["quick_check", ""])
def test_multi_quick_check(self):
"""Multi quick check subcommand called."""
args = parse_arguments(["multi_quick_check", "0.0.0.0", "0.0.0.1"])
assert args.func == multi_quick_check
def test_api_key_not_found(self, capsys, load_config):
"""Error is returned if API is not found."""
load_config.return_value = {"api_key": ""}
with pytest.raises(SystemExit):
parse_arguments(["actors"])
captured = capsys.readouterr()
assert captured.out.startswith("Error: API key not found")
def test_noise_with_date_failure(self, date_option):
"""Noise with date subcommand fails if date validation fails."""
with pytest.raises(SystemExit):
parse_arguments(["noise", date_option, "not-a-date"])
def test_context(self):
"""Context subcommand called."""
args = parse_arguments(["context", "0.0.0.0"])
assert args.func == context
def test_quick_check(self):
"""Quick check subcommand called."""
args = parse_arguments(["quick_check", "0.0.0.0"])
assert args.func == quick_check
def test_multi_quick_check_failure(self):
"""Multi quick check subcommand fails is ip validatin fails."""
with pytest.raises(SystemExit):
parse_arguments(
[
"multi_quick_check",
"",
"",
]
def test_noise_with_date(self, date_option):
"""Noise with date subcommand called."""
args = parse_arguments(["noise", date_option, "2019-01-01"])
assert args.func == noise
assert args.date == datetime.date(2019, 1, 1)
def test_actors(self):
"""Actors subcommand called."""
args = parse_arguments(["actors"])
assert args.func == actors
def test_noise(self):
"""Noise subcommand called."""
args = parse_arguments(["noise"])
assert args.func == noise