Skip to content

Commit c7bd06e

Browse files
committed
fix path builder test
1 parent 189a921 commit c7bd06e

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

tests/builders/test_path_builder.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import copy
12
from unittest.mock import MagicMock
23

34
import pytest
@@ -48,10 +49,19 @@ def _get_builder_list_mock(expected_value):
4849
],
4950
)
5051

52+
expected_operation_object = copy.deepcopy(operation_object)
53+
54+
55+
def add_parameters_to_operation(operation, parameters):
56+
operation_copy = copy.deepcopy(operation)
57+
operation_copy.parameters = parameters
58+
return operation_copy
59+
60+
5161
data_provider = (
5262
(
5363
{
54-
"/pets/{id}": {
64+
"/pets": {
5565
"get": {
5666
"description": "Returns pets based on ID",
5767
"summary": "Find pets by ID",
@@ -76,16 +86,16 @@ def _get_builder_list_mock(expected_value):
7686
},
7787
[
7888
Path(
79-
url="/pets/{id}",
80-
operations=[operation_object]
89+
url="/pets",
90+
operations=[expected_operation_object]
8191
)
8292
],
8393
_get_builder_mock(operation_object),
8494
_get_builder_list_mock(None),
8595
),
8696
(
8797
{
88-
"/pets/{id}": {
98+
"/pets": {
8999
"x-python-class": "Pet",
90100
"get": {
91101
"description": "Returns pets based on ID",
@@ -111,8 +121,8 @@ def _get_builder_list_mock(expected_value):
111121
},
112122
[
113123
Path(
114-
url="/pets/{id}",
115-
operations=[operation_object],
124+
url="/pets",
125+
operations=[expected_operation_object],
116126
extensions={"python_class": "Pet"}
117127
)
118128
],
@@ -166,7 +176,7 @@ def _get_builder_list_mock(expected_value):
166176
summary="Summary description",
167177
description="Long description",
168178
parameters=parameters_list,
169-
operations=[operation_object],
179+
operations=[add_parameters_to_operation(expected_operation_object, parameters_list)]
170180
)
171181
],
172182
_get_builder_mock(operation_object),

0 commit comments

Comments
 (0)