This commit is contained in:
Greg Huang 2017-07-18 14:16:35 +08:00 committed by wing328
parent 5aced55075
commit dafefc06f1
10 changed files with 248 additions and 82 deletions

View File

@ -88,7 +88,7 @@ class ApiClient(object):
_return_http_data_only=None, collection_formats=None, _preload_content=True, _return_http_data_only=None, collection_formats=None, _preload_content=True,
_request_timeout=None): _request_timeout=None):
config = Configuration() config = self.configuration
# header parameters # header parameters
header_params = header_params or {} header_params = header_params or {}

View File

@ -1 +1 @@
2.2.3-SNAPSHOT 2.3.0-SNAPSHOT

View File

@ -75,6 +75,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters *FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters
*FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data
*FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case *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* | [**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 *PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet

View File

@ -11,6 +11,7 @@ Method | HTTP request | Description
[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters [**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters
[**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data
# **fake_outer_boolean_serialize** # **fake_outer_boolean_serialize**
@ -274,7 +275,7 @@ api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
number = 3.4 # float | None number = 3.4 # float | None
double = 1.2 # float | None double = 1.2 # float | None
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
byte = 'B' # str | None byte = 'byte_example' # str | None
integer = 56 # int | None (optional) integer = 56 # int | None (optional)
int32 = 56 # int | None (optional) int32 = 56 # int | None (optional)
int64 = 789 # int | None (optional) int64 = 789 # int | None (optional)
@ -388,3 +389,52 @@ 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) [[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_json_form_data**
> test_json_form_data(param, param2)
test json serialization of form data
### 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()
param = 'param_example' # str | field1
param2 = 'param2_example' # str | field2
try:
# test json serialization of form data
api_instance.test_json_form_data(param, param2)
except ApiException as e:
print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | **str**| field1 |
**param2** | **str**| field2 |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
[[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

@ -14,7 +14,7 @@ To test class name in snake case
### Example ### Example
```python ```python
from __future__ import print_statement from __future__ import print_function
import time import time
import petstore_api import petstore_api
from petstore_api.rest import ApiException from petstore_api.rest import ApiException

View File

@ -97,7 +97,7 @@ class ApiClient(object):
_return_http_data_only=None, collection_formats=None, _preload_content=True, _return_http_data_only=None, collection_formats=None, _preload_content=True,
_request_timeout=None): _request_timeout=None):
config = Configuration() config = self.configuration
# header parameters # header parameters
header_params = header_params or {} header_params = header_params or {}

View File

@ -39,22 +39,18 @@ class FakeApi(object):
""" """
Test serialization of outer boolean types Test serialization of outer boolean types
This method makes a synchronous HTTP request by default. To make an This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function asynchronous HTTP request, please pass async=True
to be invoked when receiving the response. >>> thread = api.fake_outer_boolean_serialize(async=True)
>>> def callback_function(response): >>> result = thread.get()
>>> pprint(response)
>>>
>>> thread = api.fake_outer_boolean_serialize(callback=callback_function)
:param callback function: The callback function :param async bool
for asynchronous request. (optional)
:param OuterBoolean body: Input boolean as post body :param OuterBoolean body: Input boolean as post body
:return: OuterBoolean :return: OuterBoolean
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
kwargs['_return_http_data_only'] = True kwargs['_return_http_data_only'] = True
if kwargs.get('callback'): if kwargs.get('async'):
return self.fake_outer_boolean_serialize_with_http_info(**kwargs) return self.fake_outer_boolean_serialize_with_http_info(**kwargs)
else: else:
(data) = self.fake_outer_boolean_serialize_with_http_info(**kwargs) (data) = self.fake_outer_boolean_serialize_with_http_info(**kwargs)
@ -64,15 +60,11 @@ class FakeApi(object):
""" """
Test serialization of outer boolean types Test serialization of outer boolean types
This method makes a synchronous HTTP request by default. To make an This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function asynchronous HTTP request, please pass async=True
to be invoked when receiving the response. >>> thread = api.fake_outer_boolean_serialize_with_http_info(async=True)
>>> def callback_function(response): >>> result = thread.get()
>>> pprint(response)
>>>
>>> thread = api.fake_outer_boolean_serialize_with_http_info(callback=callback_function)
:param callback function: The callback function :param async bool
for asynchronous request. (optional)
:param OuterBoolean body: Input boolean as post body :param OuterBoolean body: Input boolean as post body
:return: OuterBoolean :return: OuterBoolean
If the method is called asynchronously, If the method is called asynchronously,
@ -80,7 +72,7 @@ class FakeApi(object):
""" """
all_params = ['body'] all_params = ['body']
all_params.append('callback') all_params.append('async')
all_params.append('_return_http_data_only') all_params.append('_return_http_data_only')
all_params.append('_preload_content') all_params.append('_preload_content')
all_params.append('_request_timeout') all_params.append('_request_timeout')
@ -122,7 +114,7 @@ class FakeApi(object):
files=local_var_files, files=local_var_files,
response_type='OuterBoolean', response_type='OuterBoolean',
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback'), async=params.get('async'),
_return_http_data_only=params.get('_return_http_data_only'), _return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True), _preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'), _request_timeout=params.get('_request_timeout'),
@ -132,22 +124,18 @@ class FakeApi(object):
""" """
Test serialization of object with outer number type Test serialization of object with outer number type
This method makes a synchronous HTTP request by default. To make an This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function asynchronous HTTP request, please pass async=True
to be invoked when receiving the response. >>> thread = api.fake_outer_composite_serialize(async=True)
>>> def callback_function(response): >>> result = thread.get()
>>> pprint(response)
>>>
>>> thread = api.fake_outer_composite_serialize(callback=callback_function)
:param callback function: The callback function :param async bool
for asynchronous request. (optional)
:param OuterComposite body: Input composite as post body :param OuterComposite body: Input composite as post body
:return: OuterComposite :return: OuterComposite
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
kwargs['_return_http_data_only'] = True kwargs['_return_http_data_only'] = True
if kwargs.get('callback'): if kwargs.get('async'):
return self.fake_outer_composite_serialize_with_http_info(**kwargs) return self.fake_outer_composite_serialize_with_http_info(**kwargs)
else: else:
(data) = self.fake_outer_composite_serialize_with_http_info(**kwargs) (data) = self.fake_outer_composite_serialize_with_http_info(**kwargs)
@ -157,15 +145,11 @@ class FakeApi(object):
""" """
Test serialization of object with outer number type Test serialization of object with outer number type
This method makes a synchronous HTTP request by default. To make an This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function asynchronous HTTP request, please pass async=True
to be invoked when receiving the response. >>> thread = api.fake_outer_composite_serialize_with_http_info(async=True)
>>> def callback_function(response): >>> result = thread.get()
>>> pprint(response)
>>>
>>> thread = api.fake_outer_composite_serialize_with_http_info(callback=callback_function)
:param callback function: The callback function :param async bool
for asynchronous request. (optional)
:param OuterComposite body: Input composite as post body :param OuterComposite body: Input composite as post body
:return: OuterComposite :return: OuterComposite
If the method is called asynchronously, If the method is called asynchronously,
@ -173,7 +157,7 @@ class FakeApi(object):
""" """
all_params = ['body'] all_params = ['body']
all_params.append('callback') all_params.append('async')
all_params.append('_return_http_data_only') all_params.append('_return_http_data_only')
all_params.append('_preload_content') all_params.append('_preload_content')
all_params.append('_request_timeout') all_params.append('_request_timeout')
@ -215,7 +199,7 @@ class FakeApi(object):
files=local_var_files, files=local_var_files,
response_type='OuterComposite', response_type='OuterComposite',
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback'), async=params.get('async'),
_return_http_data_only=params.get('_return_http_data_only'), _return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True), _preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'), _request_timeout=params.get('_request_timeout'),
@ -225,22 +209,18 @@ class FakeApi(object):
""" """
Test serialization of outer number types Test serialization of outer number types
This method makes a synchronous HTTP request by default. To make an This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function asynchronous HTTP request, please pass async=True
to be invoked when receiving the response. >>> thread = api.fake_outer_number_serialize(async=True)
>>> def callback_function(response): >>> result = thread.get()
>>> pprint(response)
>>>
>>> thread = api.fake_outer_number_serialize(callback=callback_function)
:param callback function: The callback function :param async bool
for asynchronous request. (optional)
:param OuterNumber body: Input number as post body :param OuterNumber body: Input number as post body
:return: OuterNumber :return: OuterNumber
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
kwargs['_return_http_data_only'] = True kwargs['_return_http_data_only'] = True
if kwargs.get('callback'): if kwargs.get('async'):
return self.fake_outer_number_serialize_with_http_info(**kwargs) return self.fake_outer_number_serialize_with_http_info(**kwargs)
else: else:
(data) = self.fake_outer_number_serialize_with_http_info(**kwargs) (data) = self.fake_outer_number_serialize_with_http_info(**kwargs)
@ -250,15 +230,11 @@ class FakeApi(object):
""" """
Test serialization of outer number types Test serialization of outer number types
This method makes a synchronous HTTP request by default. To make an This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function asynchronous HTTP request, please pass async=True
to be invoked when receiving the response. >>> thread = api.fake_outer_number_serialize_with_http_info(async=True)
>>> def callback_function(response): >>> result = thread.get()
>>> pprint(response)
>>>
>>> thread = api.fake_outer_number_serialize_with_http_info(callback=callback_function)
:param callback function: The callback function :param async bool
for asynchronous request. (optional)
:param OuterNumber body: Input number as post body :param OuterNumber body: Input number as post body
:return: OuterNumber :return: OuterNumber
If the method is called asynchronously, If the method is called asynchronously,
@ -266,7 +242,7 @@ class FakeApi(object):
""" """
all_params = ['body'] all_params = ['body']
all_params.append('callback') all_params.append('async')
all_params.append('_return_http_data_only') all_params.append('_return_http_data_only')
all_params.append('_preload_content') all_params.append('_preload_content')
all_params.append('_request_timeout') all_params.append('_request_timeout')
@ -308,7 +284,7 @@ class FakeApi(object):
files=local_var_files, files=local_var_files,
response_type='OuterNumber', response_type='OuterNumber',
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback'), async=params.get('async'),
_return_http_data_only=params.get('_return_http_data_only'), _return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True), _preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'), _request_timeout=params.get('_request_timeout'),
@ -318,22 +294,18 @@ class FakeApi(object):
""" """
Test serialization of outer string types Test serialization of outer string types
This method makes a synchronous HTTP request by default. To make an This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function asynchronous HTTP request, please pass async=True
to be invoked when receiving the response. >>> thread = api.fake_outer_string_serialize(async=True)
>>> def callback_function(response): >>> result = thread.get()
>>> pprint(response)
>>>
>>> thread = api.fake_outer_string_serialize(callback=callback_function)
:param callback function: The callback function :param async bool
for asynchronous request. (optional)
:param OuterString body: Input string as post body :param OuterString body: Input string as post body
:return: OuterString :return: OuterString
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
kwargs['_return_http_data_only'] = True kwargs['_return_http_data_only'] = True
if kwargs.get('callback'): if kwargs.get('async'):
return self.fake_outer_string_serialize_with_http_info(**kwargs) return self.fake_outer_string_serialize_with_http_info(**kwargs)
else: else:
(data) = self.fake_outer_string_serialize_with_http_info(**kwargs) (data) = self.fake_outer_string_serialize_with_http_info(**kwargs)
@ -343,15 +315,11 @@ class FakeApi(object):
""" """
Test serialization of outer string types Test serialization of outer string types
This method makes a synchronous HTTP request by default. To make an This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function asynchronous HTTP request, please pass async=True
to be invoked when receiving the response. >>> thread = api.fake_outer_string_serialize_with_http_info(async=True)
>>> def callback_function(response): >>> result = thread.get()
>>> pprint(response)
>>>
>>> thread = api.fake_outer_string_serialize_with_http_info(callback=callback_function)
:param callback function: The callback function :param async bool
for asynchronous request. (optional)
:param OuterString body: Input string as post body :param OuterString body: Input string as post body
:return: OuterString :return: OuterString
If the method is called asynchronously, If the method is called asynchronously,
@ -359,7 +327,7 @@ class FakeApi(object):
""" """
all_params = ['body'] all_params = ['body']
all_params.append('callback') all_params.append('async')
all_params.append('_return_http_data_only') all_params.append('_return_http_data_only')
all_params.append('_preload_content') all_params.append('_preload_content')
all_params.append('_request_timeout') all_params.append('_request_timeout')
@ -401,7 +369,7 @@ class FakeApi(object):
files=local_var_files, files=local_var_files,
response_type='OuterString', response_type='OuterString',
auth_settings=auth_settings, auth_settings=auth_settings,
callback=params.get('callback'), async=params.get('async'),
_return_http_data_only=params.get('_return_http_data_only'), _return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True), _preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'), _request_timeout=params.get('_request_timeout'),
@ -815,3 +783,104 @@ class FakeApi(object):
_preload_content=params.get('_preload_content', True), _preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'), _request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats) collection_formats=collection_formats)
def test_json_form_data(self, param, param2, **kwargs):
"""
test json serialization of form data
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.test_json_form_data(param, param2, async=True)
>>> result = thread.get()
:param async bool
:param str param: field1 (required)
:param str param2: field2 (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return self.test_json_form_data_with_http_info(param, param2, **kwargs)
else:
(data) = self.test_json_form_data_with_http_info(param, param2, **kwargs)
return data
def test_json_form_data_with_http_info(self, param, param2, **kwargs):
"""
test json serialization of form data
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.test_json_form_data_with_http_info(param, param2, async=True)
>>> result = thread.get()
:param async bool
:param str param: field1 (required)
:param str param2: field2 (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['param', 'param2']
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method test_json_form_data" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'param' is set
if ('param' not in params) or (params['param'] is None):
raise ValueError("Missing the required parameter `param` when calling `test_json_form_data`")
# verify the required parameter 'param2' is set
if ('param2' not in params) or (params['param2'] is None):
raise ValueError("Missing the required parameter `param2` when calling `test_json_form_data`")
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
if 'param' in params:
form_params.append(('param', params['param']))
if 'param2' in params:
form_params.append(('param2', params['param2']))
body_params = None
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type(['application/json'])
# Authentication setting
auth_settings = []
return self.api_client.call_api('/fake/jsonFormData', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
async=params.get('async'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)

View File

@ -95,7 +95,7 @@ class FakeClassnameTags123Api(object):
path_params = {} path_params = {}
query_params = {} query_params = []
header_params = {} header_params = {}

View File

@ -295,6 +295,8 @@ class FormatTest(object):
""" """
if byte is None: if byte is None:
raise ValueError("Invalid value for `byte`, must not be `None`") raise ValueError("Invalid value for `byte`, must not be `None`")
if byte is not None and not re.search('^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', byte):
raise ValueError("Invalid value for `byte`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`")
self._byte = byte self._byte = byte

View File

@ -0,0 +1,44 @@
# coding: utf-8
"""
Swagger Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
OpenAPI spec version: 1.0.0
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.apis.fake_classname_tags_123_api import FakeClassnameTags123Api
class TestFakeClassnameTags123Api(unittest.TestCase):
""" FakeClassnameTags123Api unit test stubs """
def setUp(self):
self.api = petstore_api.apis.fake_classname_tags_123_api.FakeClassnameTags123Api()
def tearDown(self):
pass
def test_test_classname(self):
"""
Test case for test_classname
To test class name in snake case
"""
pass
if __name__ == '__main__':
unittest.main()