Merge remote-tracking branch 'origin/master' into 2.3.0

This commit is contained in:
wing328
2017-05-17 22:00:06 +08:00
681 changed files with 31245 additions and 3547 deletions

View File

@@ -144,9 +144,8 @@ class ApiClientTests(unittest.TestCase):
"status": "available",
"photoUrls": ["http://foo.bar.com/3",
"http://foo.bar.com/4"]}
pet = petstore_api.Pet()
pet = petstore_api.Pet(name=pet_dict["name"], photo_urls=pet_dict["photoUrls"])
pet.id = pet_dict["id"]
pet.name = pet_dict["name"]
cate = petstore_api.Category()
cate.id = pet_dict["category"]["id"]
cate.name = pet_dict["category"]["name"]
@@ -159,7 +158,6 @@ class ApiClientTests(unittest.TestCase):
tag2.name = pet_dict["tags"][1]["name"]
pet.tags = [tag1, tag2]
pet.status = pet_dict["status"]
pet.photo_urls = pet_dict["photoUrls"]
data = pet
result = self.api_client.sanitize_for_serialization(data)

View File

@@ -30,10 +30,8 @@ class ApiExceptionTests(unittest.TestCase):
self.tag = petstore_api.Tag()
self.tag.id = id_gen()
self.tag.name = "blank"
self.pet = petstore_api.Pet()
self.pet = petstore_api.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"])
self.pet.id = id_gen()
self.pet.name = "hello kity"
self.pet.photo_urls = ["http://foo.bar.com/1", "http://foo.bar.com/2"]
self.pet.status = "sold"
self.pet.category = self.category
self.pet.tags = [self.tag]

View File

@@ -20,6 +20,26 @@ class DeserializationTests(unittest.TestCase):
self.api_client = petstore_api.ApiClient()
self.deserialize = self.api_client._ApiClient__deserialize
def test_enum_test(self):
""" deserialize dict(str, Enum_Test) """
data = {
'enum_test': {
"enum_string": "UPPER",
"enum_integer": 1,
"enum_number": 1.1,
"outerEnum": "placed"
}
}
deserialized = self.deserialize(data, 'dict(str, EnumTest)')
self.assertTrue(isinstance(deserialized, dict))
self.assertTrue(isinstance(deserialized['enum_test'], petstore_api.EnumTest))
self.assertEqual(deserialized['enum_test'],
petstore_api.EnumTest(enum_string="UPPER",
enum_integer=1,
enum_number=1.1,
outer_enum=petstore_api.OuterEnum.PLACED))
def test_deserialize_dict_str_pet(self):
""" deserialize dict(str, Pet) """
data = {

View File

@@ -65,10 +65,8 @@ class PetApiTests(unittest.TestCase):
self.tag = petstore_api.Tag()
self.tag.id = id_gen()
self.tag.name = "swagger-codegen-python-pet-tag"
self.pet = petstore_api.Pet()
self.pet = petstore_api.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"])
self.pet.id = id_gen()
self.pet.name = "hello kity"
self.pet.photo_urls = ["http://foo.bar.com/1", "http://foo.bar.com/2"]
self.pet.status = "sold"
self.pet.category = self.category
self.pet.tags = [self.tag]

View File

@@ -17,10 +17,8 @@ import petstore_api
class PetModelTests(unittest.TestCase):
def setUp(self):
self.pet = petstore_api.Pet()
self.pet.name = "test name"
self.pet = petstore_api.Pet(name="test name", photo_urls=["string"])
self.pet.id = 1
self.pet.photo_urls = ["string"]
self.pet.status = "available"
cate = petstore_api.Category()
cate.id = 1
@@ -40,10 +38,8 @@ class PetModelTests(unittest.TestCase):
self.assertEqual(data, self.pet.to_str())
def test_equal(self):
self.pet1 = petstore_api.Pet()
self.pet1.name = "test name"
self.pet1 = petstore_api.Pet(name="test name", photo_urls=["string"])
self.pet1.id = 1
self.pet1.photo_urls = ["string"]
self.pet1.status = "available"
cate1 = petstore_api.Category()
cate1.id = 1
@@ -53,10 +49,8 @@ class PetModelTests(unittest.TestCase):
tag1.id = 1
self.pet1.tags = [tag1]
self.pet2 = petstore_api.Pet()
self.pet2.name = "test name"
self.pet2 = petstore_api.Pet(name="test name", photo_urls=["string"])
self.pet2.id = 1
self.pet2.photo_urls = ["string"]
self.pet2.status = "available"
cate2 = petstore_api.Category()
cate2.id = 1