Add test cases to cover different collection formats (#3640)

* add test cases to cover different collection format

* add space params to retrofit 1.x

* add space params to retrofit 2.x

* rename url to localVarUrl

* fix exception in haskell servant
This commit is contained in:
William Cheng
2019-08-15 11:09:12 +08:00
committed by GitHub
parent 286cdfdfa2
commit c3535cf9ca
185 changed files with 8369 additions and 190 deletions

View File

@@ -88,6 +88,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**test_group_parameters**](docs/FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
*FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
*FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data
*FakeApi* | [**test_query_parameter_collection_format**](docs/FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-paramters |
*FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case
*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet

View File

@@ -17,6 +17,7 @@ Method | HTTP request | Description
[**test_group_parameters**](FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
[**test_inline_additional_properties**](FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
[**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data
[**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-paramters |
# **fake_health_get**
@@ -765,3 +766,63 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **test_query_parameter_collection_format**
> test_query_parameter_collection_format(pipe, ioutil, http, url, context)
To test the collection format in query parameters
### Example
```python
from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Create an instance of the API class
api_instance = petstore_api.FakeApi()
pipe = ['pipe_example'] # list[str] |
ioutil = ['ioutil_example'] # list[str] |
http = ['http_example'] # list[str] |
url = ['url_example'] # list[str] |
context = ['context_example'] # list[str] |
try:
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)
except ApiException as e:
print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pipe** | [**list[str]**](str.md)| |
**ioutil** | [**list[str]**](str.md)| |
**http** | [**list[str]**](str.md)| |
**url** | [**list[str]**](str.md)| |
**context** | [**list[str]**](str.md)| |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Success | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -1586,3 +1586,144 @@ class FakeApi(object):
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)
def test_query_parameter_collection_format(self, pipe, ioutil, http, url, context, **kwargs): # noqa: E501
"""test_query_parameter_collection_format # noqa: E501
To test the collection format in query parameters # 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_query_parameter_collection_format(pipe, ioutil, http, url, context, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param list[str] pipe: (required)
:param list[str] ioutil: (required)
:param list[str] http: (required)
:param list[str] url: (required)
:param list[str] context: (required)
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
return self.test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, **kwargs) # noqa: E501
def test_query_parameter_collection_format_with_http_info(self, pipe, ioutil, http, url, context, **kwargs): # noqa: E501
"""test_query_parameter_collection_format # noqa: E501
To test the collection format in query parameters # 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_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param list[str] pipe: (required)
:param list[str] ioutil: (required)
:param list[str] http: (required)
:param list[str] url: (required)
:param list[str] context: (required)
:param _return_http_data_only: response data without head status code
and headers
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: None
If the method is called asynchronously,
returns the request thread.
"""
local_var_params = locals()
all_params = ['pipe', 'ioutil', 'http', 'url', 'context'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method test_query_parameter_collection_format" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'pipe' is set
if ('pipe' not in local_var_params or
local_var_params['pipe'] is None):
raise ApiValueError("Missing the required parameter `pipe` when calling `test_query_parameter_collection_format`") # noqa: E501
# verify the required parameter 'ioutil' is set
if ('ioutil' not in local_var_params or
local_var_params['ioutil'] is None):
raise ApiValueError("Missing the required parameter `ioutil` when calling `test_query_parameter_collection_format`") # noqa: E501
# verify the required parameter 'http' is set
if ('http' not in local_var_params or
local_var_params['http'] is None):
raise ApiValueError("Missing the required parameter `http` when calling `test_query_parameter_collection_format`") # noqa: E501
# verify the required parameter 'url' is set
if ('url' not in local_var_params or
local_var_params['url'] is None):
raise ApiValueError("Missing the required parameter `url` when calling `test_query_parameter_collection_format`") # noqa: E501
# verify the required parameter 'context' is set
if ('context' not in local_var_params or
local_var_params['context'] is None):
raise ApiValueError("Missing the required parameter `context` when calling `test_query_parameter_collection_format`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'pipe' in local_var_params:
query_params.append(('pipe', local_var_params['pipe'])) # noqa: E501
collection_formats['pipe'] = 'multi' # noqa: E501
if 'ioutil' in local_var_params:
query_params.append(('ioutil', local_var_params['ioutil'])) # noqa: E501
collection_formats['ioutil'] = 'csv' # noqa: E501
if 'http' in local_var_params:
query_params.append(('http', local_var_params['http'])) # noqa: E501
collection_formats['http'] = 'space' # noqa: E501
if 'url' in local_var_params:
query_params.append(('url', local_var_params['url'])) # noqa: E501
collection_formats['url'] = 'csv' # noqa: E501
if 'context' in local_var_params:
query_params.append(('context', local_var_params['context'])) # noqa: E501
collection_formats['context'] = 'multi' # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/fake/test-query-paramters', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats)