Skip to content

Commit

Permalink
tests - adapt
Browse files Browse the repository at this point in the history
  • Loading branch information
commonism committed Dec 20, 2024
1 parent a6da09a commit ee4a505
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/path_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ def test_paths_tags(httpx_mock, with_paths_tags):


def test_paths_response_status_pattern_default(httpx_mock, with_paths_response_status_pattern_default):
api = OpenAPI("/", with_paths_response_status_pattern_default, session_factory=httpx.Client, raise_on_error=False)
api = OpenAPI("/", with_paths_response_status_pattern_default, session_factory=httpx.Client)
api.raise_on_http_status = []

httpx_mock.add_response(headers={"Content-Type": "application/json"}, status_code=201, json="created")
r = api._.test()
Expand All @@ -511,7 +512,7 @@ def test_paths_response_status_pattern_default(httpx_mock, with_paths_response_s
api._.test()


def test_paths_response_error(httpx_mock, with_paths_response_error_vXX):
def test_paths_response_error(mocker, httpx_mock, with_paths_response_error_vXX):
from aiopenapi3 import ResponseSchemaError, ContentTypeError, HTTPStatusError, ResponseDecodingError

api = OpenAPI("/", with_paths_response_error_vXX, session_factory=httpx.Client)
Expand Down Expand Up @@ -545,7 +546,7 @@ def test_paths_response_error(httpx_mock, with_paths_response_error_vXX):
api._.test()

httpx_mock.add_response(headers={"Content-Type": "application/json", "X-required": "1"}, status_code=437, json="ok")
api._raise_on_error = False
mocker.patch.object(api, "raise_on_http_status", return_value=[], autospec=True)
api._.test()


Expand Down
1 change: 1 addition & 0 deletions tests/petstore_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def api():
api = OpenAPI.load_sync(
url, plugins=[OnDocument(), OnMessage()], session_factory=session_factory, use_operation_tags=False
)
api.raise_on_http_status = []
api.authenticate(api_key="special-key")
return api

Expand Down
1 change: 1 addition & 0 deletions tests/petstorev3_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def api():
plugins = [OnDocument(), OnMessage()]
api = OpenAPI.load_sync(url, plugins=plugins, session_factory=session_factory, use_operation_tags=False)
api.authenticate(api_key="special-key")
api.raise_on_http_status = []
return api


Expand Down

0 comments on commit ee4a505

Please sign in to comment.