[Python] Fix bug of test files about packageName

This commit is contained in:
Takuro Wada 2016-06-07 00:37:49 +09:00
parent 6a73f29cef
commit 7916f5243d
77 changed files with 258 additions and 278 deletions

View File

@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/python -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l python -o samples/client/petstore/python"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/python -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l python -o samples/client/petstore/python -DpackageName=petstore_api"
java $JAVA_OPTS -jar $executable $ags

View File

@ -8,16 +8,16 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.apis.{{classVarName}} import {{classname}}
import {{packageName}}
from {{packageName}}.rest import ApiException
from {{packageName}}.apis.{{classVarName}} import {{classname}}
class {{#operations}}Test{{classname}}(unittest.TestCase):
""" {{classname}} unit test stubs """
def setUp(self):
self.api = swagger_client.apis.{{classVarName}}.{{classname}}()
self.api = {{packageName}}.apis.{{classVarName}}.{{classname}}()
def tearDown(self):
pass

View File

@ -10,9 +10,9 @@ import unittest
{{#models}}
{{#model}}
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.{{classFilename}} import {{classname}}
import {{packageName}}
from {{packageName}}.rest import ApiException
from {{packageName}}.models.{{classFilename}} import {{classname}}
class Test{{classname}}(unittest.TestCase):
@ -28,7 +28,7 @@ class Test{{classname}}(unittest.TestCase):
"""
Test {{classname}}
"""
model = swagger_client.models.{{classFilename}}.{{classname}}()
model = {{packageName}}.models.{{classFilename}}.{{classname}}()
{{/model}}
{{/models}}

View File

@ -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-06-07T08:27:42.099+09:00
- Build date: 2016-06-07T00:29:52.148+09:00
- Build package: class io.swagger.codegen.languages.PythonClientCodegen
## Requirements.

View File

@ -1,4 +1,4 @@
# swagger_client.FakeApi
# petstore_api.FakeApi
All URIs are relative to *http://petstore.swagger.io/v2*
@ -17,12 +17,12 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.FakeApi()
api_instance = petstore_api.FakeApi()
number = 3.4 # float | None
double = 1.2 # float | None
string = 'string_example' # str | None

View File

@ -1,4 +1,4 @@
# swagger_client.PetApi
# petstore_api.PetApi
All URIs are relative to *http://petstore.swagger.io/v2*
@ -24,16 +24,16 @@ Add a new pet to the store
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store
api_instance = petstore_api.PetApi()
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
try:
# Add a new pet to the store
@ -73,15 +73,15 @@ Deletes a pet
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
api_instance = petstore_api.PetApi()
pet_id = 789 # int | Pet id to delete
api_key = 'api_key_example' # str | (optional)
@ -124,15 +124,15 @@ Multiple status values can be provided with comma separated strings
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
api_instance = petstore_api.PetApi()
status = ['status_example'] # list[str] | Status values that need to be considered for filter
try:
@ -174,15 +174,15 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
api_instance = petstore_api.PetApi()
tags = ['tags_example'] # list[str] | Tags to filter by
try:
@ -224,17 +224,17 @@ Returns a single pet
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Configure API key authorization: api_key
swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY'
petstore_api.configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['api_key'] = 'Bearer'
# petstore_api.configuration.api_key_prefix['api_key'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.PetApi()
api_instance = petstore_api.PetApi()
pet_id = 789 # int | ID of pet to return
try:
@ -276,16 +276,16 @@ Update an existing pet
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store
api_instance = petstore_api.PetApi()
body = petstore_api.Pet() # Pet | Pet object that needs to be added to the store
try:
# Update an existing pet
@ -325,15 +325,15 @@ Updates a pet in the store with form data
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
api_instance = petstore_api.PetApi()
pet_id = 789 # int | ID of pet that needs to be updated
name = 'name_example' # str | Updated name of the pet (optional)
status = 'status_example' # str | Updated status of the pet (optional)
@ -378,15 +378,15 @@ uploads an image
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: petstore_auth
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
petstore_api.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = swagger_client.PetApi()
api_instance = petstore_api.PetApi()
pet_id = 789 # int | ID of pet to update
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
file = '/path/to/file.txt' # file | file to upload (optional)

View File

@ -1,4 +1,4 @@
# swagger_client.StoreApi
# petstore_api.StoreApi
All URIs are relative to *http://petstore.swagger.io/v2*
@ -20,12 +20,12 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.StoreApi()
api_instance = petstore_api.StoreApi()
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
try:
@ -66,17 +66,17 @@ Returns a map of status codes to quantities
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# Configure API key authorization: api_key
swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY'
petstore_api.configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# swagger_client.configuration.api_key_prefix['api_key'] = 'Bearer'
# petstore_api.configuration.api_key_prefix['api_key'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.StoreApi()
api_instance = petstore_api.StoreApi()
try:
# Returns pet inventories by status
@ -114,12 +114,12 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.StoreApi()
api_instance = petstore_api.StoreApi()
order_id = 789 # int | ID of pet that needs to be fetched
try:
@ -161,13 +161,13 @@ Place an order for a pet
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.StoreApi()
body = swagger_client.Order() # Order | order placed for purchasing the pet
api_instance = petstore_api.StoreApi()
body = petstore_api.Order() # Order | order placed for purchasing the pet
try:
# Place an order for a pet

View File

@ -1,4 +1,4 @@
# swagger_client.UserApi
# petstore_api.UserApi
All URIs are relative to *http://petstore.swagger.io/v2*
@ -24,13 +24,13 @@ This can only be done by the logged in user.
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.UserApi()
body = swagger_client.User() # User | Created user object
api_instance = petstore_api.UserApi()
body = petstore_api.User() # User | Created user object
try:
# Create user
@ -70,13 +70,13 @@ Creates list of users with given input array
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.UserApi()
body = [swagger_client.User()] # list[User] | List of user object
api_instance = petstore_api.UserApi()
body = [petstore_api.User()] # list[User] | List of user object
try:
# Creates list of users with given input array
@ -116,13 +116,13 @@ Creates list of users with given input array
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.UserApi()
body = [swagger_client.User()] # list[User] | List of user object
api_instance = petstore_api.UserApi()
body = [petstore_api.User()] # list[User] | List of user object
try:
# Creates list of users with given input array
@ -162,12 +162,12 @@ This can only be done by the logged in user.
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.UserApi()
api_instance = petstore_api.UserApi()
username = 'username_example' # str | The name that needs to be deleted
try:
@ -208,12 +208,12 @@ Get user by user name
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.UserApi()
api_instance = petstore_api.UserApi()
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
try:
@ -255,12 +255,12 @@ Logs user into the system
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.UserApi()
api_instance = petstore_api.UserApi()
username = 'username_example' # str | The user name for login
password = 'password_example' # str | The password for login in clear text
@ -304,12 +304,12 @@ Logs out current logged in user session
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.UserApi()
api_instance = petstore_api.UserApi()
try:
# Logs out current logged in user session
@ -346,14 +346,14 @@ This can only be done by the logged in user.
### Example
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.UserApi()
api_instance = petstore_api.UserApi()
username = 'username_example' # str | name that need to be deleted
body = swagger_client.User() # User | Updated user object
body = petstore_api.User() # User | Updated user object
try:
# Updated user

View File

@ -82,7 +82,7 @@ class Configuration(object):
# Logging Settings
self.logger = {}
self.logger["package_logger"] = logging.getLogger("swagger_client")
self.logger["package_logger"] = logging.getLogger("petstore_api")
self.logger["urllib3_logger"] = logging.getLogger("urllib3")
# Log format
self.logger_format = '%(asctime)s %(levelname)s %(message)s'

View File

@ -4,7 +4,7 @@ verbosity=2
randomize=true
exe=true
with-coverage=true
cover-package=swagger_client
cover-package=petstore_api
cover-erase=true
[flake8]

View File

@ -25,7 +25,7 @@
import sys
from setuptools import setup, find_packages
NAME = "swagger_client"
NAME = "petstore_api"
VERSION = "1.0.0"
# To install the library, run the following

View File

@ -1,12 +0,0 @@
Metadata-Version: 1.0
Name: swagger-client
Version: 1.0.0
Summary: Swagger Petstore
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: apiteam@swagger.io
License: UNKNOWN
Description: This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \&quot; \
Keywords: Swagger,Swagger Petstore
Platform: UNKNOWN

View File

@ -1,4 +0,0 @@
urllib3 >= 1.15
six >= 1.10
certifi
python-dateutil

View File

@ -1,3 +0,0 @@
swagger_client
test
tests

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.additional_properties_class import AdditionalPropertiesClass
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.additional_properties_class import AdditionalPropertiesClass
class TestAdditionalPropertiesClass(unittest.TestCase):
@ -46,7 +46,7 @@ class TestAdditionalPropertiesClass(unittest.TestCase):
"""
Test AdditionalPropertiesClass
"""
model = swagger_client.models.additional_properties_class.AdditionalPropertiesClass()
model = petstore_api.models.additional_properties_class.AdditionalPropertiesClass()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.animal import Animal
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.animal import Animal
class TestAnimal(unittest.TestCase):
@ -46,7 +46,7 @@ class TestAnimal(unittest.TestCase):
"""
Test Animal
"""
model = swagger_client.models.animal.Animal()
model = petstore_api.models.animal.Animal()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.animal_farm import AnimalFarm
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.animal_farm import AnimalFarm
class TestAnimalFarm(unittest.TestCase):
@ -46,7 +46,7 @@ class TestAnimalFarm(unittest.TestCase):
"""
Test AnimalFarm
"""
model = swagger_client.models.animal_farm.AnimalFarm()
model = petstore_api.models.animal_farm.AnimalFarm()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.api_response import ApiResponse
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.api_response import ApiResponse
class TestApiResponse(unittest.TestCase):
@ -46,7 +46,7 @@ class TestApiResponse(unittest.TestCase):
"""
Test ApiResponse
"""
model = swagger_client.models.api_response.ApiResponse()
model = petstore_api.models.api_response.ApiResponse()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.array_test import ArrayTest
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.array_test import ArrayTest
class TestArrayTest(unittest.TestCase):
@ -46,7 +46,7 @@ class TestArrayTest(unittest.TestCase):
"""
Test ArrayTest
"""
model = swagger_client.models.array_test.ArrayTest()
model = petstore_api.models.array_test.ArrayTest()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.cat import Cat
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.cat import Cat
class TestCat(unittest.TestCase):
@ -46,7 +46,7 @@ class TestCat(unittest.TestCase):
"""
Test Cat
"""
model = swagger_client.models.cat.Cat()
model = petstore_api.models.cat.Cat()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.category import Category
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.category import Category
class TestCategory(unittest.TestCase):
@ -46,7 +46,7 @@ class TestCategory(unittest.TestCase):
"""
Test Category
"""
model = swagger_client.models.category.Category()
model = petstore_api.models.category.Category()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.dog import Dog
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.dog import Dog
class TestDog(unittest.TestCase):
@ -46,7 +46,7 @@ class TestDog(unittest.TestCase):
"""
Test Dog
"""
model = swagger_client.models.dog.Dog()
model = petstore_api.models.dog.Dog()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.enum_class import EnumClass
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.enum_class import EnumClass
class TestEnumClass(unittest.TestCase):
@ -46,7 +46,7 @@ class TestEnumClass(unittest.TestCase):
"""
Test EnumClass
"""
model = swagger_client.models.enum_class.EnumClass()
model = petstore_api.models.enum_class.EnumClass()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.enum_test import EnumTest
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.enum_test import EnumTest
class TestEnumTest(unittest.TestCase):
@ -46,7 +46,7 @@ class TestEnumTest(unittest.TestCase):
"""
Test EnumTest
"""
model = swagger_client.models.enum_test.EnumTest()
model = petstore_api.models.enum_test.EnumTest()
if __name__ == '__main__':

View File

@ -28,16 +28,16 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.apis.fake_api import FakeApi
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.apis.fake_api import FakeApi
class TestFakeApi(unittest.TestCase):
""" FakeApi unit test stubs """
def setUp(self):
self.api = swagger_client.apis.fake_api.FakeApi()
self.api = petstore_api.apis.fake_api.FakeApi()
def tearDown(self):
pass

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.format_test import FormatTest
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.format_test import FormatTest
class TestFormatTest(unittest.TestCase):
@ -46,7 +46,7 @@ class TestFormatTest(unittest.TestCase):
"""
Test FormatTest
"""
model = swagger_client.models.format_test.FormatTest()
model = petstore_api.models.format_test.FormatTest()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass
class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase):
@ -46,7 +46,7 @@ class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase):
"""
Test MixedPropertiesAndAdditionalPropertiesClass
"""
model = swagger_client.models.mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass()
model = petstore_api.models.mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.model_200_response import Model200Response
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.model_200_response import Model200Response
class TestModel200Response(unittest.TestCase):
@ -46,7 +46,7 @@ class TestModel200Response(unittest.TestCase):
"""
Test Model200Response
"""
model = swagger_client.models.model_200_response.Model200Response()
model = petstore_api.models.model_200_response.Model200Response()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.model_return import ModelReturn
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.model_return import ModelReturn
class TestModelReturn(unittest.TestCase):
@ -46,7 +46,7 @@ class TestModelReturn(unittest.TestCase):
"""
Test ModelReturn
"""
model = swagger_client.models.model_return.ModelReturn()
model = petstore_api.models.model_return.ModelReturn()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.name import Name
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.name import Name
class TestName(unittest.TestCase):
@ -46,7 +46,7 @@ class TestName(unittest.TestCase):
"""
Test Name
"""
model = swagger_client.models.name.Name()
model = petstore_api.models.name.Name()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.order import Order
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.order import Order
class TestOrder(unittest.TestCase):
@ -46,7 +46,7 @@ class TestOrder(unittest.TestCase):
"""
Test Order
"""
model = swagger_client.models.order.Order()
model = petstore_api.models.order.Order()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.pet import Pet
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.pet import Pet
class TestPet(unittest.TestCase):
@ -46,7 +46,7 @@ class TestPet(unittest.TestCase):
"""
Test Pet
"""
model = swagger_client.models.pet.Pet()
model = petstore_api.models.pet.Pet()
if __name__ == '__main__':

View File

@ -28,16 +28,16 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.apis.pet_api import PetApi
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.apis.pet_api import PetApi
class TestPetApi(unittest.TestCase):
""" PetApi unit test stubs """
def setUp(self):
self.api = swagger_client.apis.pet_api.PetApi()
self.api = petstore_api.apis.pet_api.PetApi()
def tearDown(self):
pass

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.read_only_first import ReadOnlyFirst
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.read_only_first import ReadOnlyFirst
class TestReadOnlyFirst(unittest.TestCase):
@ -46,7 +46,7 @@ class TestReadOnlyFirst(unittest.TestCase):
"""
Test ReadOnlyFirst
"""
model = swagger_client.models.read_only_first.ReadOnlyFirst()
model = petstore_api.models.read_only_first.ReadOnlyFirst()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.special_model_name import SpecialModelName
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.special_model_name import SpecialModelName
class TestSpecialModelName(unittest.TestCase):
@ -46,7 +46,7 @@ class TestSpecialModelName(unittest.TestCase):
"""
Test SpecialModelName
"""
model = swagger_client.models.special_model_name.SpecialModelName()
model = petstore_api.models.special_model_name.SpecialModelName()
if __name__ == '__main__':

View File

@ -28,16 +28,16 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.apis.store_api import StoreApi
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.apis.store_api import StoreApi
class TestStoreApi(unittest.TestCase):
""" StoreApi unit test stubs """
def setUp(self):
self.api = swagger_client.apis.store_api.StoreApi()
self.api = petstore_api.apis.store_api.StoreApi()
def tearDown(self):
pass

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.tag import Tag
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.tag import Tag
class TestTag(unittest.TestCase):
@ -46,7 +46,7 @@ class TestTag(unittest.TestCase):
"""
Test Tag
"""
model = swagger_client.models.tag.Tag()
model = petstore_api.models.tag.Tag()
if __name__ == '__main__':

View File

@ -28,9 +28,9 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.models.user import User
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.models.user import User
class TestUser(unittest.TestCase):
@ -46,7 +46,7 @@ class TestUser(unittest.TestCase):
"""
Test User
"""
model = swagger_client.models.user.User()
model = petstore_api.models.user.User()
if __name__ == '__main__':

View File

@ -28,16 +28,16 @@ import os
import sys
import unittest
import swagger_client
from swagger_client.rest import ApiException
from swagger_client.apis.user_api import UserApi
import petstore_api
from petstore_api.rest import ApiException
from petstore_api.apis.user_api import UserApi
class TestUserApi(unittest.TestCase):
""" UserApi unit test stubs """
def setUp(self):
self.api = swagger_client.apis.user_api.UserApi()
self.api = petstore_api.apis.user_api.UserApi()
def tearDown(self):
pass

View File

@ -12,8 +12,8 @@ import time
import unittest
from dateutil.parser import parse
import swagger_client
import swagger_client.configuration
import petstore_api
import petstore_api.configuration
HOST = 'http://petstore.swagger.io/v2'
@ -21,20 +21,20 @@ HOST = 'http://petstore.swagger.io/v2'
class ApiClientTests(unittest.TestCase):
def setUp(self):
self.api_client = swagger_client.ApiClient(HOST)
self.api_client = petstore_api.ApiClient(HOST)
def test_configuration(self):
swagger_client.configuration.api_key['api_key'] = '123456'
swagger_client.configuration.api_key_prefix['api_key'] = 'PREFIX'
swagger_client.configuration.username = 'test_username'
swagger_client.configuration.password = 'test_password'
petstore_api.configuration.api_key['api_key'] = '123456'
petstore_api.configuration.api_key_prefix['api_key'] = 'PREFIX'
petstore_api.configuration.username = 'test_username'
petstore_api.configuration.password = 'test_password'
header_params = {'test1': 'value1'}
query_params = {'test2': 'value2'}
auth_settings = ['api_key', 'unknown']
# test prefix
self.assertEqual('PREFIX', swagger_client.configuration.api_key_prefix['api_key'])
self.assertEqual('PREFIX', petstore_api.configuration.api_key_prefix['api_key'])
# update parameters based on auth setting
self.api_client.update_params_for_auth(header_params, query_params, auth_settings)
@ -45,8 +45,8 @@ class ApiClientTests(unittest.TestCase):
self.assertEqual(query_params['test2'], 'value2')
# test basic auth
self.assertEqual('test_username', swagger_client.configuration.username)
self.assertEqual('test_password', swagger_client.configuration.password)
self.assertEqual('test_username', petstore_api.configuration.username)
self.assertEqual('test_password', petstore_api.configuration.password)
def test_select_header_accept(self):
accepts = ['APPLICATION/JSON', 'APPLICATION/XML']
@ -139,17 +139,17 @@ class ApiClientTests(unittest.TestCase):
"status": "available",
"photoUrls": ["http://foo.bar.com/3",
"http://foo.bar.com/4"]}
pet = swagger_client.Pet()
pet = petstore_api.Pet()
pet.id = pet_dict["id"]
pet.name = pet_dict["name"]
cate = swagger_client.Category()
cate = petstore_api.Category()
cate.id = pet_dict["category"]["id"]
cate.name = pet_dict["category"]["name"]
pet.category = cate
tag1 = swagger_client.Tag()
tag1 = petstore_api.Tag()
tag1.id = pet_dict["tags"][0]["id"]
tag1.name = pet_dict["tags"][0]["name"]
tag2 = swagger_client.Tag()
tag2 = petstore_api.Tag()
tag2.id = pet_dict["tags"][1]["id"]
tag2.name = pet_dict["tags"][1]["name"]
pet.tags = [tag1, tag2]

View File

@ -3,7 +3,7 @@
"""
Run the tests.
$ pip install nose (optional)
$ cd swagger_client-python
$ cd petstore_api-python
$ nosetests -v
"""
@ -12,25 +12,25 @@ import sys
import time
import unittest
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
class ApiExceptionTests(unittest.TestCase):
def setUp(self):
self.api_client = swagger_client.ApiClient()
self.pet_api = swagger_client.PetApi(self.api_client)
self.api_client = petstore_api.ApiClient()
self.pet_api = petstore_api.PetApi(self.api_client)
self.setUpModels()
def setUpModels(self):
self.category = swagger_client.Category()
self.category = petstore_api.Category()
self.category.id = int(time.time())
self.category.name = "dog"
self.tag = swagger_client.Tag()
self.tag = petstore_api.Tag()
self.tag.id = int(time.time())
self.tag.name = "blank"
self.pet = swagger_client.Pet()
self.pet = petstore_api.Pet()
self.pet.id = int(time.time())
self.pet.name = "hello kity"
self.pet.photo_urls = ["http://foo.bar.com/1", "http://foo.bar.com/2"]

View File

@ -11,13 +11,13 @@ import time
import unittest
import datetime
import swagger_client
import petstore_api
class DeserializationTests(unittest.TestCase):
def setUp(self):
self.api_client = swagger_client.ApiClient()
self.api_client = petstore_api.ApiClient()
self.deserialize = self.api_client._ApiClient__deserialize
def test_deserialize_dict_str_pet(self):
@ -45,7 +45,7 @@ class DeserializationTests(unittest.TestCase):
deserialized = self.deserialize(data, 'dict(str, Pet)')
self.assertTrue(isinstance(deserialized, dict))
self.assertTrue(isinstance(deserialized['pet'], swagger_client.Pet))
self.assertTrue(isinstance(deserialized['pet'], petstore_api.Pet))
def test_deserialize_dict_str_int(self):
""" deserialize dict(str, int) """
@ -96,10 +96,10 @@ class DeserializationTests(unittest.TestCase):
"status": "available"
}
deserialized = self.deserialize(data, "Pet")
self.assertTrue(isinstance(deserialized, swagger_client.Pet))
self.assertTrue(isinstance(deserialized, petstore_api.Pet))
self.assertEqual(deserialized.id, 0)
self.assertEqual(deserialized.name, "doggie")
self.assertTrue(isinstance(deserialized.category, swagger_client.Category))
self.assertTrue(isinstance(deserialized.category, petstore_api.Category))
self.assertEqual(deserialized.category.name, "string")
self.assertTrue(isinstance(deserialized.tags, list))
self.assertEqual(deserialized.tags[0].name, "string")
@ -145,7 +145,7 @@ class DeserializationTests(unittest.TestCase):
}]
deserialized = self.deserialize(data, "list[Pet]")
self.assertTrue(isinstance(deserialized, list))
self.assertTrue(isinstance(deserialized[0], swagger_client.Pet))
self.assertTrue(isinstance(deserialized[0], petstore_api.Pet))
self.assertEqual(deserialized[0].id, 0)
self.assertEqual(deserialized[1].id, 1)
self.assertEqual(deserialized[0].name, "doggie0")

View File

@ -3,7 +3,7 @@
"""
Run the tests.
$ pip install nose (optional)
$ cd swagger_client-python
$ cd petstore_api-python
$ nosetests -v
"""
@ -11,13 +11,13 @@ import os
import time
import unittest
import swagger_client
import petstore_api
class OrderModelTests(unittest.TestCase):
def test_status(self):
order = swagger_client.Order()
order = petstore_api.Order()
order.status = "placed"
self.assertEqual("placed", order.status)

View File

@ -3,7 +3,7 @@
"""
Run the tests.
$ pip install nose (optional)
$ cd swagger_client-python
$ cd petstore_api-python
$ nosetests -v
"""
@ -11,8 +11,8 @@ import os
import time
import unittest
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
HOST = 'http://petstore.swagger.io/v2'
@ -20,8 +20,8 @@ HOST = 'http://petstore.swagger.io/v2'
class PetApiTests(unittest.TestCase):
def setUp(self):
self.api_client = swagger_client.ApiClient(HOST)
self.pet_api = swagger_client.PetApi(self.api_client)
self.api_client = petstore_api.ApiClient(HOST)
self.pet_api = petstore_api.PetApi(self.api_client)
self.setUpModels()
self.setUpFiles()
@ -30,13 +30,13 @@ class PetApiTests(unittest.TestCase):
time.sleep(1)
def setUpModels(self):
self.category = swagger_client.Category()
self.category = petstore_api.Category()
self.category.id = int(time.time())
self.category.name = "dog"
self.tag = swagger_client.Tag()
self.tag = petstore_api.Tag()
self.tag.id = int(time.time())
self.tag.name = "swagger-codegen-python-pet-tag"
self.pet = swagger_client.Pet()
self.pet = petstore_api.Pet()
self.pet.id = int(time.time())
self.pet.name = "hello kity"
self.pet.photo_urls = ["http://foo.bar.com/1", "http://foo.bar.com/2"]
@ -50,22 +50,22 @@ class PetApiTests(unittest.TestCase):
self.foo = os.path.join(self.test_file_dir, "foo.png")
def test_create_api_instance(self):
pet_api = swagger_client.PetApi()
pet_api2 = swagger_client.PetApi()
api_client3 = swagger_client.ApiClient()
pet_api = petstore_api.PetApi()
pet_api2 = petstore_api.PetApi()
api_client3 = petstore_api.ApiClient()
api_client3.user_agent = 'api client 3'
api_client4 = swagger_client.ApiClient()
api_client4 = petstore_api.ApiClient()
api_client4.user_agent = 'api client 4'
pet_api3 = swagger_client.PetApi(api_client3)
pet_api3 = petstore_api.PetApi(api_client3)
# same default api client
self.assertEqual(pet_api.api_client, pet_api2.api_client)
# confirm using the default api client in the config module
self.assertEqual(pet_api.api_client, swagger_client.configuration.api_client)
self.assertEqual(pet_api.api_client, petstore_api.configuration.api_client)
# 2 different api clients are not the same
self.assertNotEqual(api_client3, api_client4)
# customized pet api not using the default api client
self.assertNotEqual(pet_api3.api_client, swagger_client.configuration.api_client)
self.assertNotEqual(pet_api3.api_client, petstore_api.configuration.api_client)
# customized pet api not using the old pet api's api client
self.assertNotEqual(pet_api3.api_client, pet_api2.api_client)

View File

@ -3,7 +3,7 @@
"""
Run the tests.
$ pip install nose (optional)
$ cd swagger_client-python
$ cd petstore_api-python
$ nosetests -v
"""
@ -11,22 +11,22 @@ import os
import time
import unittest
import swagger_client
import petstore_api
class PetModelTests(unittest.TestCase):
def setUp(self):
self.pet = swagger_client.Pet()
self.pet = petstore_api.Pet()
self.pet.name = "test name"
self.pet.id = 1
self.pet.photo_urls = ["string"]
self.pet.status = "available"
cate = swagger_client.Category()
cate = petstore_api.Category()
cate.id = 1
cate.name = "dog"
self.pet.category = cate
tag = swagger_client.Tag()
tag = petstore_api.Tag()
tag.id = 1
self.pet.tags = [tag]
@ -40,29 +40,29 @@ class PetModelTests(unittest.TestCase):
self.assertEqual(data, self.pet.to_str())
def test_equal(self):
self.pet1 = swagger_client.Pet()
self.pet1 = petstore_api.Pet()
self.pet1.name = "test name"
self.pet1.id = 1
self.pet1.photo_urls = ["string"]
self.pet1.status = "available"
cate1 = swagger_client.Category()
cate1 = petstore_api.Category()
cate1.id = 1
cate1.name = "dog"
self.pet.category = cate1
tag1 = swagger_client.Tag()
tag1 = petstore_api.Tag()
tag1.id = 1
self.pet1.tags = [tag1]
self.pet2 = swagger_client.Pet()
self.pet2 = petstore_api.Pet()
self.pet2.name = "test name"
self.pet2.id = 1
self.pet2.photo_urls = ["string"]
self.pet2.status = "available"
cate2 = swagger_client.Category()
cate2 = petstore_api.Category()
cate2.id = 1
cate2.name = "dog"
self.pet.category = cate2
tag2 = swagger_client.Tag()
tag2 = petstore_api.Tag()
tag2.id = 1
self.pet2.tags = [tag2]

View File

@ -11,14 +11,14 @@ import os
import time
import unittest
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
class StoreApiTests(unittest.TestCase):
def setUp(self):
self.store_api = swagger_client.StoreApi()
self.store_api = petstore_api.StoreApi()
def tearDown(self):
# sleep 1 sec between two every 2 tests