Skip to content

Commit b672f24

Browse files
committed
ci: Add test for extra path param
1 parent f0fe788 commit b672f24

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/test_parser/test_openapi.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ def test_sort_parameters(self, string_property_factory):
814814

815815
assert result_names == expected_names
816816

817-
def test_sort_parameters_invalid_path_templating(self, string_property_factory):
817+
def test_sort_parameters_missing_param(self, string_property_factory):
818818
from openapi_python_client.parser.openapi import Endpoint
819819

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

831+
def test_sort_parameters_extra_param(self, string_property_factory):
832+
from openapi_python_client.parser.openapi import Endpoint
833+
834+
endpoint = self.make_endpoint()
835+
endpoint.path = "/multiple-path-parameters"
836+
param = string_property_factory(name="param1")
837+
endpoint.path_parameters[param.name] = param
838+
839+
result = Endpoint.sort_parameters(endpoint=endpoint)
840+
841+
assert isinstance(result, ParseError)
842+
assert "Incorrect path templating" in result.detail
843+
assert endpoint.path in result.detail
844+
831845
def test_from_data_bad_params(self, mocker):
832846
from openapi_python_client.parser.openapi import Endpoint
833847

0 commit comments

Comments
 (0)