Skip to content

Commit

Permalink
fix path builder test
Browse files Browse the repository at this point in the history
  • Loading branch information
khizunov committed Feb 21, 2024
1 parent 189a921 commit c7bd06e
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions tests/builders/test_path_builder.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import copy
from unittest.mock import MagicMock

import pytest
Expand Down Expand Up @@ -48,10 +49,19 @@ def _get_builder_list_mock(expected_value):
],
)

expected_operation_object = copy.deepcopy(operation_object)


def add_parameters_to_operation(operation, parameters):
operation_copy = copy.deepcopy(operation)
operation_copy.parameters = parameters
return operation_copy


data_provider = (
(
{
"/pets/{id}": {
"/pets": {
"get": {
"description": "Returns pets based on ID",
"summary": "Find pets by ID",
Expand All @@ -76,16 +86,16 @@ def _get_builder_list_mock(expected_value):
},
[
Path(
url="/pets/{id}",
operations=[operation_object]
url="/pets",
operations=[expected_operation_object]
)
],
_get_builder_mock(operation_object),
_get_builder_list_mock(None),
),
(
{
"/pets/{id}": {
"/pets": {
"x-python-class": "Pet",
"get": {
"description": "Returns pets based on ID",
Expand All @@ -111,8 +121,8 @@ def _get_builder_list_mock(expected_value):
},
[
Path(
url="/pets/{id}",
operations=[operation_object],
url="/pets",
operations=[expected_operation_object],
extensions={"python_class": "Pet"}
)
],
Expand Down Expand Up @@ -166,7 +176,7 @@ def _get_builder_list_mock(expected_value):
summary="Summary description",
description="Long description",
parameters=parameters_list,
operations=[operation_object],
operations=[add_parameters_to_operation(expected_operation_object, parameters_list)]
)
],
_get_builder_mock(operation_object),
Expand Down

0 comments on commit c7bd06e

Please sign in to comment.