From 13b23250c99c14c57e988f021ac6e42d095a5f54 Mon Sep 17 00:00:00 2001 From: Pavel Savchenko Date: Sat, 27 Aug 2022 17:15:12 +0100 Subject: [PATCH 1/6] docs: add missing closing parenthesis --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c25af06a7..5121a7b68 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,7 @@ ## Setting up a Dev Environment 1. Make sure you have [Poetry](https://python-poetry.org/) installed and up to date. -2. Make sure you have a supported Python version (e.g. 3.8) installed and accessible to Poetry (e.g. with [pyenv](https://github.com/pyenv/pyenv). +2. Make sure you have a supported Python version (e.g. 3.8) installed and accessible to Poetry (e.g. with [pyenv](https://github.com/pyenv/pyenv)). 3. Use `poetry install` in the project directory to create a virtual environment with the relevant dependencies. 4. Enter a `poetry shell` to make running commands easier. From 02e7b325faf07fd69d32ec4534035fac4e0553e4 Mon Sep 17 00:00:00 2001 From: Pavel Savchenko Date: Sat, 27 Aug 2022 17:16:34 +0100 Subject: [PATCH 2/6] feat: use the official list of HTTPStatus taken from python standard library, exists from python 3.5, described in [the documentation][1] as: > A subclass of enum.IntEnum that defines a set of HTTP status codes, > reason phrases and long descriptions written in English. [1]: https://docs.python.org/3/library/http.html --- openapi_python_client/parser/openapi.py | 10 ++++++---- openapi_python_client/parser/responses.py | 14 +++++++++++--- .../templates/endpoint_module.py.jinja | 3 ++- openapi_python_client/templates/types.py.jinja | 3 ++- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/openapi_python_client/parser/openapi.py b/openapi_python_client/parser/openapi.py index f945e844b..3576771f2 100644 --- a/openapi_python_client/parser/openapi.py +++ b/openapi_python_client/parser/openapi.py @@ -2,6 +2,7 @@ from collections import OrderedDict from copy import deepcopy from dataclasses import dataclass, field +from http import HTTPStatus from typing import Any, Dict, Iterator, List, Optional, Set, Tuple, Union import attr @@ -230,15 +231,16 @@ def _add_responses( endpoint = deepcopy(endpoint) for code, response_data in data.items(): - status_code: int + status_code: HTTPStatus try: - status_code = int(code) + status_code = HTTPStatus(int(code)) except ValueError: endpoint.errors.append( ParseError( detail=( - f"Invalid response status code {code} (not a number), " - f"response will be ommitted from generated client" + f"Invalid response status code {code} (not a valid HTTP " + f"status code), response will be ommitted from generated " + f"client" ) ) ) diff --git a/openapi_python_client/parser/responses.py b/openapi_python_client/parser/responses.py index 2aaa112d5..f642cfb11 100644 --- a/openapi_python_client/parser/responses.py +++ b/openapi_python_client/parser/responses.py @@ -1,5 +1,6 @@ __all__ = ["Response", "response_from_data"] +from http import HTTPStatus from typing import Optional, Tuple, Union import attr @@ -15,7 +16,7 @@ class Response: """Describes a single response for an endpoint""" - status_code: int + status_code: HTTPStatus prop: Property source: str @@ -28,7 +29,9 @@ class Response: } -def empty_response(*, status_code: int, response_name: str, config: Config, description: Optional[str]) -> Response: +def empty_response( + *, status_code: HTTPStatus, response_name: str, config: Config, description: Optional[str] +) -> Response: """Return an untyped response, for when no response type is defined""" return Response( status_code=status_code, @@ -46,7 +49,12 @@ def empty_response(*, status_code: int, response_name: str, config: Config, desc def response_from_data( - *, status_code: int, data: Union[oai.Response, oai.Reference], schemas: Schemas, parent_name: str, config: Config + *, + status_code: HTTPStatus, + data: Union[oai.Response, oai.Reference], + schemas: Schemas, + parent_name: str, + config: Config, ) -> Tuple[Union[Response, ParseError], Schemas]: """Generate a Response from the OpenAPI dictionary representation of it""" diff --git a/openapi_python_client/templates/endpoint_module.py.jinja b/openapi_python_client/templates/endpoint_module.py.jinja index e87738fa9..abc27e6ad 100644 --- a/openapi_python_client/templates/endpoint_module.py.jinja +++ b/openapi_python_client/templates/endpoint_module.py.jinja @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, List, Optional, Union, cast import httpx @@ -75,7 +76,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[{{ return_string }} def _build_response(*, response: httpx.Response) -> Response[{{ return_string }}]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, {% if parsed_responses %} diff --git a/openapi_python_client/templates/types.py.jinja b/openapi_python_client/templates/types.py.jinja index bf90d01fd..c746db6e1 100644 --- a/openapi_python_client/templates/types.py.jinja +++ b/openapi_python_client/templates/types.py.jinja @@ -1,4 +1,5 @@ """ Contains some shared types for properties """ +from http import HTTPStatus from typing import Any, BinaryIO, Generic, MutableMapping, Optional, Tuple, TypeVar import attr @@ -35,7 +36,7 @@ T = TypeVar("T") class Response(Generic[T]): """ A response from an endpoint """ - status_code: int + status_code: HTTPStatus content: bytes headers: MutableMapping[str, str] parsed: Optional[T] From 4d8cb5e4594d06bb15945c5b5778c60cc795a394 Mon Sep 17 00:00:00 2001 From: Pavel Savchenko Date: Sat, 27 Aug 2022 17:37:35 +0100 Subject: [PATCH 3/6] test: catch invalid response status codes the spec requires this to be a valid HTTP code, invalid integers should not be supported --- tests/test_parser/test_openapi.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_parser/test_openapi.py b/tests/test_parser/test_openapi.py index cf2c77215..e3580bc21 100644 --- a/tests/test_parser/test_openapi.py +++ b/tests/test_parser/test_openapi.py @@ -383,13 +383,14 @@ def test_add_body_happy(self, mocker): assert endpoint.form_body_class == form_body_class assert endpoint.multipart_body == multipart_body - def test__add_responses_status_code_error(self, mocker): + @pytest.mark.parametrize("response_status_code", ["not_a_number", 499]) + def test__add_responses_status_code_error(self, response_status_code, mocker): from openapi_python_client.parser.openapi import Endpoint, Schemas schemas = Schemas() response_1_data = mocker.MagicMock() data = { - "not_a_number": response_1_data, + response_status_code: response_1_data, } endpoint = self.make_endpoint() parse_error = ParseError(data=mocker.MagicMock()) @@ -400,7 +401,7 @@ def test__add_responses_status_code_error(self, mocker): assert response.errors == [ ParseError( - detail=f"Invalid response status code not_a_number (not a number), response will be ommitted from generated client" + detail=f"Invalid response status code {response_status_code} (not a valid HTTP status code), response will be ommitted from generated client" ) ] response_from_data.assert_not_called() From e6081f44fd80b8ab60e0b10f3fa89cfea4b20150 Mon Sep 17 00:00:00 2001 From: Pavel Savchenko Date: Sat, 27 Aug 2022 17:48:04 +0100 Subject: [PATCH 4/6] test: update e2e/integration tests --- .../api/default/get_common_parameters.py | 3 ++- .../api/default/post_common_parameters.py | 3 ++- .../api/location/get_location_header_types.py | 3 ++- .../api/location/get_location_query_optionality.py | 3 ++- .../get_parameter_references_path_param.py | 3 ++- .../delete_common_parameters_overriding_param.py | 3 ++- .../parameters/get_common_parameters_overriding_param.py | 3 ++- .../parameters/get_same_name_multiple_locations_param.py | 3 ++- .../api/parameters/multiple_path_parameters.py | 3 ++- .../post_responses_unions_simple_before_complex.py | 5 +++-- .../my_test_api_client/api/tag1/get_tag_with_number.py | 3 ++- .../api/tests/defaults_tests_defaults_post.py | 7 ++++--- .../api/tests/get_basic_list_of_booleans.py | 5 +++-- .../api/tests/get_basic_list_of_floats.py | 5 +++-- .../api/tests/get_basic_list_of_integers.py | 5 +++-- .../api/tests/get_basic_list_of_strings.py | 5 +++-- .../my_test_api_client/api/tests/get_user_list.py | 9 +++++---- .../api/tests/int_enum_tests_int_enum_post.py | 7 ++++--- .../api/tests/json_body_tests_json_body_post.py | 7 ++++--- .../api/tests/no_response_tests_no_response_get.py | 3 ++- .../api/tests/octet_stream_tests_octet_stream_get.py | 5 +++-- .../my_test_api_client/api/tests/post_form_data.py | 3 ++- .../api/tests/post_tests_json_body_string.py | 7 ++++--- .../my_test_api_client/api/tests/test_inline_objects.py | 5 +++-- .../token_with_cookie_auth_token_with_cookie_get.py | 3 ++- .../unsupported_content_tests_unsupported_content_get.py | 3 ++- .../api/tests/upload_file_tests_upload_post.py | 7 ++++--- .../api/tests/upload_multiple_files_tests_upload_post.py | 7 ++++--- .../golden-record/my_test_api_client/api/true_/false_.py | 3 ++- .../golden-record/my_test_api_client/types.py | 3 ++- .../integration_tests/api/body/post_body_multipart.py | 7 ++++--- .../api/parameters/post_parameters_header.py | 7 ++++--- integration-tests/integration_tests/types.py | 3 ++- 33 files changed, 92 insertions(+), 59 deletions(-) diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py index 68c3bdf76..73b39c755 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, Union import httpx @@ -33,7 +34,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py index 4041c7079..512f5acec 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/default/post_common_parameters.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, Union import httpx @@ -33,7 +34,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_header_types.py b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_header_types.py index 1edce3582..82ef70cca 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_header_types.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_header_types.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, Union import httpx @@ -42,7 +43,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py index 9838c2881..b30237822 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/location/get_location_query_optionality.py @@ -1,4 +1,5 @@ import datetime +from http import HTTPStatus from typing import Any, Dict, Union import httpx @@ -57,7 +58,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py index 33028801f..5966089d0 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict import httpx @@ -43,7 +44,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py index a9fdf4d89..ff0026f6f 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, Union import httpx @@ -34,7 +35,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py index 9965f6926..9742bbaf3 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict import httpx @@ -34,7 +35,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py index ea985c15d..122081859 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, Union import httpx @@ -42,7 +43,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py index ea47dfaa8..772f405c7 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/parameters/multiple_path_parameters.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict import httpx @@ -32,7 +33,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py b/end_to_end_tests/golden-record/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py index 9dd058470..115936303 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, Optional import httpx @@ -28,7 +29,7 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[PostResponsesUnionsSimpleBeforeComplexResponse200]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = PostResponsesUnionsSimpleBeforeComplexResponse200.from_dict(response.json()) return response_200 @@ -37,7 +38,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[PostResponsesUnions def _build_response(*, response: httpx.Response) -> Response[PostResponsesUnionsSimpleBeforeComplexResponse200]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py b/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py index d50631c94..35999bf9f 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tag1/get_tag_with_number.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict import httpx @@ -26,7 +27,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py index 6c30b939d..5eb7ec0f0 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py @@ -1,4 +1,5 @@ import datetime +from http import HTTPStatus from typing import Any, Dict, List, Optional, Union, cast import httpx @@ -98,10 +99,10 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = cast(Any, response.json()) return response_200 - if response.status_code == 422: + if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 @@ -110,7 +111,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPVali def _build_response(*, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py index bddce1d9a..abe983938 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_booleans.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, List, Optional, cast import httpx @@ -25,7 +26,7 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[List[bool]]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = cast(List[bool], response.json()) return response_200 @@ -34,7 +35,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[List[bool]]: def _build_response(*, response: httpx.Response) -> Response[List[bool]]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py index 083fc498e..54f5228c9 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_floats.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, List, Optional, cast import httpx @@ -25,7 +26,7 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[List[float]]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = cast(List[float], response.json()) return response_200 @@ -34,7 +35,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[List[float]]: def _build_response(*, response: httpx.Response) -> Response[List[float]]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py index 21b9f4c4f..860c52dec 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_integers.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, List, Optional, cast import httpx @@ -25,7 +26,7 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[List[int]]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = cast(List[int], response.json()) return response_200 @@ -34,7 +35,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[List[int]]: def _build_response(*, response: httpx.Response) -> Response[List[int]]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py index 7fb6a52d6..96ceb3b9b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_basic_list_of_strings.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, List, Optional, cast import httpx @@ -25,7 +26,7 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[List[str]]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = cast(List[str], response.json()) return response_200 @@ -34,7 +35,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[List[str]]: def _build_response(*, response: httpx.Response) -> Response[List[str]]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py index e4ed22231..ba0a3351e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/get_user_list.py @@ -1,4 +1,5 @@ import datetime +from http import HTTPStatus from typing import Any, Dict, List, Optional, Union import httpx @@ -69,7 +70,7 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[Union[HTTPValidationError, List[AModel]]]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() for response_200_item_data in _response_200: @@ -78,11 +79,11 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[HTTPValidatio response_200.append(response_200_item) return response_200 - if response.status_code == 422: + if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 - if response.status_code == 423: + if response.status_code == HTTPStatus.LOCKED: response_423 = HTTPValidationError.from_dict(response.json()) return response_423 @@ -91,7 +92,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[HTTPValidatio def _build_response(*, response: httpx.Response) -> Response[Union[HTTPValidationError, List[AModel]]]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py index a18f9cfef..6fe848bf8 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, Optional, Union, cast import httpx @@ -36,10 +37,10 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = cast(Any, response.json()) return response_200 - if response.status_code == 422: + if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 @@ -48,7 +49,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPVali def _build_response(*, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py index 5dfe0a79c..9d4f1d32a 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, Optional, Union, cast import httpx @@ -31,10 +32,10 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = cast(Any, response.json()) return response_200 - if response.status_code == 422: + if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 @@ -43,7 +44,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPVali def _build_response(*, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py index d30f9e651..1804a98dd 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/no_response_tests_no_response_get.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict import httpx @@ -26,7 +27,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py index cefaeabbb..abc7c6d40 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from io import BytesIO from typing import Any, Dict, Optional @@ -26,7 +27,7 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[File]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = File(payload=BytesIO(response.content)) return response_200 @@ -35,7 +36,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[File]: def _build_response(*, response: httpx.Response) -> Response[File]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py index 7ccca1a85..40d8dacfd 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict import httpx @@ -29,7 +30,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py index 290cba783..cf8734816 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_tests_json_body_string.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, Optional, Union, cast import httpx @@ -30,10 +31,10 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[Union[HTTPValidationError, str]]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = cast(str, response.json()) return response_200 - if response.status_code == 422: + if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 @@ -42,7 +43,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[HTTPValidatio def _build_response(*, response: httpx.Response) -> Response[Union[HTTPValidationError, str]]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py index 64ae9b210..7ff96d63d 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/test_inline_objects.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, Optional import httpx @@ -31,7 +32,7 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[TestInlineObjectsResponse200]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = TestInlineObjectsResponse200.from_dict(response.json()) return response_200 @@ -40,7 +41,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[TestInlineObjectsRe def _build_response(*, response: httpx.Response) -> Response[TestInlineObjectsResponse200]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py index 337ad0603..38ac8c9b4 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict import httpx @@ -29,7 +30,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py index e2dc56a7b..60a26957e 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict import httpx @@ -26,7 +27,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py index d939f04fe..4a967179b 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_file_tests_upload_post.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, Optional, Union, cast import httpx @@ -31,10 +32,10 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = cast(Any, response.json()) return response_200 - if response.status_code == 422: + if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 @@ -43,7 +44,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPVali def _build_response(*, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py index c278f408b..58c3cef41 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/upload_multiple_files_tests_upload_post.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, List, Optional, Union, cast import httpx @@ -34,10 +35,10 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = cast(Any, response.json()) return response_200 - if response.status_code == 422: + if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 @@ -46,7 +47,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPVali def _build_response(*, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py b/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py index 2007bd6bd..adc27ae4a 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/true_/false_.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict import httpx @@ -33,7 +34,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None, diff --git a/end_to_end_tests/golden-record/my_test_api_client/types.py b/end_to_end_tests/golden-record/my_test_api_client/types.py index d8727579f..230efea92 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/types.py +++ b/end_to_end_tests/golden-record/my_test_api_client/types.py @@ -1,4 +1,5 @@ """ Contains some shared types for properties """ +from http import HTTPStatus from typing import BinaryIO, Generic, MutableMapping, Optional, Tuple, TypeVar import attr @@ -34,7 +35,7 @@ def to_tuple(self) -> FileJsonType: class Response(Generic[T]): """A response from an endpoint""" - status_code: int + status_code: HTTPStatus content: bytes headers: MutableMapping[str, str] parsed: Optional[T] diff --git a/integration-tests/integration_tests/api/body/post_body_multipart.py b/integration-tests/integration_tests/api/body/post_body_multipart.py index b582d9bfc..fd73dcafa 100644 --- a/integration-tests/integration_tests/api/body/post_body_multipart.py +++ b/integration-tests/integration_tests/api/body/post_body_multipart.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, Optional, Union import httpx @@ -32,11 +33,11 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[Union[PostBodyMultipartResponse200, PublicError]]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = PostBodyMultipartResponse200.from_dict(response.json()) return response_200 - if response.status_code == 400: + if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = PublicError.from_dict(response.json()) return response_400 @@ -45,7 +46,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[PostBodyMulti def _build_response(*, response: httpx.Response) -> Response[Union[PostBodyMultipartResponse200, PublicError]]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/integration-tests/integration_tests/api/parameters/post_parameters_header.py b/integration-tests/integration_tests/api/parameters/post_parameters_header.py index 1d12d6f8b..22879a766 100644 --- a/integration-tests/integration_tests/api/parameters/post_parameters_header.py +++ b/integration-tests/integration_tests/api/parameters/post_parameters_header.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, Optional, Union import httpx @@ -39,11 +40,11 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[Union[PostParametersHeaderResponse200, PublicError]]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = PostParametersHeaderResponse200.from_dict(response.json()) return response_200 - if response.status_code == 400: + if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = PublicError.from_dict(response.json()) return response_400 @@ -52,7 +53,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[PostParameter def _build_response(*, response: httpx.Response) -> Response[Union[PostParametersHeaderResponse200, PublicError]]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/integration-tests/integration_tests/types.py b/integration-tests/integration_tests/types.py index d8727579f..230efea92 100644 --- a/integration-tests/integration_tests/types.py +++ b/integration-tests/integration_tests/types.py @@ -1,4 +1,5 @@ """ Contains some shared types for properties """ +from http import HTTPStatus from typing import BinaryIO, Generic, MutableMapping, Optional, Tuple, TypeVar import attr @@ -34,7 +35,7 @@ def to_tuple(self) -> FileJsonType: class Response(Generic[T]): """A response from an endpoint""" - status_code: int + status_code: HTTPStatus content: bytes headers: MutableMapping[str, str] parsed: Optional[T] From 5bea94f58f2c42572a735cb5e0ed6e96686eca27 Mon Sep 17 00:00:00 2001 From: Pavel Savchenko Date: Sat, 27 Aug 2022 18:17:21 +0100 Subject: [PATCH 5/6] docs: replace broken link to dobby with knope apparently it was renamed, asked to learn more here: https://github.com/knope-dev/knope/issues/254 --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5121a7b68..d8171a0f6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,7 +32,7 @@ ## Creating a Pull Request -Once you've written the code and run the checks, the next step is to create a pull request against the `main` branch of this repository. This repository uses [conventional commits] squashed on each PR, then uses [Dobby] to auto-generate CHANGELOG.md entries for release. So the title of your PR should be in the format of a conventional commit written in plain english as it will end up in the CHANGELOG. Some example PR titles: +Once you've written the code and run the checks, the next step is to create a pull request against the `main` branch of this repository. This repository uses [conventional commits] squashed on each PR, then uses [knope] to auto-generate CHANGELOG.md entries for release. So the title of your PR should be in the format of a conventional commit written in plain english as it will end up in the CHANGELOG. Some example PR titles: - feat: Support for `allOf` in OpenAPI documents (closes #123). - refactor!: Removed support for Python 3.5 @@ -45,4 +45,4 @@ Once your PR is created, a series of automated checks should run. If any of them As soon as possible, your PR will be reviewed. If there are any changes requested there will likely be a bit of back and forth. Once this process is done, your changes will be merged into main and included in the next release. If you need your changes available on PyPI by a certain time, please mention it in the PR, and we'll do our best to accommodate. [Conventional Commits]: https://www.conventionalcommits.org/en/v1.0.0/ -[Dobby]: https://triaxtec.github.io/dobby/introduction.html +[knope]: https://knope-dev.github.io/knope/introduction.html From 2a3c240dd9b471ba188612c0bfb626b017260da0 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sun, 18 Sep 2022 12:01:02 -0600 Subject: [PATCH 6/6] test: Regen e2e tests --- .../my_test_api_client/api/tests/callback_test.py | 7 ++++--- .../my_test_api_client/api/tests/post_form_data_inline.py | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/callback_test.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/callback_test.py index e76778af3..4b2655c7c 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/callback_test.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/callback_test.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict, Optional, Union, cast import httpx @@ -31,10 +32,10 @@ def _get_kwargs( def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]: - if response.status_code == 200: + if response.status_code == HTTPStatus.OK: response_200 = cast(Any, response.json()) return response_200 - if response.status_code == 422: + if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY: response_422 = HTTPValidationError.from_dict(response.json()) return response_422 @@ -43,7 +44,7 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, HTTPVali def _build_response(*, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(response=response), diff --git a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data_inline.py b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data_inline.py index f2412ee27..46352cb64 100644 --- a/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data_inline.py +++ b/end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data_inline.py @@ -1,3 +1,4 @@ +from http import HTTPStatus from typing import Any, Dict import httpx @@ -29,7 +30,7 @@ def _get_kwargs( def _build_response(*, response: httpx.Response) -> Response[Any]: return Response( - status_code=response.status_code, + status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=None,