UT: Add test for ExploitationOptionsConfigurationSchema port validation

This commit is contained in:
Shreya Malviya 2022-07-27 17:48:36 +05:30
parent 20ab2c3eca
commit 95a6c14334
1 changed files with 10 additions and 0 deletions

View File

@ -191,6 +191,16 @@ def test_exploitation_options_configuration_schema():
assert config.http_ports == tuple(ports) assert config.http_ports == tuple(ports)
@pytest.mark.parametrize("ports", [[-1, 1, 2], [1, 2, 99999]])
def test_exploitation_options_configuration_schema__ports_out_of_range(ports):
schema = ExploitationOptionsConfigurationSchema()
invalid_ports_configuration = {"http_ports": ports}
with pytest.raises(ValidationError):
schema.load(invalid_ports_configuration)
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"}