def test_process_discovery_args_discovery_empty_partition(): parsed_args = { "provider": "aws-kms", "discovery": "true", "discovery-account": ["123"], "discovery-partition": [""], } with pytest.raises(ParameterParseError) as excinfo: arg_parsing._process_discovery_args(parsed_args) excinfo.match(r"Value passed to discovery-partition cannot be empty")
def test_process_discovery_args_discovery_empty_accounts_list(): parsed_args = { "provider": "aws-kms", "discovery": "true", "discovery-account": [], "discovery-partition": ["aws"], } with pytest.raises(ParameterParseError) as excinfo: arg_parsing._process_discovery_args(parsed_args) excinfo.match(r"When specifying discovery-partition, you must also specify discovery-account")
def test_process_discovery_args_discovery_true_with_filter(): parsed_args = { "provider": "aws-kms", "discovery": "true", "discovery-account": ["123"], "discovery-partition": ["aws"], } arg_parsing._process_discovery_args(parsed_args) assert parsed_args["discovery"] assert parsed_args["discovery-account"] == ["123"] assert parsed_args["discovery-partition"] == "aws"
def test_process_discovery_args_discovery_true_no_filter(): parsed_args = {"provider": "aws-kms", "discovery": "true"} arg_parsing._process_discovery_args(parsed_args) assert parsed_args["discovery"]
def test_process_discovery_args_no_discovery_encrypt(): parsed_args = {"key": ["foo"]} arg_parsing._process_discovery_args(parsed_args) assert not parsed_args["discovery"]
def test_process_discovery_args_invalid(parsed_args): with pytest.raises(ParameterParseError): arg_parsing._process_discovery_args(parsed_args)