From ee4a50507fd778894c8728c6708e6e4616fe2e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20K=C3=B6tter?= Date: Fri, 20 Dec 2024 14:00:19 +0100 Subject: [PATCH] tests - adapt --- tests/path_test.py | 7 ++++--- tests/petstore_test.py | 1 + tests/petstorev3_test.py | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/path_test.py b/tests/path_test.py index 9ee54ed6..21f7b954 100644 --- a/tests/path_test.py +++ b/tests/path_test.py @@ -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() @@ -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) @@ -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() diff --git a/tests/petstore_test.py b/tests/petstore_test.py index 12d1e965..128c1ceb 100644 --- a/tests/petstore_test.py +++ b/tests/petstore_test.py @@ -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 diff --git a/tests/petstorev3_test.py b/tests/petstorev3_test.py index 8d1dd1c8..1916895b 100644 --- a/tests/petstorev3_test.py +++ b/tests/petstorev3_test.py @@ -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