[python] Add tests and fix enum path parameters (#16769)

* test: Tests for enum params in path, query and header

* fix: Get enum ref values correctly in path parameters

Closes #16688

* fix java tests failure

---------

Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
Robert Schweizer
2023-10-10 11:10:30 +02:00
committed by GitHub
parent 7bb75f4bb4
commit 9e07f85eb5
88 changed files with 1549 additions and 538 deletions

View File

@@ -104,8 +104,8 @@ Class | Method | HTTP request | Description
*BodyApi* | [**test_echo_body_tag_response_string**](docs/BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
*FormApi* | [**test_form_integer_boolean_string**](docs/FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s)
*FormApi* | [**test_form_oneof**](docs/FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema
*HeaderApi* | [**test_header_integer_boolean_string**](docs/HeaderApi.md#test_header_integer_boolean_string) | **GET** /header/integer/boolean/string | Test header parameter(s)
*PathApi* | [**tests_path_string_path_string_integer_path_integer**](docs/PathApi.md#tests_path_string_path_string_integer_path_integer) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)
*HeaderApi* | [**test_header_integer_boolean_string_enums**](docs/HeaderApi.md#test_header_integer_boolean_string_enums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s)
*PathApi* | [**tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**](docs/PathApi.md#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s)
*QueryApi* | [**test_enum_ref_string**](docs/QueryApi.md#test_enum_ref_string) | **GET** /query/enum_ref_string | Test query parameter(s)
*QueryApi* | [**test_query_datetime_date_string**](docs/QueryApi.md#test_query_datetime_date_string) | **GET** /query/datetime/date/string | Test query parameter(s)
*QueryApi* | [**test_query_integer_boolean_string**](docs/QueryApi.md#test_query_integer_boolean_string) | **GET** /query/integer/boolean/string | Test query parameter(s)

View File

@@ -4,11 +4,11 @@ All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**test_header_integer_boolean_string**](HeaderApi.md#test_header_integer_boolean_string) | **GET** /header/integer/boolean/string | Test header parameter(s)
[**test_header_integer_boolean_string_enums**](HeaderApi.md#test_header_integer_boolean_string_enums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s)
# **test_header_integer_boolean_string**
> str test_header_integer_boolean_string(integer_header=integer_header, boolean_header=boolean_header, string_header=string_header)
# **test_header_integer_boolean_string_enums**
> str test_header_integer_boolean_string_enums(integer_header=integer_header, boolean_header=boolean_header, string_header=string_header, enum_nonref_string_header=enum_nonref_string_header, enum_ref_string_header=enum_ref_string_header)
Test header parameter(s)
@@ -20,6 +20,7 @@ Test header parameter(s)
import time
import os
import openapi_client
from openapi_client.models.string_enum_ref import StringEnumRef
from openapi_client.rest import ApiException
from pprint import pprint
@@ -37,14 +38,16 @@ with openapi_client.ApiClient(configuration) as api_client:
integer_header = 56 # int | (optional)
boolean_header = True # bool | (optional)
string_header = 'string_header_example' # str | (optional)
enum_nonref_string_header = 'enum_nonref_string_header_example' # str | (optional)
enum_ref_string_header = openapi_client.StringEnumRef() # StringEnumRef | (optional)
try:
# Test header parameter(s)
api_response = api_instance.test_header_integer_boolean_string(integer_header=integer_header, boolean_header=boolean_header, string_header=string_header)
print("The response of HeaderApi->test_header_integer_boolean_string:\n")
api_response = api_instance.test_header_integer_boolean_string_enums(integer_header=integer_header, boolean_header=boolean_header, string_header=string_header, enum_nonref_string_header=enum_nonref_string_header, enum_ref_string_header=enum_ref_string_header)
print("The response of HeaderApi->test_header_integer_boolean_string_enums:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling HeaderApi->test_header_integer_boolean_string: %s\n" % e)
print("Exception when calling HeaderApi->test_header_integer_boolean_string_enums: %s\n" % e)
```
@@ -56,6 +59,8 @@ Name | Type | Description | Notes
**integer_header** | **int**| | [optional]
**boolean_header** | **bool**| | [optional]
**string_header** | **str**| | [optional]
**enum_nonref_string_header** | **str**| | [optional]
**enum_ref_string_header** | [**StringEnumRef**](.md)| | [optional]
### Return type

View File

@@ -4,11 +4,11 @@ All URIs are relative to *http://localhost:3000*
Method | HTTP request | Description
------------- | ------------- | -------------
[**tests_path_string_path_string_integer_path_integer**](PathApi.md#tests_path_string_path_string_integer_path_integer) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)
[**tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**](PathApi.md#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s)
# **tests_path_string_path_string_integer_path_integer**
> str tests_path_string_path_string_integer_path_integer(path_string, path_integer)
# **tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**
> str tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path)
Test path parameter(s)
@@ -20,6 +20,7 @@ Test path parameter(s)
import time
import os
import openapi_client
from openapi_client.models.string_enum_ref import StringEnumRef
from openapi_client.rest import ApiException
from pprint import pprint
@@ -36,14 +37,16 @@ with openapi_client.ApiClient(configuration) as api_client:
api_instance = openapi_client.PathApi(api_client)
path_string = 'path_string_example' # str |
path_integer = 56 # int |
enum_nonref_string_path = 'enum_nonref_string_path_example' # str |
enum_ref_string_path = openapi_client.StringEnumRef() # StringEnumRef |
try:
# Test path parameter(s)
api_response = api_instance.tests_path_string_path_string_integer_path_integer(path_string, path_integer)
print("The response of PathApi->tests_path_string_path_string_integer_path_integer:\n")
api_response = api_instance.tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path)
print("The response of PathApi->tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling PathApi->tests_path_string_path_string_integer_path_integer: %s\n" % e)
print("Exception when calling PathApi->tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path: %s\n" % e)
```
@@ -54,6 +57,8 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**path_string** | **str**| |
**path_integer** | **int**| |
**enum_nonref_string_path** | **str**| |
**enum_ref_string_path** | [**StringEnumRef**](.md)| |
### Return type

View File

@@ -15,7 +15,7 @@ Method | HTTP request | Description
# **test_enum_ref_string**
> str test_enum_ref_string(enum_ref_string_query=enum_ref_string_query)
> str test_enum_ref_string(enum_nonref_string_query=enum_nonref_string_query, enum_ref_string_query=enum_ref_string_query)
Test query parameter(s)
@@ -42,11 +42,12 @@ configuration = openapi_client.Configuration(
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.QueryApi(api_client)
enum_nonref_string_query = 'enum_nonref_string_query_example' # str | (optional)
enum_ref_string_query = openapi_client.StringEnumRef() # StringEnumRef | (optional)
try:
# Test query parameter(s)
api_response = api_instance.test_enum_ref_string(enum_ref_string_query=enum_ref_string_query)
api_response = api_instance.test_enum_ref_string(enum_nonref_string_query=enum_nonref_string_query, enum_ref_string_query=enum_ref_string_query)
print("The response of QueryApi->test_enum_ref_string:\n")
pprint(api_response)
except Exception as e:
@@ -59,6 +60,7 @@ with openapi_client.ApiClient(configuration) as api_client:
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**enum_nonref_string_query** | **str**| | [optional]
**enum_ref_string_query** | [**StringEnumRef**](.md)| | [optional]
### Return type

View File

@@ -20,10 +20,11 @@ import warnings
from pydantic import validate_call, ValidationError
from typing import Dict, List, Optional, Tuple
from pydantic import StrictBool, StrictInt, StrictStr
from pydantic import StrictBool, StrictInt, StrictStr, field_validator
from typing import Optional
from openapi_client.models.string_enum_ref import StringEnumRef
from openapi_client.api_client import ApiClient
from openapi_client.api_response import ApiResponse
@@ -46,14 +47,14 @@ class HeaderApi:
self.api_client = api_client
@validate_call
def test_header_integer_boolean_string(self, integer_header : Optional[StrictInt] = None, boolean_header : Optional[StrictBool] = None, string_header : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501
def test_header_integer_boolean_string_enums(self, integer_header : Optional[StrictInt] = None, boolean_header : Optional[StrictBool] = None, string_header : Optional[StrictStr] = None, enum_nonref_string_header : Optional[StrictStr] = None, enum_ref_string_header : Optional[StringEnumRef] = None, **kwargs) -> str: # noqa: E501
"""Test header parameter(s) # noqa: E501
Test header parameter(s) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_header_integer_boolean_string(integer_header, boolean_header, string_header, async_req=True)
>>> thread = api.test_header_integer_boolean_string_enums(integer_header, boolean_header, string_header, enum_nonref_string_header, enum_ref_string_header, async_req=True)
>>> result = thread.get()
:param integer_header:
@@ -62,6 +63,10 @@ class HeaderApi:
:type boolean_header: bool
:param string_header:
:type string_header: str
:param enum_nonref_string_header:
:type enum_nonref_string_header: str
:param enum_ref_string_header:
:type enum_ref_string_header: StringEnumRef
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request.
@@ -75,19 +80,19 @@ class HeaderApi:
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
message = "Error! Please call the test_header_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
message = "Error! Please call the test_header_integer_boolean_string_enums_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_header_integer_boolean_string_with_http_info(integer_header, boolean_header, string_header, **kwargs) # noqa: E501
return self.test_header_integer_boolean_string_enums_with_http_info(integer_header, boolean_header, string_header, enum_nonref_string_header, enum_ref_string_header, **kwargs) # noqa: E501
@validate_call
def test_header_integer_boolean_string_with_http_info(self, integer_header : Optional[StrictInt] = None, boolean_header : Optional[StrictBool] = None, string_header : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501
def test_header_integer_boolean_string_enums_with_http_info(self, integer_header : Optional[StrictInt] = None, boolean_header : Optional[StrictBool] = None, string_header : Optional[StrictStr] = None, enum_nonref_string_header : Optional[StrictStr] = None, enum_ref_string_header : Optional[StringEnumRef] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test header parameter(s) # noqa: E501
Test header parameter(s) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_header_integer_boolean_string_with_http_info(integer_header, boolean_header, string_header, async_req=True)
>>> thread = api.test_header_integer_boolean_string_enums_with_http_info(integer_header, boolean_header, string_header, enum_nonref_string_header, enum_ref_string_header, async_req=True)
>>> result = thread.get()
:param integer_header:
@@ -96,6 +101,10 @@ class HeaderApi:
:type boolean_header: bool
:param string_header:
:type string_header: str
:param enum_nonref_string_header:
:type enum_nonref_string_header: str
:param enum_ref_string_header:
:type enum_ref_string_header: StringEnumRef
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
@@ -126,7 +135,9 @@ class HeaderApi:
_all_params = [
'integer_header',
'boolean_header',
'string_header'
'string_header',
'enum_nonref_string_header',
'enum_ref_string_header'
]
_all_params.extend(
[
@@ -145,7 +156,7 @@ class HeaderApi:
if _key not in _all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method test_header_integer_boolean_string" % _key
" to method test_header_integer_boolean_string_enums" % _key
)
_params[_key] = _val
del _params['kwargs']
@@ -168,6 +179,12 @@ class HeaderApi:
if _params['string_header'] is not None:
_header_params['string_header'] = _params['string_header']
if _params['enum_nonref_string_header'] is not None:
_header_params['enum_nonref_string_header'] = _params['enum_nonref_string_header']
if _params['enum_ref_string_header'] is not None:
_header_params['enum_ref_string_header'] = _params['enum_ref_string_header']
# process the form parameters
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
@@ -185,7 +202,7 @@ class HeaderApi:
}
return self.api_client.call_api(
'/header/integer/boolean/string', 'GET',
'/header/integer/boolean/string/enums', 'GET',
_path_params,
_query_params,
_header_params,

View File

@@ -20,8 +20,9 @@ import warnings
from pydantic import validate_call, ValidationError
from typing import Dict, List, Optional, Tuple
from pydantic import StrictInt, StrictStr
from pydantic import StrictInt, StrictStr, field_validator
from openapi_client.models.string_enum_ref import StringEnumRef
from openapi_client.api_client import ApiClient
from openapi_client.api_response import ApiResponse
@@ -44,20 +45,24 @@ class PathApi:
self.api_client = api_client
@validate_call
def tests_path_string_path_string_integer_path_integer(self, path_string : StrictStr, path_integer : StrictInt, **kwargs) -> str: # noqa: E501
def tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(self, path_string : StrictStr, path_integer : StrictInt, enum_nonref_string_path : StrictStr, enum_ref_string_path : StringEnumRef, **kwargs) -> str: # noqa: E501
"""Test path parameter(s) # noqa: E501
Test path parameter(s) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.tests_path_string_path_string_integer_path_integer(path_string, path_integer, async_req=True)
>>> thread = api.tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path, async_req=True)
>>> result = thread.get()
:param path_string: (required)
:type path_string: str
:param path_integer: (required)
:type path_integer: int
:param enum_nonref_string_path: (required)
:type enum_nonref_string_path: str
:param enum_ref_string_path: (required)
:type enum_ref_string_path: StringEnumRef
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request.
@@ -71,25 +76,29 @@ class PathApi:
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
message = "Error! Please call the tests_path_string_path_string_integer_path_integer_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
message = "Error! Please call the tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer, **kwargs) # noqa: E501
return self.tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_with_http_info(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path, **kwargs) # noqa: E501
@validate_call
def tests_path_string_path_string_integer_path_integer_with_http_info(self, path_string : StrictStr, path_integer : StrictInt, **kwargs) -> ApiResponse: # noqa: E501
def tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_with_http_info(self, path_string : StrictStr, path_integer : StrictInt, enum_nonref_string_path : StrictStr, enum_ref_string_path : StringEnumRef, **kwargs) -> ApiResponse: # noqa: E501
"""Test path parameter(s) # noqa: E501
Test path parameter(s) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer, async_req=True)
>>> thread = api.tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_with_http_info(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path, async_req=True)
>>> result = thread.get()
:param path_string: (required)
:type path_string: str
:param path_integer: (required)
:type path_integer: int
:param enum_nonref_string_path: (required)
:type enum_nonref_string_path: str
:param enum_ref_string_path: (required)
:type enum_ref_string_path: StringEnumRef
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
@@ -119,7 +128,9 @@ class PathApi:
_all_params = [
'path_string',
'path_integer'
'path_integer',
'enum_nonref_string_path',
'enum_ref_string_path'
]
_all_params.extend(
[
@@ -138,7 +149,7 @@ class PathApi:
if _key not in _all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method tests_path_string_path_string_integer_path_integer" % _key
" to method tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path" % _key
)
_params[_key] = _val
del _params['kwargs']
@@ -153,6 +164,12 @@ class PathApi:
if _params['path_integer'] is not None:
_path_params['path_integer'] = _params['path_integer']
if _params['enum_nonref_string_path'] is not None:
_path_params['enum_nonref_string_path'] = _params['enum_nonref_string_path']
if _params['enum_ref_string_path'] is not None:
_path_params['enum_ref_string_path'] = _params['enum_ref_string_path'].value
# process the query parameters
_query_params: List[Tuple[str, str]] = []
@@ -175,7 +192,7 @@ class PathApi:
}
return self.api_client.call_api(
'/path/string/{path_string}/integer/{path_integer}', 'GET',
'/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}', 'GET',
_path_params,
_query_params,
_header_params,

View File

@@ -22,7 +22,7 @@ from typing import Dict, List, Optional, Tuple
from datetime import date, datetime
from pydantic import StrictBool, StrictInt, StrictStr
from pydantic import StrictBool, StrictInt, StrictStr, field_validator
from typing import Any, Optional
@@ -51,16 +51,18 @@ class QueryApi:
self.api_client = api_client
@validate_call
def test_enum_ref_string(self, enum_ref_string_query : Optional[StringEnumRef] = None, **kwargs) -> str: # noqa: E501
def test_enum_ref_string(self, enum_nonref_string_query : Optional[StrictStr] = None, enum_ref_string_query : Optional[StringEnumRef] = None, **kwargs) -> str: # noqa: E501
"""Test query parameter(s) # noqa: E501
Test query parameter(s) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_enum_ref_string(enum_ref_string_query, async_req=True)
>>> thread = api.test_enum_ref_string(enum_nonref_string_query, enum_ref_string_query, async_req=True)
>>> result = thread.get()
:param enum_nonref_string_query:
:type enum_nonref_string_query: str
:param enum_ref_string_query:
:type enum_ref_string_query: StringEnumRef
:param async_req: Whether to execute the request asynchronously.
@@ -78,19 +80,21 @@ class QueryApi:
if '_preload_content' in kwargs:
message = "Error! Please call the test_enum_ref_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_enum_ref_string_with_http_info(enum_ref_string_query, **kwargs) # noqa: E501
return self.test_enum_ref_string_with_http_info(enum_nonref_string_query, enum_ref_string_query, **kwargs) # noqa: E501
@validate_call
def test_enum_ref_string_with_http_info(self, enum_ref_string_query : Optional[StringEnumRef] = None, **kwargs) -> ApiResponse: # noqa: E501
def test_enum_ref_string_with_http_info(self, enum_nonref_string_query : Optional[StrictStr] = None, enum_ref_string_query : Optional[StringEnumRef] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test query parameter(s) # noqa: E501
Test query parameter(s) # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_enum_ref_string_with_http_info(enum_ref_string_query, async_req=True)
>>> thread = api.test_enum_ref_string_with_http_info(enum_nonref_string_query, enum_ref_string_query, async_req=True)
>>> result = thread.get()
:param enum_nonref_string_query:
:type enum_nonref_string_query: str
:param enum_ref_string_query:
:type enum_ref_string_query: StringEnumRef
:param async_req: Whether to execute the request asynchronously.
@@ -121,6 +125,7 @@ class QueryApi:
_params = locals()
_all_params = [
'enum_nonref_string_query',
'enum_ref_string_query'
]
_all_params.extend(
@@ -152,6 +157,9 @@ class QueryApi:
# process the query parameters
_query_params: List[Tuple[str, str]] = []
if _params.get('enum_nonref_string_query') is not None: # noqa: E501
_query_params.append(('enum_nonref_string_query', _params['enum_nonref_string_query']))
if _params.get('enum_ref_string_query') is not None: # noqa: E501
_query_params.append(('enum_ref_string_query', _params['enum_ref_string_query'].value))

View File

@@ -37,14 +37,47 @@ class TestManual(unittest.TestCase):
def tearDown(self):
pass
def testEnumRefString(self):
api_instance = openapi_client.QueryApi()
q = openapi_client.StringEnumRef("unclassified")
# Test query parameter(s)
api_response = api_instance.test_enum_ref_string(enum_ref_string_query=q)
def testPathParameters(self):
api_instance = openapi_client.PathApi()
api_response = api_instance.tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(
path_string="string_value",
path_integer=123,
enum_nonref_string_path="success",
enum_ref_string_path=openapi_client.StringEnumRef.FAILURE,
)
e = EchoServerResponseParser(api_response)
self.assertEqual(e.path, "/query/enum_ref_string?enum_ref_string_query=unclassified")
self.assertEqual(e.path, "/path/string/string_value/integer/123/success/failure")
def testHeaderParameters(self):
api_instance = openapi_client.HeaderApi()
api_response = api_instance.test_header_integer_boolean_string_enums(
integer_header=123,
boolean_header=True,
string_header="string_value",
enum_nonref_string_header="success",
enum_ref_string_header=openapi_client.StringEnumRef.FAILURE,
)
e = EchoServerResponseParser(api_response)
expected_header = dict(
integer_header="123",
boolean_header="True",
string_header="string_value",
enum_nonref_string_header="success",
enum_ref_string_header="failure",
)
self.assertDictContainsSubset(expected_header, e.headers)
def testEnumQueryParameters(self):
api_instance = openapi_client.QueryApi()
api_response = api_instance.test_enum_ref_string(
enum_nonref_string_query="success",
enum_ref_string_query=openapi_client.StringEnumRef("unclassified"),
)
e = EchoServerResponseParser(api_response)
self.assertEqual(
e.path,
"/query/enum_ref_string?enum_nonref_string_query=success&enum_ref_string_query=unclassified",
)
def testDateTimeQueryWithDateTimeFormat(self):