diff --git a/tests/integration/test_validators.py b/tests/integration/test_validators.py index b244381..2f26a7b 100644 --- a/tests/integration/test_validators.py +++ b/tests/integration/test_validators.py @@ -306,8 +306,7 @@ class TestPathItemParamsValidator(object): assert result.parameters == {'query': {'resId': 10}} def test_request_override_param(self, spec_dict): - # override parameter path parameter on operation - # (name and in property must match) + # override path parameter on operation spec_dict["paths"]["/resource"]["get"]["parameters"] = [ { # full valid parameter object required @@ -327,6 +326,29 @@ class TestPathItemParamsValidator(object): assert result.body is None assert result.parameters == {} + def test_request_override_param_uniqueness(self, spec_dict): + # add parameter on operation with same name as on path but + # different location + spec_dict["paths"]["/resource"]["get"]["parameters"] = [ + { + # full valid parameter object required + "name": "resId", + "in": "header", + "required": False, + "schema": { + "type": "integer", + }, + } + ] + validator = RequestValidator(create_spec(spec_dict)) + request = MockRequest('http://example.com', 'get', '/resource') + result = validator.validate(request) + + assert len(result.errors) == 1 + assert type(result.errors[0]) == MissingRequiredParameter + assert result.body is None + assert result.parameters == {} + class TestResponseValidator(object):