Skip to content
Prev Previous commit
ci: Add test for extra path param
  • Loading branch information
dbanty committed Aug 15, 2021
commit b672f24199a5cca86052514f0cebb4003c0519ba
16 changes: 15 additions & 1 deletion tests/test_parser/test_openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ def test_sort_parameters(self, string_property_factory):

assert result_names == expected_names

def test_sort_parameters_invalid_path_templating(self, string_property_factory):
def test_sort_parameters_missing_param(self, string_property_factory):
from openapi_python_client.parser.openapi import Endpoint

endpoint = self.make_endpoint()
Expand All @@ -828,6 +828,20 @@ def test_sort_parameters_invalid_path_templating(self, string_property_factory):
assert "Incorrect path templating" in result.detail
assert endpoint.path in result.detail

def test_sort_parameters_extra_param(self, string_property_factory):
from openapi_python_client.parser.openapi import Endpoint

endpoint = self.make_endpoint()
endpoint.path = "/multiple-path-parameters"
param = string_property_factory(name="param1")
endpoint.path_parameters[param.name] = param

result = Endpoint.sort_parameters(endpoint=endpoint)

assert isinstance(result, ParseError)
assert "Incorrect path templating" in result.detail
assert endpoint.path in result.detail

def test_from_data_bad_params(self, mocker):
from openapi_python_client.parser.openapi import Endpoint

Expand Down