forked from loafle/openapi-generator-original
* apis and models contains all apis and models, omits loading them in the package namespace * Runs git add -a and commits it * Fixes test_outer_enum.py * Fixes test_fruit.py * Updates test_fruit and test_mammal * Fixes test_parent_pet * Updates test_discard_unknown_properties.py * Updates test_deserialization.py * Updates v2 docs md files for apis + the readme * Fixes v2 tests * v2 doc updates * Updates v3 docs * Reverts python_doc_auth_partial.mustache * Adds sys to v3 tests * Adds FILES update Co-authored-by: Justin Black <justinblack@justins-air.lan>
90 lines
2.2 KiB
Python
90 lines
2.2 KiB
Python
# coding: utf-8
|
|
|
|
"""
|
|
OpenAPI 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: \" \\ # noqa: E501
|
|
|
|
The version of the OpenAPI document: 1.0.0
|
|
Generated by: https://openapi-generator.tech
|
|
"""
|
|
|
|
|
|
from __future__ import absolute_import
|
|
import sys
|
|
import unittest
|
|
|
|
import petstore_api
|
|
try:
|
|
from petstore_api.model import category
|
|
except ImportError:
|
|
category = sys.modules[
|
|
'petstore_api.model.category']
|
|
try:
|
|
from petstore_api.models import tag
|
|
except ImportError:
|
|
tag = sys.modules[
|
|
'petstore_api.model.tag']
|
|
from petstore_api.model.pet import Pet
|
|
|
|
|
|
class TestPet(unittest.TestCase):
|
|
"""Pet unit test stubs"""
|
|
|
|
def setUp(self):
|
|
pass
|
|
|
|
def tearDown(self):
|
|
pass
|
|
|
|
def test_to_str(self):
|
|
pet = Pet(name="test name", photo_urls=["string"])
|
|
pet.id = 1
|
|
pet.status = "available"
|
|
cate = category.Category()
|
|
cate.id = 1
|
|
cate.name = "dog"
|
|
pet.category = cate
|
|
tag1 = tag.Tag()
|
|
tag1.id = 1
|
|
pet.tags = [tag1]
|
|
|
|
data = ("{'category': {'id': 1, 'name': 'dog'},\n"
|
|
" 'id': 1,\n"
|
|
" 'name': 'test name',\n"
|
|
" 'photo_urls': ['string'],\n"
|
|
" 'status': 'available',\n"
|
|
" 'tags': [{'id': 1}]}")
|
|
self.assertEqual(data, pet.to_str())
|
|
|
|
def test_equal(self):
|
|
pet1 = Pet(name="test name", photo_urls=["string"])
|
|
pet1.id = 1
|
|
pet1.status = "available"
|
|
cate1 = category.Category()
|
|
cate1.id = 1
|
|
cate1.name = "dog"
|
|
tag1 = tag.Tag()
|
|
tag1.id = 1
|
|
pet1.tags = [tag1]
|
|
|
|
pet2 = Pet(name="test name", photo_urls=["string"])
|
|
pet2.id = 1
|
|
pet2.status = "available"
|
|
cate2 = category.Category()
|
|
cate2.id = 1
|
|
cate2.name = "dog"
|
|
tag2 = tag.Tag()
|
|
tag2.id = 1
|
|
pet2.tags = [tag2]
|
|
|
|
self.assertTrue(pet1 == pet2)
|
|
|
|
# reset pet1 tags to empty array so that object comparison returns false
|
|
pet1.tags = []
|
|
self.assertFalse(pet1 == pet2)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|