diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java index 7cb4dc703db..1bc95cfdd67 100755 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java @@ -20,6 +20,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig protected String packageVersion; protected String apiDocPath = "docs/"; protected String modelDocPath = "docs/"; + + private String testFolder; public PythonClientCodegen() { super(); @@ -27,12 +29,19 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig modelPackage = "models"; apiPackage = "api"; outputFolder = "generated-code" + File.separatorChar + "python"; + modelTemplateFiles.put("model.mustache", ".py"); apiTemplateFiles.put("api.mustache", ".py"); + + modelTestTemplateFiles.put("model_test.mustache", ".py"); + apiTestTemplateFiles.put("api_test.mustache", ".py"); + embeddedTemplateDir = templateDir = "python"; modelDocTemplateFiles.put("model_doc.mustache", ".md"); apiDocTemplateFiles.put("api_doc.mustache", ".md"); + + testFolder = "test"; languageSpecificPrimitives.clear(); languageSpecificPrimitives.add("int"); @@ -126,6 +135,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig supportingFiles.add(new SupportingFile("__init__package.mustache", swaggerFolder, "__init__.py")); supportingFiles.add(new SupportingFile("__init__model.mustache", modelPackage, "__init__.py")); supportingFiles.add(new SupportingFile("__init__api.mustache", apiPackage, "__init__.py")); + supportingFiles.add(new SupportingFile("__init__test.mustache", testFolder, "__init__.py")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); } @@ -184,6 +194,16 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig public String modelFileFolder() { return outputFolder + File.separatorChar + modelPackage().replace('.', File.separatorChar); } + + @Override + public String apiTestFileFolder() { + return outputFolder + File.separatorChar + testFolder; + } + + @Override + public String modelTestFileFolder() { + return outputFolder + File.separatorChar + testFolder; + } @Override public String getTypeDeclaration(Property p) { @@ -310,6 +330,11 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig // PhoneNumber => phone_number return underscore(dropDots(name)); } + + @Override + public String toModelTestFilename(String name) { + return "test_" + toModelFilename(name); + }; @Override public String toApiFilename(String name) { @@ -319,6 +344,11 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig // e.g. PhoneNumberApi.rb => phone_number_api.rb return underscore(name) + "_api"; } + + @Override + public String toApiTestFilename(String name) { + return "test_" + toApiFilename(name); + } @Override public String toApiName(String name) { diff --git a/modules/swagger-codegen/src/main/resources/python/__init__test.mustache b/modules/swagger-codegen/src/main/resources/python/__init__test.mustache new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modules/swagger-codegen/src/main/resources/python/api_test.mustache b/modules/swagger-codegen/src/main/resources/python/api_test.mustache new file mode 100644 index 00000000000..5f0b0ab6ecb --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/python/api_test.mustache @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.apis.{{classVarName}} import {{classname}} + + +class {{#operations}}Test{{classname}}(unittest.TestCase): + """ {{classname}} unit test stubs """ + + def setUp(self): + self.api = swagger_client.apis.{{classVarName}}.{{classname}}() + + def tearDown(self): + pass + + {{#operation}} + def test_{{operationId}}(self): + """ + Test case for {{{operationId}}} + + {{{summary}}} + """ + pass + + {{/operation}} +{{/operations}} + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/python/model_test.mustache b/modules/swagger-codegen/src/main/resources/python/model_test.mustache new file mode 100644 index 00000000000..c00a10a9b51 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/python/model_test.mustache @@ -0,0 +1,53 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +{{#models}} +{{#model}} +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.{{classFilename}} import {{classname}} + + +class Test{{classname}}(unittest.TestCase): + """ {{classname}} unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def test{{classname}}(self): + """ + Test {{classname}} + """ + model = swagger_client.models.{{classFilename}}.{{classname}}() + +{{/model}} +{{/models}} + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 851c5458cb1..6640785fae9 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https:// - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-27T17:36:32.266+08:00 +- Build date: 2016-04-27T22:50:21.115+01:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. diff --git a/samples/client/petstore/python/docs/FakeApi.md b/samples/client/petstore/python/docs/FakeApi.md new file mode 100644 index 00000000000..66d9a04434a --- /dev/null +++ b/samples/client/petstore/python/docs/FakeApi.md @@ -0,0 +1,77 @@ +# swagger_client.FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters + + +# **test_endpoint_parameters** +> test_endpoint_parameters(number, double, string, byte, integer=integer, int32=int32, int64=int64, float=float, binary=binary, date=date, date_time=date_time, password=password) + +Fake endpoint for testing various parameters + +Fake endpoint for testing various parameters + +### Example +```python +import time +import swagger_client +from swagger_client.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = swagger_client.FakeApi() +number = 3.4 # float | None +double = 1.2 # float | None +string = 'string_example' # str | None +byte = 'B' # str | None +integer = 56 # int | None (optional) +int32 = 56 # int | None (optional) +int64 = 789 # int | None (optional) +float = 3.4 # float | None (optional) +binary = 'B' # str | None (optional) +date = '2013-10-20' # date | None (optional) +date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional) +password = 'password_example' # str | None (optional) + +try: + # Fake endpoint for testing various parameters + api_instance.test_endpoint_parameters(number, double, string, byte, integer=integer, int32=int32, int64=int64, float=float, binary=binary, date=date, date_time=date_time, password=password) +except ApiException as e: + print "Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **float**| None | + **double** | **float**| None | + **string** | **str**| None | + **byte** | **str**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **float**| None | [optional] + **binary** | **str**| None | [optional] + **date** | **date**| None | [optional] + **date_time** | **datetime**| None | [optional] + **password** | **str**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[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) + diff --git a/samples/client/petstore/python/swagger_client.egg-info/top_level.txt b/samples/client/petstore/python/swagger_client.egg-info/top_level.txt index 9a02a75c058..01f6691e7ca 100644 --- a/samples/client/petstore/python/swagger_client.egg-info/top_level.txt +++ b/samples/client/petstore/python/swagger_client.egg-info/top_level.txt @@ -1,2 +1,3 @@ swagger_client +test tests diff --git a/samples/client/petstore/python/swagger_client/apis/fake_api.py b/samples/client/petstore/python/swagger_client/apis/fake_api.py new file mode 100644 index 00000000000..2b183794ef1 --- /dev/null +++ b/samples/client/petstore/python/swagger_client/apis/fake_api.py @@ -0,0 +1,165 @@ +# coding: utf-8 + +""" +FakeApi.py +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +""" + +from __future__ import absolute_import + +import sys +import os + +# python 2 and python 3 compatibility library +from six import iteritems + +from ..configuration import Configuration +from ..api_client import ApiClient + + +class FakeApi(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + Ref: https://github.com/swagger-api/swagger-codegen + """ + + def __init__(self, api_client=None): + config = Configuration() + if api_client: + self.api_client = api_client + else: + if not config.api_client: + config.api_client = ApiClient() + self.api_client = config.api_client + + def test_endpoint_parameters(self, number, double, string, byte, **kwargs): + """ + Fake endpoint for testing various parameters + Fake endpoint for testing various parameters + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.test_endpoint_parameters(number, double, string, byte, callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param float number: None (required) + :param float double: None (required) + :param str string: None (required) + :param str byte: None (required) + :param int integer: None + :param int int32: None + :param int int64: None + :param float float: None + :param str binary: None + :param date date: None + :param datetime date_time: None + :param str password: None + :return: None + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['number', 'double', 'string', 'byte', 'integer', 'int32', 'int64', 'float', 'binary', 'date', 'date_time', 'password'] + all_params.append('callback') + + 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_endpoint_parameters" % key + ) + params[key] = val + del params['kwargs'] + + # verify the required parameter 'number' is set + if ('number' not in params) or (params['number'] is None): + raise ValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") + # verify the required parameter 'double' is set + if ('double' not in params) or (params['double'] is None): + raise ValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`") + # verify the required parameter 'string' is set + if ('string' not in params) or (params['string'] is None): + raise ValueError("Missing the required parameter `string` when calling `test_endpoint_parameters`") + # verify the required parameter 'byte' is set + if ('byte' not in params) or (params['byte'] is None): + raise ValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") + + resource_path = '/fake'.replace('{format}', 'json') + path_params = {} + + query_params = {} + + header_params = {} + + form_params = [] + local_var_files = {} + if 'integer' in params: + form_params.append(('integer', params['integer'])) + if 'int32' in params: + form_params.append(('int32', params['int32'])) + if 'int64' in params: + form_params.append(('int64', params['int64'])) + if 'number' in params: + form_params.append(('number', params['number'])) + if 'float' in params: + form_params.append(('float', params['float'])) + if 'double' in params: + form_params.append(('double', params['double'])) + if 'string' in params: + form_params.append(('string', params['string'])) + if 'byte' in params: + form_params.append(('byte', params['byte'])) + if 'binary' in params: + form_params.append(('binary', params['binary'])) + if 'date' in params: + form_params.append(('date', params['date'])) + if 'date_time' in params: + form_params.append(('dateTime', params['date_time'])) + if 'password' in params: + form_params.append(('password', params['password'])) + + body_params = None + + # HTTP header `Accept` + header_params['Accept'] = self.api_client.\ + select_header_accept(['application/xml', 'application/json']) + if not header_params['Accept']: + del header_params['Accept'] + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.\ + select_header_content_type([]) + + # Authentication setting + auth_settings = [] + + response = self.api_client.call_api(resource_path, 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type=None, + auth_settings=auth_settings, + callback=params.get('callback')) + return response diff --git a/samples/client/petstore/python/test/__init__.py b/samples/client/petstore/python/test/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/client/petstore/python/test/test_animal.py b/samples/client/petstore/python/test/test_animal.py new file mode 100644 index 00000000000..279ed1850dd --- /dev/null +++ b/samples/client/petstore/python/test/test_animal.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.animal import Animal + + +class TestAnimal(unittest.TestCase): + """ Animal unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testAnimal(self): + """ + Test Animal + """ + model = swagger_client.models.animal.Animal() + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_api_response.py b/samples/client/petstore/python/test/test_api_response.py new file mode 100644 index 00000000000..be73dbf373d --- /dev/null +++ b/samples/client/petstore/python/test/test_api_response.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.api_response import ApiResponse + + +class TestApiResponse(unittest.TestCase): + """ ApiResponse unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testApiResponse(self): + """ + Test ApiResponse + """ + model = swagger_client.models.api_response.ApiResponse() + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_cat.py b/samples/client/petstore/python/test/test_cat.py new file mode 100644 index 00000000000..728a824fa5b --- /dev/null +++ b/samples/client/petstore/python/test/test_cat.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.cat import Cat + + +class TestCat(unittest.TestCase): + """ Cat unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testCat(self): + """ + Test Cat + """ + model = swagger_client.models.cat.Cat() + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_category.py b/samples/client/petstore/python/test/test_category.py new file mode 100644 index 00000000000..793fbdf41b0 --- /dev/null +++ b/samples/client/petstore/python/test/test_category.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.category import Category + + +class TestCategory(unittest.TestCase): + """ Category unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testCategory(self): + """ + Test Category + """ + model = swagger_client.models.category.Category() + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_dog.py b/samples/client/petstore/python/test/test_dog.py new file mode 100644 index 00000000000..044dc5be51f --- /dev/null +++ b/samples/client/petstore/python/test/test_dog.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.dog import Dog + + +class TestDog(unittest.TestCase): + """ Dog unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testDog(self): + """ + Test Dog + """ + model = swagger_client.models.dog.Dog() + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_fake_api.py b/samples/client/petstore/python/test/test_fake_api.py new file mode 100644 index 00000000000..29b71bdf81a --- /dev/null +++ b/samples/client/petstore/python/test/test_fake_api.py @@ -0,0 +1,51 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.apis.fake_api import FakeApi + + +class TestFakeApi(unittest.TestCase): + """ FakeApi unit test stubs """ + + def setUp(self): + self.api = swagger_client.apis.fake_api.FakeApi() + + def tearDown(self): + pass + + def test_test_endpoint_parameters(self): + """ + Test case for test_endpoint_parameters + + Fake endpoint for testing various parameters + """ + pass + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_format_test.py b/samples/client/petstore/python/test/test_format_test.py new file mode 100644 index 00000000000..11101ad52da --- /dev/null +++ b/samples/client/petstore/python/test/test_format_test.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.format_test import FormatTest + + +class TestFormatTest(unittest.TestCase): + """ FormatTest unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testFormatTest(self): + """ + Test FormatTest + """ + model = swagger_client.models.format_test.FormatTest() + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_model_200_response.py b/samples/client/petstore/python/test/test_model_200_response.py new file mode 100644 index 00000000000..8328d2b9757 --- /dev/null +++ b/samples/client/petstore/python/test/test_model_200_response.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.model_200_response import Model200Response + + +class TestModel200Response(unittest.TestCase): + """ Model200Response unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testModel200Response(self): + """ + Test Model200Response + """ + model = swagger_client.models.model_200_response.Model200Response() + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_model_return.py b/samples/client/petstore/python/test/test_model_return.py new file mode 100644 index 00000000000..4ff3f38b2eb --- /dev/null +++ b/samples/client/petstore/python/test/test_model_return.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.model_return import ModelReturn + + +class TestModelReturn(unittest.TestCase): + """ ModelReturn unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testModelReturn(self): + """ + Test ModelReturn + """ + model = swagger_client.models.model_return.ModelReturn() + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_name.py b/samples/client/petstore/python/test/test_name.py new file mode 100644 index 00000000000..c3b27897eb1 --- /dev/null +++ b/samples/client/petstore/python/test/test_name.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.name import Name + + +class TestName(unittest.TestCase): + """ Name unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testName(self): + """ + Test Name + """ + model = swagger_client.models.name.Name() + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_order.py b/samples/client/petstore/python/test/test_order.py new file mode 100644 index 00000000000..23beefe346c --- /dev/null +++ b/samples/client/petstore/python/test/test_order.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.order import Order + + +class TestOrder(unittest.TestCase): + """ Order unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOrder(self): + """ + Test Order + """ + model = swagger_client.models.order.Order() + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_pet.py b/samples/client/petstore/python/test/test_pet.py new file mode 100644 index 00000000000..471b7b4f67c --- /dev/null +++ b/samples/client/petstore/python/test/test_pet.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.pet import Pet + + +class TestPet(unittest.TestCase): + """ Pet unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testPet(self): + """ + Test Pet + """ + model = swagger_client.models.pet.Pet() + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_pet_api.py b/samples/client/petstore/python/test/test_pet_api.py new file mode 100644 index 00000000000..81ee6c76e9c --- /dev/null +++ b/samples/client/petstore/python/test/test_pet_api.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.apis.pet_api import PetApi + + +class TestPetApi(unittest.TestCase): + """ PetApi unit test stubs """ + + def setUp(self): + self.api = swagger_client.apis.pet_api.PetApi() + + def tearDown(self): + pass + + def test_add_pet(self): + """ + Test case for add_pet + + Add a new pet to the store + """ + pass + + def test_delete_pet(self): + """ + Test case for delete_pet + + Deletes a pet + """ + pass + + def test_find_pets_by_status(self): + """ + Test case for find_pets_by_status + + Finds Pets by status + """ + pass + + def test_find_pets_by_tags(self): + """ + Test case for find_pets_by_tags + + Finds Pets by tags + """ + pass + + def test_get_pet_by_id(self): + """ + Test case for get_pet_by_id + + Find pet by ID + """ + pass + + def test_update_pet(self): + """ + Test case for update_pet + + Update an existing pet + """ + pass + + def test_update_pet_with_form(self): + """ + Test case for update_pet_with_form + + Updates a pet in the store with form data + """ + pass + + def test_upload_file(self): + """ + Test case for upload_file + + uploads an image + """ + pass + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_special_model_name.py b/samples/client/petstore/python/test/test_special_model_name.py new file mode 100644 index 00000000000..17c12655031 --- /dev/null +++ b/samples/client/petstore/python/test/test_special_model_name.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.special_model_name import SpecialModelName + + +class TestSpecialModelName(unittest.TestCase): + """ SpecialModelName unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testSpecialModelName(self): + """ + Test SpecialModelName + """ + model = swagger_client.models.special_model_name.SpecialModelName() + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_store_api.py b/samples/client/petstore/python/test/test_store_api.py new file mode 100644 index 00000000000..e8dc0a64b1c --- /dev/null +++ b/samples/client/petstore/python/test/test_store_api.py @@ -0,0 +1,75 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.apis.store_api import StoreApi + + +class TestStoreApi(unittest.TestCase): + """ StoreApi unit test stubs """ + + def setUp(self): + self.api = swagger_client.apis.store_api.StoreApi() + + def tearDown(self): + pass + + def test_delete_order(self): + """ + Test case for delete_order + + Delete purchase order by ID + """ + pass + + def test_get_inventory(self): + """ + Test case for get_inventory + + Returns pet inventories by status + """ + pass + + def test_get_order_by_id(self): + """ + Test case for get_order_by_id + + Find purchase order by ID + """ + pass + + def test_place_order(self): + """ + Test case for place_order + + Place an order for a pet + """ + pass + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_tag.py b/samples/client/petstore/python/test/test_tag.py new file mode 100644 index 00000000000..35b51e4d7d2 --- /dev/null +++ b/samples/client/petstore/python/test/test_tag.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.tag import Tag + + +class TestTag(unittest.TestCase): + """ Tag unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testTag(self): + """ + Test Tag + """ + model = swagger_client.models.tag.Tag() + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_user.py b/samples/client/petstore/python/test/test_user.py new file mode 100644 index 00000000000..1aad154cbf8 --- /dev/null +++ b/samples/client/petstore/python/test/test_user.py @@ -0,0 +1,49 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.models.user import User + + +class TestUser(unittest.TestCase): + """ User unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testUser(self): + """ + Test User + """ + model = swagger_client.models.user.User() + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/samples/client/petstore/python/test/test_user_api.py b/samples/client/petstore/python/test/test_user_api.py new file mode 100644 index 00000000000..0205fe7383a --- /dev/null +++ b/samples/client/petstore/python/test/test_user_api.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" +Copyright 2016 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + ref: https://github.com/swagger-api/swagger-codegen +""" + +from __future__ import absolute_import + +import os +import sys +import unittest + +import swagger_client +from swagger_client.rest import ApiException +from swagger_client.apis.user_api import UserApi + + +class TestUserApi(unittest.TestCase): + """ UserApi unit test stubs """ + + def setUp(self): + self.api = swagger_client.apis.user_api.UserApi() + + def tearDown(self): + pass + + def test_create_user(self): + """ + Test case for create_user + + Create user + """ + pass + + def test_create_users_with_array_input(self): + """ + Test case for create_users_with_array_input + + Creates list of users with given input array + """ + pass + + def test_create_users_with_list_input(self): + """ + Test case for create_users_with_list_input + + Creates list of users with given input array + """ + pass + + def test_delete_user(self): + """ + Test case for delete_user + + Delete user + """ + pass + + def test_get_user_by_name(self): + """ + Test case for get_user_by_name + + Get user by user name + """ + pass + + def test_login_user(self): + """ + Test case for login_user + + Logs user into the system + """ + pass + + def test_logout_user(self): + """ + Test case for logout_user + + Logs out current logged in user session + """ + pass + + def test_update_user(self): + """ + Test case for update_user + + Updated user + """ + pass + + +if __name__ == '__main__': + unittest.main() \ No newline at end of file