forked from loafle/openapi-generator-original
[PYTHON] Fix for failing to lookup discriminator value using AllOf and discriminator (#18498)
* fix issue 18495 * add tests and update samples * update samples
This commit is contained in:
committed by
GitHub
parent
bd02e65f88
commit
81fab15a33
@@ -0,0 +1,52 @@
|
||||
# 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: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
from petstore_api.models.base_discriminator import BaseDiscriminator # noqa: E501
|
||||
|
||||
class TestBaseDiscriminator(unittest.TestCase):
|
||||
"""BaseDiscriminator unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional) -> BaseDiscriminator:
|
||||
"""Test BaseDiscriminator
|
||||
include_option is a boolean, when False only required
|
||||
params are included, when True both required and
|
||||
optional params are included """
|
||||
# uncomment below to create an instance of `BaseDiscriminator`
|
||||
"""
|
||||
model = BaseDiscriminator() # noqa: E501
|
||||
if include_optional:
|
||||
return BaseDiscriminator(
|
||||
type_name = ''
|
||||
)
|
||||
else:
|
||||
return BaseDiscriminator(
|
||||
)
|
||||
"""
|
||||
|
||||
def testBaseDiscriminator(self):
|
||||
"""Test BaseDiscriminator"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,52 @@
|
||||
# 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: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
from petstore_api.models.info import Info # noqa: E501
|
||||
|
||||
class TestInfo(unittest.TestCase):
|
||||
"""Info unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional) -> Info:
|
||||
"""Test Info
|
||||
include_option is a boolean, when False only required
|
||||
params are included, when True both required and
|
||||
optional params are included """
|
||||
# uncomment below to create an instance of `Info`
|
||||
"""
|
||||
model = Info() # noqa: E501
|
||||
if include_optional:
|
||||
return Info(
|
||||
val = petstore_api.models.base_discriminator.BaseDiscriminator()
|
||||
)
|
||||
else:
|
||||
return Info(
|
||||
)
|
||||
"""
|
||||
|
||||
def testInfo(self):
|
||||
"""Test Info"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,52 @@
|
||||
# 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: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
from petstore_api.models.primitive_string import PrimitiveString # noqa: E501
|
||||
|
||||
class TestPrimitiveString(unittest.TestCase):
|
||||
"""PrimitiveString unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional) -> PrimitiveString:
|
||||
"""Test PrimitiveString
|
||||
include_option is a boolean, when False only required
|
||||
params are included, when True both required and
|
||||
optional params are included """
|
||||
# uncomment below to create an instance of `PrimitiveString`
|
||||
"""
|
||||
model = PrimitiveString() # noqa: E501
|
||||
if include_optional:
|
||||
return PrimitiveString(
|
||||
value = ''
|
||||
)
|
||||
else:
|
||||
return PrimitiveString(
|
||||
)
|
||||
"""
|
||||
|
||||
def testPrimitiveString(self):
|
||||
"""Test PrimitiveString"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user