UT: Use kwargs instead of **dict in test_agent_configuration.py

This commit is contained in:
Mike Salvatore 2022-08-31 08:31:41 -04:00 committed by Shreya Malviya
parent 1444ce10c3
commit 8d991f462f
1 changed files with 3 additions and 5 deletions

View File

@ -181,24 +181,22 @@ def test_network_scan_configuration():
def test_exploitation_options_configuration_schema(): def test_exploitation_options_configuration_schema():
ports = [1, 2, 3] ports = [1, 2, 3]
config = ExploitationOptionsConfiguration(**{"http_ports": ports}) config = ExploitationOptionsConfiguration(http_ports=ports)
assert config.http_ports == tuple(ports) assert config.http_ports == tuple(ports)
@pytest.mark.parametrize("ports", INVALID_PORTS) @pytest.mark.parametrize("ports", INVALID_PORTS)
def test_exploitation_options_configuration_schema__ports_out_of_range(ports): def test_exploitation_options_configuration_schema__ports_out_of_range(ports):
invalid_ports_configuration = {"http_ports": ports}
with pytest.raises(ValueError): with pytest.raises(ValueError):
ExploitationOptionsConfiguration(**invalid_ports_configuration) ExploitationOptionsConfiguration(http_ports=ports)
def test_exploiter_configuration_schema(): def test_exploiter_configuration_schema():
name = "bond" name = "bond"
options = {"gun": "Walther PPK", "car": "Aston Martin DB5"} options = {"gun": "Walther PPK", "car": "Aston Martin DB5"}
config = PluginConfiguration(**{"name": name, "options": options}) config = PluginConfiguration(name=name, options=options)
assert config.name == name assert config.name == name
assert config.options == options assert config.options == options