forked from loafle/openapi-generator-original
Revert "Issue 13043: converted an exception to a warning" (#13074)
* Revert "Issue 13043: converted an exception to a warning for doubly adding schemas to the includedSchemas list (#13070)"
This reverts commit bbf463f727.
* Samples regen
This commit is contained in:
@@ -1687,12 +1687,13 @@ public class PythonExperimentalClientCodegen extends AbstractPythonCodegen {
|
||||
*/
|
||||
private void addSchemaToIncludedSchemaList(List<Schema> includedSchemas, Schema schema) {
|
||||
|
||||
// if the schema is in the list, issue a warning
|
||||
// if the schema is in the list, then throw an exception.
|
||||
// this should never happen
|
||||
if(includedSchemas.contains(schema)) {
|
||||
LOGGER.warn("Attempted to add a schema to the includedSchemas list twice");
|
||||
} else {
|
||||
includedSchemas.add(schema);
|
||||
throw new RuntimeException("Attempted to add a schema to the includedSchemas list twice");
|
||||
}
|
||||
|
||||
includedSchemas.add(schema);
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.additionalproperties_allows_a_schema_which_should_validate import AdditionalpropertiesAllowsASchemaWhichShouldValidate
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAdditionalpropertiesAllowsASchemaWhichShouldValidate(unittest.TestCase):
|
||||
"""AdditionalpropertiesAllowsASchemaWhichShouldValidate unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_no_additional_properties_is_valid_passes(self):
|
||||
# no additional properties is valid
|
||||
AdditionalpropertiesAllowsASchemaWhichShouldValidate._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_additional_invalid_property_is_invalid_fails(self):
|
||||
# an additional invalid property is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AdditionalpropertiesAllowsASchemaWhichShouldValidate._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
"bar":
|
||||
2,
|
||||
"quux":
|
||||
12,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_additional_valid_property_is_valid_passes(self):
|
||||
# an additional valid property is valid
|
||||
AdditionalpropertiesAllowsASchemaWhichShouldValidate._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
"bar":
|
||||
2,
|
||||
"quux":
|
||||
True,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,39 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.additionalproperties_are_allowed_by_default import AdditionalpropertiesAreAllowedByDefault
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAdditionalpropertiesAreAllowedByDefault(unittest.TestCase):
|
||||
"""AdditionalpropertiesAreAllowedByDefault unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_additional_properties_are_allowed_passes(self):
|
||||
# additional properties are allowed
|
||||
AdditionalpropertiesAreAllowedByDefault._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
"bar":
|
||||
2,
|
||||
"quux":
|
||||
True,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,46 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.additionalproperties_can_exist_by_itself import AdditionalpropertiesCanExistByItself
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAdditionalpropertiesCanExistByItself(unittest.TestCase):
|
||||
"""AdditionalpropertiesCanExistByItself unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_an_additional_invalid_property_is_invalid_fails(self):
|
||||
# an additional invalid property is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AdditionalpropertiesCanExistByItself._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_additional_valid_property_is_valid_passes(self):
|
||||
# an additional valid property is valid
|
||||
AdditionalpropertiesCanExistByItself._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
True,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,50 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.additionalproperties_should_not_look_in_applicators import AdditionalpropertiesShouldNotLookInApplicators
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAdditionalpropertiesShouldNotLookInApplicators(unittest.TestCase):
|
||||
"""AdditionalpropertiesShouldNotLookInApplicators unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_properties_defined_in_allof_are_not_examined_fails(self):
|
||||
# properties defined in allOf are not examined
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AdditionalpropertiesShouldNotLookInApplicators._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
"bar":
|
||||
True,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_valid_test_case_passes(self):
|
||||
# valid test case
|
||||
AdditionalpropertiesShouldNotLookInApplicators._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
False,
|
||||
"bar":
|
||||
True,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,72 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.allof import Allof
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAllof(unittest.TestCase):
|
||||
"""Allof unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_allof_passes(self):
|
||||
# allOf
|
||||
Allof._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"baz",
|
||||
"bar":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_mismatch_first_fails(self):
|
||||
# mismatch first
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
Allof._from_openapi_data(
|
||||
{
|
||||
"bar":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_mismatch_second_fails(self):
|
||||
# mismatch second
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
Allof._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"baz",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_wrong_type_fails(self):
|
||||
# wrong type
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
Allof._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"baz",
|
||||
"bar":
|
||||
"quux",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,88 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.allof_combined_with_anyof_oneof import AllofCombinedWithAnyofOneof
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAllofCombinedWithAnyofOneof(unittest.TestCase):
|
||||
"""AllofCombinedWithAnyofOneof unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_allof_true_anyof_false_oneof_false_fails(self):
|
||||
# allOf: true, anyOf: false, oneOf: false
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
||||
2,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_allof_false_anyof_false_oneof_true_fails(self):
|
||||
# allOf: false, anyOf: false, oneOf: true
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
||||
5,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_allof_false_anyof_true_oneof_true_fails(self):
|
||||
# allOf: false, anyOf: true, oneOf: true
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
||||
15,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_allof_true_anyof_true_oneof_false_fails(self):
|
||||
# allOf: true, anyOf: true, oneOf: false
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
||||
6,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_allof_true_anyof_true_oneof_true_passes(self):
|
||||
# allOf: true, anyOf: true, oneOf: true
|
||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
||||
30,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_allof_true_anyof_false_oneof_true_fails(self):
|
||||
# allOf: true, anyOf: false, oneOf: true
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
||||
10,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_allof_false_anyof_true_oneof_false_fails(self):
|
||||
# allOf: false, anyOf: true, oneOf: false
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
||||
3,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_allof_false_anyof_false_oneof_false_fails(self):
|
||||
# allOf: false, anyOf: false, oneOf: false
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.allof_simple_types import AllofSimpleTypes
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAllofSimpleTypes(unittest.TestCase):
|
||||
"""AllofSimpleTypes unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_valid_passes(self):
|
||||
# valid
|
||||
AllofSimpleTypes._from_openapi_data(
|
||||
25,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_mismatch_one_fails(self):
|
||||
# mismatch one
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AllofSimpleTypes._from_openapi_data(
|
||||
35,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,89 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.allof_with_base_schema import AllofWithBaseSchema
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAllofWithBaseSchema(unittest.TestCase):
|
||||
"""AllofWithBaseSchema unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_valid_passes(self):
|
||||
# valid
|
||||
AllofWithBaseSchema._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"quux",
|
||||
"bar":
|
||||
2,
|
||||
"baz":
|
||||
None,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_mismatch_first_allof_fails(self):
|
||||
# mismatch first allOf
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AllofWithBaseSchema._from_openapi_data(
|
||||
{
|
||||
"bar":
|
||||
2,
|
||||
"baz":
|
||||
None,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_mismatch_base_schema_fails(self):
|
||||
# mismatch base schema
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AllofWithBaseSchema._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"quux",
|
||||
"baz":
|
||||
None,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_mismatch_both_fails(self):
|
||||
# mismatch both
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AllofWithBaseSchema._from_openapi_data(
|
||||
{
|
||||
"bar":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_mismatch_second_allof_fails(self):
|
||||
# mismatch second allOf
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AllofWithBaseSchema._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"quux",
|
||||
"bar":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,32 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.allof_with_one_empty_schema import AllofWithOneEmptySchema
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAllofWithOneEmptySchema(unittest.TestCase):
|
||||
"""AllofWithOneEmptySchema unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_any_data_is_valid_passes(self):
|
||||
# any data is valid
|
||||
AllofWithOneEmptySchema._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.allof_with_the_first_empty_schema import AllofWithTheFirstEmptySchema
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAllofWithTheFirstEmptySchema(unittest.TestCase):
|
||||
"""AllofWithTheFirstEmptySchema unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_string_is_invalid_fails(self):
|
||||
# string is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AllofWithTheFirstEmptySchema._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_number_is_valid_passes(self):
|
||||
# number is valid
|
||||
AllofWithTheFirstEmptySchema._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.allof_with_the_last_empty_schema import AllofWithTheLastEmptySchema
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAllofWithTheLastEmptySchema(unittest.TestCase):
|
||||
"""AllofWithTheLastEmptySchema unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_string_is_invalid_fails(self):
|
||||
# string is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AllofWithTheLastEmptySchema._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_number_is_valid_passes(self):
|
||||
# number is valid
|
||||
AllofWithTheLastEmptySchema._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,32 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.allof_with_two_empty_schemas import AllofWithTwoEmptySchemas
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAllofWithTwoEmptySchemas(unittest.TestCase):
|
||||
"""AllofWithTwoEmptySchemas unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_any_data_is_valid_passes(self):
|
||||
# any data is valid
|
||||
AllofWithTwoEmptySchemas._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,54 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.anyof import Anyof
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAnyof(unittest.TestCase):
|
||||
"""Anyof unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_second_anyof_valid_passes(self):
|
||||
# second anyOf valid
|
||||
Anyof._from_openapi_data(
|
||||
2.5,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_neither_anyof_valid_fails(self):
|
||||
# neither anyOf valid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
Anyof._from_openapi_data(
|
||||
1.5,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_both_anyof_valid_passes(self):
|
||||
# both anyOf valid
|
||||
Anyof._from_openapi_data(
|
||||
3,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_first_anyof_valid_passes(self):
|
||||
# first anyOf valid
|
||||
Anyof._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,70 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.anyof_complex_types import AnyofComplexTypes
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAnyofComplexTypes(unittest.TestCase):
|
||||
"""AnyofComplexTypes unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_second_anyof_valid_complex_passes(self):
|
||||
# second anyOf valid (complex)
|
||||
AnyofComplexTypes._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"baz",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_neither_anyof_valid_complex_fails(self):
|
||||
# neither anyOf valid (complex)
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AnyofComplexTypes._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
2,
|
||||
"bar":
|
||||
"quux",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_both_anyof_valid_complex_passes(self):
|
||||
# both anyOf valid (complex)
|
||||
AnyofComplexTypes._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"baz",
|
||||
"bar":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_first_anyof_valid_complex_passes(self):
|
||||
# first anyOf valid (complex)
|
||||
AnyofComplexTypes._from_openapi_data(
|
||||
{
|
||||
"bar":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,48 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAnyofWithBaseSchema(unittest.TestCase):
|
||||
"""AnyofWithBaseSchema unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_one_anyof_valid_passes(self):
|
||||
# one anyOf valid
|
||||
AnyofWithBaseSchema._from_openapi_data(
|
||||
"foobar",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_both_anyof_invalid_fails(self):
|
||||
# both anyOf invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AnyofWithBaseSchema._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_mismatch_base_schema_fails(self):
|
||||
# mismatch base schema
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
AnyofWithBaseSchema._from_openapi_data(
|
||||
3,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,39 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestAnyofWithOneEmptySchema(unittest.TestCase):
|
||||
"""AnyofWithOneEmptySchema unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_string_is_valid_passes(self):
|
||||
# string is valid
|
||||
AnyofWithOneEmptySchema._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_number_is_valid_passes(self):
|
||||
# number is valid
|
||||
AnyofWithOneEmptySchema._from_openapi_data(
|
||||
123,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,82 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.array_type_matches_arrays import ArrayTypeMatchesArrays
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestArrayTypeMatchesArrays(unittest.TestCase):
|
||||
"""ArrayTypeMatchesArrays unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_a_float_is_not_an_array_fails(self):
|
||||
# a float is not an array
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
ArrayTypeMatchesArrays._from_openapi_data(
|
||||
1.1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_boolean_is_not_an_array_fails(self):
|
||||
# a boolean is not an array
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
ArrayTypeMatchesArrays._from_openapi_data(
|
||||
True,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_null_is_not_an_array_fails(self):
|
||||
# null is not an array
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
ArrayTypeMatchesArrays._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_object_is_not_an_array_fails(self):
|
||||
# an object is not an array
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
ArrayTypeMatchesArrays._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_string_is_not_an_array_fails(self):
|
||||
# a string is not an array
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
ArrayTypeMatchesArrays._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_array_is_an_array_passes(self):
|
||||
# an array is an array
|
||||
ArrayTypeMatchesArrays._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_integer_is_not_an_array_fails(self):
|
||||
# an integer is not an array
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
ArrayTypeMatchesArrays._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,105 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.boolean_type_matches_booleans import BooleanTypeMatchesBooleans
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestBooleanTypeMatchesBooleans(unittest.TestCase):
|
||||
"""BooleanTypeMatchesBooleans unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_an_empty_string_is_not_a_boolean_fails(self):
|
||||
# an empty string is not a boolean
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
||||
"",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_float_is_not_a_boolean_fails(self):
|
||||
# a float is not a boolean
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
||||
1.1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_null_is_not_a_boolean_fails(self):
|
||||
# null is not a boolean
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_zero_is_not_a_boolean_fails(self):
|
||||
# zero is not a boolean
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
||||
0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_array_is_not_a_boolean_fails(self):
|
||||
# an array is not a boolean
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_string_is_not_a_boolean_fails(self):
|
||||
# a string is not a boolean
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_false_is_a_boolean_passes(self):
|
||||
# false is a boolean
|
||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
||||
False,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_integer_is_not_a_boolean_fails(self):
|
||||
# an integer is not a boolean
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_true_is_a_boolean_passes(self):
|
||||
# true is a boolean
|
||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
||||
True,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_object_is_not_a_boolean_fails(self):
|
||||
# an object is not a boolean
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,47 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.by_int import ByInt
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestByInt(unittest.TestCase):
|
||||
"""ByInt unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_int_by_int_fail_fails(self):
|
||||
# int by int fail
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
ByInt._from_openapi_data(
|
||||
7,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_int_by_int_passes(self):
|
||||
# int by int
|
||||
ByInt._from_openapi_data(
|
||||
10,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_non_numbers_passes(self):
|
||||
# ignores non-numbers
|
||||
ByInt._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,47 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.by_number import ByNumber
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestByNumber(unittest.TestCase):
|
||||
"""ByNumber unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_45_is_multiple_of15_passes(self):
|
||||
# 4.5 is multiple of 1.5
|
||||
ByNumber._from_openapi_data(
|
||||
4.5,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_35_is_not_multiple_of15_fails(self):
|
||||
# 35 is not multiple of 1.5
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
ByNumber._from_openapi_data(
|
||||
35,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_zero_is_multiple_of_anything_passes(self):
|
||||
# zero is multiple of anything
|
||||
ByNumber._from_openapi_data(
|
||||
0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.by_small_number import BySmallNumber
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestBySmallNumber(unittest.TestCase):
|
||||
"""BySmallNumber unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_000751_is_not_multiple_of00001_fails(self):
|
||||
# 0.00751 is not multiple of 0.0001
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
BySmallNumber._from_openapi_data(
|
||||
0.00751,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_00075_is_multiple_of00001_passes(self):
|
||||
# 0.0075 is multiple of 0.0001
|
||||
BySmallNumber._from_openapi_data(
|
||||
0.0075,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,69 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.date_time_format import DateTimeFormat
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestDateTimeFormat(unittest.TestCase):
|
||||
"""DateTimeFormat unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_all_string_formats_ignore_objects_passes(self):
|
||||
# all string formats ignore objects
|
||||
DateTimeFormat._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_booleans_passes(self):
|
||||
# all string formats ignore booleans
|
||||
DateTimeFormat._from_openapi_data(
|
||||
False,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_integers_passes(self):
|
||||
# all string formats ignore integers
|
||||
DateTimeFormat._from_openapi_data(
|
||||
12,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_floats_passes(self):
|
||||
# all string formats ignore floats
|
||||
DateTimeFormat._from_openapi_data(
|
||||
13.7,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_arrays_passes(self):
|
||||
# all string formats ignore arrays
|
||||
DateTimeFormat._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_nulls_passes(self):
|
||||
# all string formats ignore nulls
|
||||
DateTimeFormat._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,69 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.email_format import EmailFormat
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestEmailFormat(unittest.TestCase):
|
||||
"""EmailFormat unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_all_string_formats_ignore_objects_passes(self):
|
||||
# all string formats ignore objects
|
||||
EmailFormat._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_booleans_passes(self):
|
||||
# all string formats ignore booleans
|
||||
EmailFormat._from_openapi_data(
|
||||
False,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_integers_passes(self):
|
||||
# all string formats ignore integers
|
||||
EmailFormat._from_openapi_data(
|
||||
12,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_floats_passes(self):
|
||||
# all string formats ignore floats
|
||||
EmailFormat._from_openapi_data(
|
||||
13.7,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_arrays_passes(self):
|
||||
# all string formats ignore arrays
|
||||
EmailFormat._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_nulls_passes(self):
|
||||
# all string formats ignore nulls
|
||||
EmailFormat._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,47 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.enum_with0_does_not_match_false import EnumWith0DoesNotMatchFalse
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestEnumWith0DoesNotMatchFalse(unittest.TestCase):
|
||||
"""EnumWith0DoesNotMatchFalse unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_integer_zero_is_valid_passes(self):
|
||||
# integer zero is valid
|
||||
EnumWith0DoesNotMatchFalse._from_openapi_data(
|
||||
0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_float_zero_is_valid_passes(self):
|
||||
# float zero is valid
|
||||
EnumWith0DoesNotMatchFalse._from_openapi_data(
|
||||
0.0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_false_is_invalid_fails(self):
|
||||
# false is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
EnumWith0DoesNotMatchFalse._from_openapi_data(
|
||||
False,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,47 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.enum_with1_does_not_match_true import EnumWith1DoesNotMatchTrue
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestEnumWith1DoesNotMatchTrue(unittest.TestCase):
|
||||
"""EnumWith1DoesNotMatchTrue unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_true_is_invalid_fails(self):
|
||||
# true is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
EnumWith1DoesNotMatchTrue._from_openapi_data(
|
||||
True,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_integer_one_is_valid_passes(self):
|
||||
# integer one is valid
|
||||
EnumWith1DoesNotMatchTrue._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_float_one_is_valid_passes(self):
|
||||
# float one is valid
|
||||
EnumWith1DoesNotMatchTrue._from_openapi_data(
|
||||
1.0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,47 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.enum_with_escaped_characters import EnumWithEscapedCharacters
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestEnumWithEscapedCharacters(unittest.TestCase):
|
||||
"""EnumWithEscapedCharacters unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_member2_is_valid_passes(self):
|
||||
# member 2 is valid
|
||||
EnumWithEscapedCharacters._from_openapi_data(
|
||||
"foo\rbar",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_member1_is_valid_passes(self):
|
||||
# member 1 is valid
|
||||
EnumWithEscapedCharacters._from_openapi_data(
|
||||
"foo\nbar",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_another_string_is_invalid_fails(self):
|
||||
# another string is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
EnumWithEscapedCharacters._from_openapi_data(
|
||||
"abc",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,48 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.enum_with_false_does_not_match0 import EnumWithFalseDoesNotMatch0
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestEnumWithFalseDoesNotMatch0(unittest.TestCase):
|
||||
"""EnumWithFalseDoesNotMatch0 unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_false_is_valid_passes(self):
|
||||
# false is valid
|
||||
EnumWithFalseDoesNotMatch0._from_openapi_data(
|
||||
False,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_float_zero_is_invalid_fails(self):
|
||||
# float zero is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
EnumWithFalseDoesNotMatch0._from_openapi_data(
|
||||
0.0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_integer_zero_is_invalid_fails(self):
|
||||
# integer zero is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
EnumWithFalseDoesNotMatch0._from_openapi_data(
|
||||
0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,48 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.enum_with_true_does_not_match1 import EnumWithTrueDoesNotMatch1
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestEnumWithTrueDoesNotMatch1(unittest.TestCase):
|
||||
"""EnumWithTrueDoesNotMatch1 unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_float_one_is_invalid_fails(self):
|
||||
# float one is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
EnumWithTrueDoesNotMatch1._from_openapi_data(
|
||||
1.0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_true_is_valid_passes(self):
|
||||
# true is valid
|
||||
EnumWithTrueDoesNotMatch1._from_openapi_data(
|
||||
True,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_integer_one_is_invalid_fails(self):
|
||||
# integer one is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
EnumWithTrueDoesNotMatch1._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,93 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.enums_in_properties import EnumsInProperties
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestEnumsInProperties(unittest.TestCase):
|
||||
"""EnumsInProperties unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_missing_optional_property_is_valid_passes(self):
|
||||
# missing optional property is valid
|
||||
EnumsInProperties._from_openapi_data(
|
||||
{
|
||||
"bar":
|
||||
"bar",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_wrong_foo_value_fails(self):
|
||||
# wrong foo value
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
EnumsInProperties._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"foot",
|
||||
"bar":
|
||||
"bar",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_both_properties_are_valid_passes(self):
|
||||
# both properties are valid
|
||||
EnumsInProperties._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"foo",
|
||||
"bar":
|
||||
"bar",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_wrong_bar_value_fails(self):
|
||||
# wrong bar value
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
EnumsInProperties._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"foo",
|
||||
"bar":
|
||||
"bart",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_missing_all_properties_is_invalid_fails(self):
|
||||
# missing all properties is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
EnumsInProperties._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_missing_required_property_is_invalid_fails(self):
|
||||
# missing required property is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
EnumsInProperties._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"foo",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,50 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.forbidden_property import ForbiddenProperty
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestForbiddenProperty(unittest.TestCase):
|
||||
"""ForbiddenProperty unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_property_present_fails(self):
|
||||
# property present
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
ForbiddenProperty._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
"bar":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_property_absent_passes(self):
|
||||
# property absent
|
||||
ForbiddenProperty._from_openapi_data(
|
||||
{
|
||||
"bar":
|
||||
1,
|
||||
"baz":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,69 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.hostname_format import HostnameFormat
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestHostnameFormat(unittest.TestCase):
|
||||
"""HostnameFormat unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_all_string_formats_ignore_objects_passes(self):
|
||||
# all string formats ignore objects
|
||||
HostnameFormat._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_booleans_passes(self):
|
||||
# all string formats ignore booleans
|
||||
HostnameFormat._from_openapi_data(
|
||||
False,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_integers_passes(self):
|
||||
# all string formats ignore integers
|
||||
HostnameFormat._from_openapi_data(
|
||||
12,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_floats_passes(self):
|
||||
# all string formats ignore floats
|
||||
HostnameFormat._from_openapi_data(
|
||||
13.7,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_arrays_passes(self):
|
||||
# all string formats ignore arrays
|
||||
HostnameFormat._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_nulls_passes(self):
|
||||
# all string formats ignore nulls
|
||||
HostnameFormat._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,97 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.integer_type_matches_integers import IntegerTypeMatchesIntegers
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestIntegerTypeMatchesIntegers(unittest.TestCase):
|
||||
"""IntegerTypeMatchesIntegers unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_an_object_is_not_an_integer_fails(self):
|
||||
# an object is not an integer
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_string_is_not_an_integer_fails(self):
|
||||
# a string is not an integer
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_null_is_not_an_integer_fails(self):
|
||||
# null is not an integer
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_float_with_zero_fractional_part_is_an_integer_passes(self):
|
||||
# a float with zero fractional part is an integer
|
||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
||||
1.0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_float_is_not_an_integer_fails(self):
|
||||
# a float is not an integer
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
||||
1.1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_boolean_is_not_an_integer_fails(self):
|
||||
# a boolean is not an integer
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
||||
True,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_integer_is_an_integer_passes(self):
|
||||
# an integer is an integer
|
||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_string_is_still_not_an_integer_even_if_it_looks_like_one_fails(self):
|
||||
# a string is still not an integer, even if it looks like one
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
||||
"1",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_array_is_not_an_integer_fails(self):
|
||||
# an array is not an integer
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.invalid_instance_should_not_raise_error_when_float_division_inf import InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestInvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf(unittest.TestCase):
|
||||
"""InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_always_invalid_but_naive_implementations_may_raise_an_overflow_error_fails(self):
|
||||
# always invalid, but naive implementations may raise an overflow error
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf._from_openapi_data(
|
||||
1.0E308,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_valid_integer_with_multipleof_float_passes(self):
|
||||
# valid integer with multipleOf float
|
||||
InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf._from_openapi_data(
|
||||
123456789,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,43 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.invalid_string_value_for_default import InvalidStringValueForDefault
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestInvalidStringValueForDefault(unittest.TestCase):
|
||||
"""InvalidStringValueForDefault unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_valid_when_property_is_specified_passes(self):
|
||||
# valid when property is specified
|
||||
InvalidStringValueForDefault._from_openapi_data(
|
||||
{
|
||||
"bar":
|
||||
"good",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_still_valid_when_the_invalid_default_is_used_passes(self):
|
||||
# still valid when the invalid default is used
|
||||
InvalidStringValueForDefault._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,69 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.ipv4_format import Ipv4Format
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestIpv4Format(unittest.TestCase):
|
||||
"""Ipv4Format unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_all_string_formats_ignore_objects_passes(self):
|
||||
# all string formats ignore objects
|
||||
Ipv4Format._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_booleans_passes(self):
|
||||
# all string formats ignore booleans
|
||||
Ipv4Format._from_openapi_data(
|
||||
False,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_integers_passes(self):
|
||||
# all string formats ignore integers
|
||||
Ipv4Format._from_openapi_data(
|
||||
12,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_floats_passes(self):
|
||||
# all string formats ignore floats
|
||||
Ipv4Format._from_openapi_data(
|
||||
13.7,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_arrays_passes(self):
|
||||
# all string formats ignore arrays
|
||||
Ipv4Format._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_nulls_passes(self):
|
||||
# all string formats ignore nulls
|
||||
Ipv4Format._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,69 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.ipv6_format import Ipv6Format
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestIpv6Format(unittest.TestCase):
|
||||
"""Ipv6Format unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_all_string_formats_ignore_objects_passes(self):
|
||||
# all string formats ignore objects
|
||||
Ipv6Format._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_booleans_passes(self):
|
||||
# all string formats ignore booleans
|
||||
Ipv6Format._from_openapi_data(
|
||||
False,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_integers_passes(self):
|
||||
# all string formats ignore integers
|
||||
Ipv6Format._from_openapi_data(
|
||||
12,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_floats_passes(self):
|
||||
# all string formats ignore floats
|
||||
Ipv6Format._from_openapi_data(
|
||||
13.7,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_arrays_passes(self):
|
||||
# all string formats ignore arrays
|
||||
Ipv6Format._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_nulls_passes(self):
|
||||
# all string formats ignore nulls
|
||||
Ipv6Format._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,69 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.json_pointer_format import JsonPointerFormat
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestJsonPointerFormat(unittest.TestCase):
|
||||
"""JsonPointerFormat unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_all_string_formats_ignore_objects_passes(self):
|
||||
# all string formats ignore objects
|
||||
JsonPointerFormat._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_booleans_passes(self):
|
||||
# all string formats ignore booleans
|
||||
JsonPointerFormat._from_openapi_data(
|
||||
False,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_integers_passes(self):
|
||||
# all string formats ignore integers
|
||||
JsonPointerFormat._from_openapi_data(
|
||||
12,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_floats_passes(self):
|
||||
# all string formats ignore floats
|
||||
JsonPointerFormat._from_openapi_data(
|
||||
13.7,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_arrays_passes(self):
|
||||
# all string formats ignore arrays
|
||||
JsonPointerFormat._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_nulls_passes(self):
|
||||
# all string formats ignore nulls
|
||||
JsonPointerFormat._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,54 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.maximum_validation import MaximumValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestMaximumValidation(unittest.TestCase):
|
||||
"""MaximumValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_below_the_maximum_is_valid_passes(self):
|
||||
# below the maximum is valid
|
||||
MaximumValidation._from_openapi_data(
|
||||
2.6,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_boundary_point_is_valid_passes(self):
|
||||
# boundary point is valid
|
||||
MaximumValidation._from_openapi_data(
|
||||
3.0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_above_the_maximum_is_invalid_fails(self):
|
||||
# above the maximum is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
MaximumValidation._from_openapi_data(
|
||||
3.5,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_non_numbers_passes(self):
|
||||
# ignores non-numbers
|
||||
MaximumValidation._from_openapi_data(
|
||||
"x",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,54 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.maximum_validation_with_unsigned_integer import MaximumValidationWithUnsignedInteger
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestMaximumValidationWithUnsignedInteger(unittest.TestCase):
|
||||
"""MaximumValidationWithUnsignedInteger unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_below_the_maximum_is_invalid_passes(self):
|
||||
# below the maximum is invalid
|
||||
MaximumValidationWithUnsignedInteger._from_openapi_data(
|
||||
299.97,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_above_the_maximum_is_invalid_fails(self):
|
||||
# above the maximum is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
MaximumValidationWithUnsignedInteger._from_openapi_data(
|
||||
300.5,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_boundary_point_integer_is_valid_passes(self):
|
||||
# boundary point integer is valid
|
||||
MaximumValidationWithUnsignedInteger._from_openapi_data(
|
||||
300,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_boundary_point_float_is_valid_passes(self):
|
||||
# boundary point float is valid
|
||||
MaximumValidationWithUnsignedInteger._from_openapi_data(
|
||||
300.0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,63 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.maxitems_validation import MaxitemsValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestMaxitemsValidation(unittest.TestCase):
|
||||
"""MaxitemsValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_too_long_is_invalid_fails(self):
|
||||
# too long is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
MaxitemsValidation._from_openapi_data(
|
||||
[
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_non_arrays_passes(self):
|
||||
# ignores non-arrays
|
||||
MaxitemsValidation._from_openapi_data(
|
||||
"foobar",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_shorter_is_valid_passes(self):
|
||||
# shorter is valid
|
||||
MaxitemsValidation._from_openapi_data(
|
||||
[
|
||||
1,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_exact_length_is_valid_passes(self):
|
||||
# exact length is valid
|
||||
MaxitemsValidation._from_openapi_data(
|
||||
[
|
||||
1,
|
||||
2,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,61 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.maxlength_validation import MaxlengthValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestMaxlengthValidation(unittest.TestCase):
|
||||
"""MaxlengthValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_too_long_is_invalid_fails(self):
|
||||
# too long is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
MaxlengthValidation._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_non_strings_passes(self):
|
||||
# ignores non-strings
|
||||
MaxlengthValidation._from_openapi_data(
|
||||
100,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_shorter_is_valid_passes(self):
|
||||
# shorter is valid
|
||||
MaxlengthValidation._from_openapi_data(
|
||||
"f",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_two_supplementary_unicode_code_points_is_long_enough_passes(self):
|
||||
# two supplementary Unicode code points is long enough
|
||||
MaxlengthValidation._from_openapi_data(
|
||||
"💩💩",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_exact_length_is_valid_passes(self):
|
||||
# exact length is valid
|
||||
MaxlengthValidation._from_openapi_data(
|
||||
"fo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,44 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.maxproperties0_means_the_object_is_empty import Maxproperties0MeansTheObjectIsEmpty
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestMaxproperties0MeansTheObjectIsEmpty(unittest.TestCase):
|
||||
"""Maxproperties0MeansTheObjectIsEmpty unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_no_properties_is_valid_passes(self):
|
||||
# no properties is valid
|
||||
Maxproperties0MeansTheObjectIsEmpty._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_one_property_is_invalid_fails(self):
|
||||
# one property is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
Maxproperties0MeansTheObjectIsEmpty._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,87 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.maxproperties_validation import MaxpropertiesValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestMaxpropertiesValidation(unittest.TestCase):
|
||||
"""MaxpropertiesValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_too_long_is_invalid_fails(self):
|
||||
# too long is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
MaxpropertiesValidation._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
"bar":
|
||||
2,
|
||||
"baz":
|
||||
3,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_arrays_passes(self):
|
||||
# ignores arrays
|
||||
MaxpropertiesValidation._from_openapi_data(
|
||||
[
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_other_non_objects_passes(self):
|
||||
# ignores other non-objects
|
||||
MaxpropertiesValidation._from_openapi_data(
|
||||
12,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_strings_passes(self):
|
||||
# ignores strings
|
||||
MaxpropertiesValidation._from_openapi_data(
|
||||
"foobar",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_shorter_is_valid_passes(self):
|
||||
# shorter is valid
|
||||
MaxpropertiesValidation._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_exact_length_is_valid_passes(self):
|
||||
# exact length is valid
|
||||
MaxpropertiesValidation._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
"bar":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,54 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.minimum_validation import MinimumValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestMinimumValidation(unittest.TestCase):
|
||||
"""MinimumValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_boundary_point_is_valid_passes(self):
|
||||
# boundary point is valid
|
||||
MinimumValidation._from_openapi_data(
|
||||
1.1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_below_the_minimum_is_invalid_fails(self):
|
||||
# below the minimum is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
MinimumValidation._from_openapi_data(
|
||||
0.6,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_above_the_minimum_is_valid_passes(self):
|
||||
# above the minimum is valid
|
||||
MinimumValidation._from_openapi_data(
|
||||
2.6,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_non_numbers_passes(self):
|
||||
# ignores non-numbers
|
||||
MinimumValidation._from_openapi_data(
|
||||
"x",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,76 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.minimum_validation_with_signed_integer import MinimumValidationWithSignedInteger
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestMinimumValidationWithSignedInteger(unittest.TestCase):
|
||||
"""MinimumValidationWithSignedInteger unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_boundary_point_is_valid_passes(self):
|
||||
# boundary point is valid
|
||||
MinimumValidationWithSignedInteger._from_openapi_data(
|
||||
-2,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_positive_above_the_minimum_is_valid_passes(self):
|
||||
# positive above the minimum is valid
|
||||
MinimumValidationWithSignedInteger._from_openapi_data(
|
||||
0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_int_below_the_minimum_is_invalid_fails(self):
|
||||
# int below the minimum is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
MinimumValidationWithSignedInteger._from_openapi_data(
|
||||
-3,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_float_below_the_minimum_is_invalid_fails(self):
|
||||
# float below the minimum is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
MinimumValidationWithSignedInteger._from_openapi_data(
|
||||
-2.0001,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_boundary_point_with_float_is_valid_passes(self):
|
||||
# boundary point with float is valid
|
||||
MinimumValidationWithSignedInteger._from_openapi_data(
|
||||
-2.0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_negative_above_the_minimum_is_valid_passes(self):
|
||||
# negative above the minimum is valid
|
||||
MinimumValidationWithSignedInteger._from_openapi_data(
|
||||
-1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_non_numbers_passes(self):
|
||||
# ignores non-numbers
|
||||
MinimumValidationWithSignedInteger._from_openapi_data(
|
||||
"x",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,60 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.minitems_validation import MinitemsValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestMinitemsValidation(unittest.TestCase):
|
||||
"""MinitemsValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_too_short_is_invalid_fails(self):
|
||||
# too short is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
MinitemsValidation._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_non_arrays_passes(self):
|
||||
# ignores non-arrays
|
||||
MinitemsValidation._from_openapi_data(
|
||||
"",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_longer_is_valid_passes(self):
|
||||
# longer is valid
|
||||
MinitemsValidation._from_openapi_data(
|
||||
[
|
||||
1,
|
||||
2,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_exact_length_is_valid_passes(self):
|
||||
# exact length is valid
|
||||
MinitemsValidation._from_openapi_data(
|
||||
[
|
||||
1,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,62 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.minlength_validation import MinlengthValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestMinlengthValidation(unittest.TestCase):
|
||||
"""MinlengthValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_too_short_is_invalid_fails(self):
|
||||
# too short is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
MinlengthValidation._from_openapi_data(
|
||||
"f",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_one_supplementary_unicode_code_point_is_not_long_enough_fails(self):
|
||||
# one supplementary Unicode code point is not long enough
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
MinlengthValidation._from_openapi_data(
|
||||
"💩",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_longer_is_valid_passes(self):
|
||||
# longer is valid
|
||||
MinlengthValidation._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_non_strings_passes(self):
|
||||
# ignores non-strings
|
||||
MinlengthValidation._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_exact_length_is_valid_passes(self):
|
||||
# exact length is valid
|
||||
MinlengthValidation._from_openapi_data(
|
||||
"fo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,78 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.minproperties_validation import MinpropertiesValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestMinpropertiesValidation(unittest.TestCase):
|
||||
"""MinpropertiesValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_ignores_arrays_passes(self):
|
||||
# ignores arrays
|
||||
MinpropertiesValidation._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_other_non_objects_passes(self):
|
||||
# ignores other non-objects
|
||||
MinpropertiesValidation._from_openapi_data(
|
||||
12,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_too_short_is_invalid_fails(self):
|
||||
# too short is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
MinpropertiesValidation._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_strings_passes(self):
|
||||
# ignores strings
|
||||
MinpropertiesValidation._from_openapi_data(
|
||||
"",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_longer_is_valid_passes(self):
|
||||
# longer is valid
|
||||
MinpropertiesValidation._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
"bar":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_exact_length_is_valid_passes(self):
|
||||
# exact length is valid
|
||||
MinpropertiesValidation._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.model_not import ModelNot
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestModelNot(unittest.TestCase):
|
||||
"""ModelNot unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_allowed_passes(self):
|
||||
# allowed
|
||||
ModelNot._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_disallowed_fails(self):
|
||||
# disallowed
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
ModelNot._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.nested_allof_to_check_validation_semantics import NestedAllofToCheckValidationSemantics
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestNestedAllofToCheckValidationSemantics(unittest.TestCase):
|
||||
"""NestedAllofToCheckValidationSemantics unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_anything_non_null_is_invalid_fails(self):
|
||||
# anything non-null is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NestedAllofToCheckValidationSemantics._from_openapi_data(
|
||||
123,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_null_is_valid_passes(self):
|
||||
# null is valid
|
||||
NestedAllofToCheckValidationSemantics._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestNestedAnyofToCheckValidationSemantics(unittest.TestCase):
|
||||
"""NestedAnyofToCheckValidationSemantics unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_anything_non_null_is_invalid_fails(self):
|
||||
# anything non-null is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NestedAnyofToCheckValidationSemantics._from_openapi_data(
|
||||
123,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_null_is_valid_passes(self):
|
||||
# null is valid
|
||||
NestedAnyofToCheckValidationSemantics._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,129 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.nested_items import NestedItems
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestNestedItems(unittest.TestCase):
|
||||
"""NestedItems unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_valid_nested_array_passes(self):
|
||||
# valid nested array
|
||||
NestedItems._from_openapi_data(
|
||||
[
|
||||
[
|
||||
[
|
||||
[
|
||||
1,
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
2,
|
||||
],
|
||||
[
|
||||
3,
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
[
|
||||
4,
|
||||
],
|
||||
[
|
||||
5,
|
||||
],
|
||||
[
|
||||
6,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_nested_array_with_invalid_type_fails(self):
|
||||
# nested array with invalid type
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NestedItems._from_openapi_data(
|
||||
[
|
||||
[
|
||||
[
|
||||
[
|
||||
"1",
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
2,
|
||||
],
|
||||
[
|
||||
3,
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
[
|
||||
4,
|
||||
],
|
||||
[
|
||||
5,
|
||||
],
|
||||
[
|
||||
6,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_not_deep_enough_fails(self):
|
||||
# not deep enough
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NestedItems._from_openapi_data(
|
||||
[
|
||||
[
|
||||
[
|
||||
1,
|
||||
],
|
||||
[
|
||||
2,
|
||||
],
|
||||
[
|
||||
3,
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
4,
|
||||
],
|
||||
[
|
||||
5,
|
||||
],
|
||||
[
|
||||
6,
|
||||
],
|
||||
],
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestNestedOneofToCheckValidationSemantics(unittest.TestCase):
|
||||
"""NestedOneofToCheckValidationSemantics unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_anything_non_null_is_invalid_fails(self):
|
||||
# anything non-null is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NestedOneofToCheckValidationSemantics._from_openapi_data(
|
||||
123,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_null_is_valid_passes(self):
|
||||
# null is valid
|
||||
NestedOneofToCheckValidationSemantics._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,53 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.not_more_complex_schema import NotMoreComplexSchema
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestNotMoreComplexSchema(unittest.TestCase):
|
||||
"""NotMoreComplexSchema unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_other_match_passes(self):
|
||||
# other match
|
||||
NotMoreComplexSchema._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_mismatch_fails(self):
|
||||
# mismatch
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NotMoreComplexSchema._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"bar",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_match_passes(self):
|
||||
# match
|
||||
NotMoreComplexSchema._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.nul_characters_in_strings import NulCharactersInStrings
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestNulCharactersInStrings(unittest.TestCase):
|
||||
"""NulCharactersInStrings unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_match_string_with_nul_passes(self):
|
||||
# match string with nul
|
||||
NulCharactersInStrings._from_openapi_data(
|
||||
"hello\x00there",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_do_not_match_string_lacking_nul_fails(self):
|
||||
# do not match string lacking nul
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NulCharactersInStrings._from_openapi_data(
|
||||
"hellothere",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,106 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.null_type_matches_only_the_null_object import NullTypeMatchesOnlyTheNullObject
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestNullTypeMatchesOnlyTheNullObject(unittest.TestCase):
|
||||
"""NullTypeMatchesOnlyTheNullObject unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_a_float_is_not_null_fails(self):
|
||||
# a float is not null
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
||||
1.1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_object_is_not_null_fails(self):
|
||||
# an object is not null
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_false_is_not_null_fails(self):
|
||||
# false is not null
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
||||
False,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_integer_is_not_null_fails(self):
|
||||
# an integer is not null
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_true_is_not_null_fails(self):
|
||||
# true is not null
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
||||
True,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_zero_is_not_null_fails(self):
|
||||
# zero is not null
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
||||
0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_empty_string_is_not_null_fails(self):
|
||||
# an empty string is not null
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
||||
"",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_null_is_null_passes(self):
|
||||
# null is null
|
||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_array_is_not_null_fails(self):
|
||||
# an array is not null
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_string_is_not_null_fails(self):
|
||||
# a string is not null
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,96 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.number_type_matches_numbers import NumberTypeMatchesNumbers
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestNumberTypeMatchesNumbers(unittest.TestCase):
|
||||
"""NumberTypeMatchesNumbers unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_an_array_is_not_a_number_fails(self):
|
||||
# an array is not a number
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NumberTypeMatchesNumbers._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_null_is_not_a_number_fails(self):
|
||||
# null is not a number
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NumberTypeMatchesNumbers._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_object_is_not_a_number_fails(self):
|
||||
# an object is not a number
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NumberTypeMatchesNumbers._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_boolean_is_not_a_number_fails(self):
|
||||
# a boolean is not a number
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NumberTypeMatchesNumbers._from_openapi_data(
|
||||
True,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_float_is_a_number_passes(self):
|
||||
# a float is a number
|
||||
NumberTypeMatchesNumbers._from_openapi_data(
|
||||
1.1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_string_is_still_not_a_number_even_if_it_looks_like_one_fails(self):
|
||||
# a string is still not a number, even if it looks like one
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NumberTypeMatchesNumbers._from_openapi_data(
|
||||
"1",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_string_is_not_a_number_fails(self):
|
||||
# a string is not a number
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
NumberTypeMatchesNumbers._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_integer_is_a_number_passes(self):
|
||||
# an integer is a number
|
||||
NumberTypeMatchesNumbers._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_float_with_zero_fractional_part_is_a_number_and_an_integer_passes(self):
|
||||
# a float with zero fractional part is a number (and an integer)
|
||||
NumberTypeMatchesNumbers._from_openapi_data(
|
||||
1.0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,92 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestObjectPropertiesValidation(unittest.TestCase):
|
||||
"""ObjectPropertiesValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_ignores_arrays_passes(self):
|
||||
# ignores arrays
|
||||
ObjectPropertiesValidation._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_other_non_objects_passes(self):
|
||||
# ignores other non-objects
|
||||
ObjectPropertiesValidation._from_openapi_data(
|
||||
12,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_one_property_invalid_is_invalid_fails(self):
|
||||
# one property invalid is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
ObjectPropertiesValidation._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
"bar":
|
||||
{
|
||||
},
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_both_properties_present_and_valid_is_valid_passes(self):
|
||||
# both properties present and valid is valid
|
||||
ObjectPropertiesValidation._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
"bar":
|
||||
"baz",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_doesn_t_invalidate_other_properties_passes(self):
|
||||
# doesn't invalidate other properties
|
||||
ObjectPropertiesValidation._from_openapi_data(
|
||||
{
|
||||
"quux":
|
||||
[
|
||||
],
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_both_properties_invalid_is_invalid_fails(self):
|
||||
# both properties invalid is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
ObjectPropertiesValidation._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
[
|
||||
],
|
||||
"bar":
|
||||
{
|
||||
},
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,55 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.oneof import Oneof
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestOneof(unittest.TestCase):
|
||||
"""Oneof unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_second_oneof_valid_passes(self):
|
||||
# second oneOf valid
|
||||
Oneof._from_openapi_data(
|
||||
2.5,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_both_oneof_valid_fails(self):
|
||||
# both oneOf valid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
Oneof._from_openapi_data(
|
||||
3,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_first_oneof_valid_passes(self):
|
||||
# first oneOf valid
|
||||
Oneof._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_neither_oneof_valid_fails(self):
|
||||
# neither oneOf valid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
Oneof._from_openapi_data(
|
||||
1.5,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,71 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.oneof_complex_types import OneofComplexTypes
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestOneofComplexTypes(unittest.TestCase):
|
||||
"""OneofComplexTypes unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_first_oneof_valid_complex_passes(self):
|
||||
# first oneOf valid (complex)
|
||||
OneofComplexTypes._from_openapi_data(
|
||||
{
|
||||
"bar":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_neither_oneof_valid_complex_fails(self):
|
||||
# neither oneOf valid (complex)
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
OneofComplexTypes._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
2,
|
||||
"bar":
|
||||
"quux",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_both_oneof_valid_complex_fails(self):
|
||||
# both oneOf valid (complex)
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
OneofComplexTypes._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"baz",
|
||||
"bar":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_second_oneof_valid_complex_passes(self):
|
||||
# second oneOf valid (complex)
|
||||
OneofComplexTypes._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
"baz",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,48 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestOneofWithBaseSchema(unittest.TestCase):
|
||||
"""OneofWithBaseSchema unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_both_oneof_valid_fails(self):
|
||||
# both oneOf valid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
OneofWithBaseSchema._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_mismatch_base_schema_fails(self):
|
||||
# mismatch base schema
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
OneofWithBaseSchema._from_openapi_data(
|
||||
3,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_one_oneof_valid_passes(self):
|
||||
# one oneOf valid
|
||||
OneofWithBaseSchema._from_openapi_data(
|
||||
"foobar",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestOneofWithEmptySchema(unittest.TestCase):
|
||||
"""OneofWithEmptySchema unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_both_valid_invalid_fails(self):
|
||||
# both valid - invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
OneofWithEmptySchema._from_openapi_data(
|
||||
123,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_one_valid_valid_passes(self):
|
||||
# one valid - valid
|
||||
OneofWithEmptySchema._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,32 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.pattern_is_not_anchored import PatternIsNotAnchored
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestPatternIsNotAnchored(unittest.TestCase):
|
||||
"""PatternIsNotAnchored unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_matches_a_substring_passes(self):
|
||||
# matches a substring
|
||||
PatternIsNotAnchored._from_openapi_data(
|
||||
"xxaayy",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,84 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.pattern_validation import PatternValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestPatternValidation(unittest.TestCase):
|
||||
"""PatternValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_ignores_arrays_passes(self):
|
||||
# ignores arrays
|
||||
PatternValidation._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_objects_passes(self):
|
||||
# ignores objects
|
||||
PatternValidation._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_null_passes(self):
|
||||
# ignores null
|
||||
PatternValidation._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_floats_passes(self):
|
||||
# ignores floats
|
||||
PatternValidation._from_openapi_data(
|
||||
1.0,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_non_matching_pattern_is_invalid_fails(self):
|
||||
# a non-matching pattern is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
PatternValidation._from_openapi_data(
|
||||
"abc",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_booleans_passes(self):
|
||||
# ignores booleans
|
||||
PatternValidation._from_openapi_data(
|
||||
True,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_matching_pattern_is_valid_passes(self):
|
||||
# a matching pattern is valid
|
||||
PatternValidation._from_openapi_data(
|
||||
"aaa",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_integers_passes(self):
|
||||
# ignores integers
|
||||
PatternValidation._from_openapi_data(
|
||||
123,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,66 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.properties_with_escaped_characters import PropertiesWithEscapedCharacters
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestPropertiesWithEscapedCharacters(unittest.TestCase):
|
||||
"""PropertiesWithEscapedCharacters unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_object_with_all_numbers_is_valid_passes(self):
|
||||
# object with all numbers is valid
|
||||
PropertiesWithEscapedCharacters._from_openapi_data(
|
||||
{
|
||||
"foo\nbar":
|
||||
1,
|
||||
"foo\"bar":
|
||||
1,
|
||||
"foo\\bar":
|
||||
1,
|
||||
"foo\rbar":
|
||||
1,
|
||||
"foo\tbar":
|
||||
1,
|
||||
"foo\fbar":
|
||||
1,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_object_with_strings_is_invalid_fails(self):
|
||||
# object with strings is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
PropertiesWithEscapedCharacters._from_openapi_data(
|
||||
{
|
||||
"foo\nbar":
|
||||
"1",
|
||||
"foo\"bar":
|
||||
"1",
|
||||
"foo\\bar":
|
||||
"1",
|
||||
"foo\rbar":
|
||||
"1",
|
||||
"foo\tbar":
|
||||
"1",
|
||||
"foo\fbar":
|
||||
"1",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,46 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestPropertyNamedRefThatIsNotAReference(unittest.TestCase):
|
||||
"""PropertyNamedRefThatIsNotAReference unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_property_named_ref_valid_passes(self):
|
||||
# property named $ref valid
|
||||
PropertyNamedRefThatIsNotAReference._from_openapi_data(
|
||||
{
|
||||
"$ref":
|
||||
"a",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_property_named_ref_invalid_fails(self):
|
||||
# property named $ref invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
PropertyNamedRefThatIsNotAReference._from_openapi_data(
|
||||
{
|
||||
"$ref":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,52 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.ref_in_additionalproperties import RefInAdditionalproperties
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestRefInAdditionalproperties(unittest.TestCase):
|
||||
"""RefInAdditionalproperties unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_property_named_ref_valid_passes(self):
|
||||
# property named $ref valid
|
||||
RefInAdditionalproperties._from_openapi_data(
|
||||
{
|
||||
"someProp":
|
||||
{
|
||||
"$ref":
|
||||
"a",
|
||||
},
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_property_named_ref_invalid_fails(self):
|
||||
# property named $ref invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
RefInAdditionalproperties._from_openapi_data(
|
||||
{
|
||||
"someProp":
|
||||
{
|
||||
"$ref":
|
||||
2,
|
||||
},
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,46 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.ref_in_allof import RefInAllof
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestRefInAllof(unittest.TestCase):
|
||||
"""RefInAllof unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_property_named_ref_valid_passes(self):
|
||||
# property named $ref valid
|
||||
RefInAllof._from_openapi_data(
|
||||
{
|
||||
"$ref":
|
||||
"a",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_property_named_ref_invalid_fails(self):
|
||||
# property named $ref invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
RefInAllof._from_openapi_data(
|
||||
{
|
||||
"$ref":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,46 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.ref_in_anyof import RefInAnyof
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestRefInAnyof(unittest.TestCase):
|
||||
"""RefInAnyof unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_property_named_ref_valid_passes(self):
|
||||
# property named $ref valid
|
||||
RefInAnyof._from_openapi_data(
|
||||
{
|
||||
"$ref":
|
||||
"a",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_property_named_ref_invalid_fails(self):
|
||||
# property named $ref invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
RefInAnyof._from_openapi_data(
|
||||
{
|
||||
"$ref":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,50 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.ref_in_items import RefInItems
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestRefInItems(unittest.TestCase):
|
||||
"""RefInItems unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_property_named_ref_valid_passes(self):
|
||||
# property named $ref valid
|
||||
RefInItems._from_openapi_data(
|
||||
[
|
||||
{
|
||||
"$ref":
|
||||
"a",
|
||||
},
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_property_named_ref_invalid_fails(self):
|
||||
# property named $ref invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
RefInItems._from_openapi_data(
|
||||
[
|
||||
{
|
||||
"$ref":
|
||||
2,
|
||||
},
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,46 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.ref_in_oneof import RefInOneof
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestRefInOneof(unittest.TestCase):
|
||||
"""RefInOneof unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_property_named_ref_valid_passes(self):
|
||||
# property named $ref valid
|
||||
RefInOneof._from_openapi_data(
|
||||
{
|
||||
"$ref":
|
||||
"a",
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_property_named_ref_invalid_fails(self):
|
||||
# property named $ref invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
RefInOneof._from_openapi_data(
|
||||
{
|
||||
"$ref":
|
||||
2,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,52 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.ref_in_property import RefInProperty
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestRefInProperty(unittest.TestCase):
|
||||
"""RefInProperty unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_property_named_ref_valid_passes(self):
|
||||
# property named $ref valid
|
||||
RefInProperty._from_openapi_data(
|
||||
{
|
||||
"a":
|
||||
{
|
||||
"$ref":
|
||||
"a",
|
||||
},
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_property_named_ref_invalid_fails(self):
|
||||
# property named $ref invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
RefInProperty._from_openapi_data(
|
||||
{
|
||||
"a":
|
||||
{
|
||||
"$ref":
|
||||
2,
|
||||
},
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,33 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.required_default_validation import RequiredDefaultValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestRequiredDefaultValidation(unittest.TestCase):
|
||||
"""RequiredDefaultValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_not_required_by_default_passes(self):
|
||||
# not required by default
|
||||
RequiredDefaultValidation._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,68 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.required_validation import RequiredValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestRequiredValidation(unittest.TestCase):
|
||||
"""RequiredValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_ignores_arrays_passes(self):
|
||||
# ignores arrays
|
||||
RequiredValidation._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_present_required_property_is_valid_passes(self):
|
||||
# present required property is valid
|
||||
RequiredValidation._from_openapi_data(
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_other_non_objects_passes(self):
|
||||
# ignores other non-objects
|
||||
RequiredValidation._from_openapi_data(
|
||||
12,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_ignores_strings_passes(self):
|
||||
# ignores strings
|
||||
RequiredValidation._from_openapi_data(
|
||||
"",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_non_present_required_property_is_invalid_fails(self):
|
||||
# non-present required property is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
RequiredValidation._from_openapi_data(
|
||||
{
|
||||
"bar":
|
||||
1,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,33 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.required_with_empty_array import RequiredWithEmptyArray
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestRequiredWithEmptyArray(unittest.TestCase):
|
||||
"""RequiredWithEmptyArray unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_property_not_required_passes(self):
|
||||
# property not required
|
||||
RequiredWithEmptyArray._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.simple_enum_validation import SimpleEnumValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestSimpleEnumValidation(unittest.TestCase):
|
||||
"""SimpleEnumValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_something_else_is_invalid_fails(self):
|
||||
# something else is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
SimpleEnumValidation._from_openapi_data(
|
||||
4,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_one_of_the_enum_is_valid_passes(self):
|
||||
# one of the enum is valid
|
||||
SimpleEnumValidation._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,96 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.string_type_matches_strings import StringTypeMatchesStrings
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestStringTypeMatchesStrings(unittest.TestCase):
|
||||
"""StringTypeMatchesStrings unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_1_is_not_a_string_fails(self):
|
||||
# 1 is not a string
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
StringTypeMatchesStrings._from_openapi_data(
|
||||
1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_string_is_still_a_string_even_if_it_looks_like_a_number_passes(self):
|
||||
# a string is still a string, even if it looks like a number
|
||||
StringTypeMatchesStrings._from_openapi_data(
|
||||
"1",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_empty_string_is_still_a_string_passes(self):
|
||||
# an empty string is still a string
|
||||
StringTypeMatchesStrings._from_openapi_data(
|
||||
"",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_float_is_not_a_string_fails(self):
|
||||
# a float is not a string
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
StringTypeMatchesStrings._from_openapi_data(
|
||||
1.1,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_object_is_not_a_string_fails(self):
|
||||
# an object is not a string
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
StringTypeMatchesStrings._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_array_is_not_a_string_fails(self):
|
||||
# an array is not a string
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
StringTypeMatchesStrings._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_boolean_is_not_a_string_fails(self):
|
||||
# a boolean is not a string
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
StringTypeMatchesStrings._from_openapi_data(
|
||||
True,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_null_is_not_a_string_fails(self):
|
||||
# null is not a string
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
StringTypeMatchesStrings._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_string_is_a_string_passes(self):
|
||||
# a string is a string
|
||||
StringTypeMatchesStrings._from_openapi_data(
|
||||
"foo",
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,54 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.the_default_keyword_does_not_do_anything_if_the_property_is_missing import TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestTheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing(unittest.TestCase):
|
||||
"""TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_missing_properties_are_not_filled_in_with_the_default_passes(self):
|
||||
# missing properties are not filled in with the default
|
||||
TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_explicit_property_value_is_checked_against_maximum_passing_passes(self):
|
||||
# an explicit property value is checked against maximum (passing)
|
||||
TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing._from_openapi_data(
|
||||
{
|
||||
"alpha":
|
||||
1,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_an_explicit_property_value_is_checked_against_maximum_failing_fails(self):
|
||||
# an explicit property value is checked against maximum (failing)
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
TheDefaultKeywordDoesNotDoAnythingIfThePropertyIsMissing._from_openapi_data(
|
||||
{
|
||||
"alpha":
|
||||
5,
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,246 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.uniqueitems_false_validation import UniqueitemsFalseValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestUniqueitemsFalseValidation(unittest.TestCase):
|
||||
"""UniqueitemsFalseValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_non_unique_array_of_integers_is_valid_passes(self):
|
||||
# non-unique array of integers is valid
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
1,
|
||||
1,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_unique_array_of_objects_is_valid_passes(self):
|
||||
# unique array of objects is valid
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
"foo":
|
||||
"bar",
|
||||
},
|
||||
{
|
||||
"foo":
|
||||
"baz",
|
||||
},
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_non_unique_array_of_nested_objects_is_valid_passes(self):
|
||||
# non-unique array of nested objects is valid
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
"foo":
|
||||
{
|
||||
"bar":
|
||||
{
|
||||
"baz":
|
||||
True,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"foo":
|
||||
{
|
||||
"bar":
|
||||
{
|
||||
"baz":
|
||||
True,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_non_unique_array_of_objects_is_valid_passes(self):
|
||||
# non-unique array of objects is valid
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
"foo":
|
||||
"bar",
|
||||
},
|
||||
{
|
||||
"foo":
|
||||
"bar",
|
||||
},
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_1_and_true_are_unique_passes(self):
|
||||
# 1 and true are unique
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
1,
|
||||
True,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_unique_array_of_integers_is_valid_passes(self):
|
||||
# unique array of integers is valid
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
1,
|
||||
2,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_non_unique_array_of_arrays_is_valid_passes(self):
|
||||
# non-unique array of arrays is valid
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
[
|
||||
"foo",
|
||||
],
|
||||
[
|
||||
"foo",
|
||||
],
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_numbers_are_unique_if_mathematically_unequal_passes(self):
|
||||
# numbers are unique if mathematically unequal
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
1.0,
|
||||
1.0,
|
||||
1,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_false_is_not_equal_to_zero_passes(self):
|
||||
# false is not equal to zero
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
0,
|
||||
False,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_unique_array_of_nested_objects_is_valid_passes(self):
|
||||
# unique array of nested objects is valid
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
"foo":
|
||||
{
|
||||
"bar":
|
||||
{
|
||||
"baz":
|
||||
True,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"foo":
|
||||
{
|
||||
"bar":
|
||||
{
|
||||
"baz":
|
||||
False,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_0_and_false_are_unique_passes(self):
|
||||
# 0 and false are unique
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
0,
|
||||
False,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_unique_array_of_arrays_is_valid_passes(self):
|
||||
# unique array of arrays is valid
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
[
|
||||
"foo",
|
||||
],
|
||||
[
|
||||
"bar",
|
||||
],
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_true_is_not_equal_to_one_passes(self):
|
||||
# true is not equal to one
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
1,
|
||||
True,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_non_unique_heterogeneous_types_are_valid_passes(self):
|
||||
# non-unique heterogeneous types are valid
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
},
|
||||
[
|
||||
1,
|
||||
],
|
||||
True,
|
||||
None,
|
||||
{
|
||||
},
|
||||
1,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_unique_heterogeneous_types_are_valid_passes(self):
|
||||
# unique heterogeneous types are valid
|
||||
UniqueitemsFalseValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
},
|
||||
[
|
||||
1,
|
||||
],
|
||||
True,
|
||||
None,
|
||||
1,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,427 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.uniqueitems_validation import UniqueitemsValidation
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestUniqueitemsValidation(unittest.TestCase):
|
||||
"""UniqueitemsValidation unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_unique_array_of_objects_is_valid_passes(self):
|
||||
# unique array of objects is valid
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
"foo":
|
||||
"bar",
|
||||
},
|
||||
{
|
||||
"foo":
|
||||
"baz",
|
||||
},
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_true_and_a1_are_unique_passes(self):
|
||||
# {"a": true} and {"a": 1} are unique
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
"a":
|
||||
True,
|
||||
},
|
||||
{
|
||||
"a":
|
||||
1,
|
||||
},
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_non_unique_heterogeneous_types_are_invalid_fails(self):
|
||||
# non-unique heterogeneous types are invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
},
|
||||
[
|
||||
1,
|
||||
],
|
||||
True,
|
||||
None,
|
||||
{
|
||||
},
|
||||
1,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_nested0_and_false_are_unique_passes(self):
|
||||
# nested [0] and [false] are unique
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
[
|
||||
[
|
||||
0,
|
||||
],
|
||||
"foo",
|
||||
],
|
||||
[
|
||||
[
|
||||
False,
|
||||
],
|
||||
"foo",
|
||||
],
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_a_false_and_a0_are_unique_passes(self):
|
||||
# {"a": false} and {"a": 0} are unique
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
"a":
|
||||
False,
|
||||
},
|
||||
{
|
||||
"a":
|
||||
0,
|
||||
},
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_numbers_are_unique_if_mathematically_unequal_fails(self):
|
||||
# numbers are unique if mathematically unequal
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
1.0,
|
||||
1.0,
|
||||
1,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_false_is_not_equal_to_zero_passes(self):
|
||||
# false is not equal to zero
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
0,
|
||||
False,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_0_and_false_are_unique_passes(self):
|
||||
# [0] and [false] are unique
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
[
|
||||
0,
|
||||
],
|
||||
[
|
||||
False,
|
||||
],
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_unique_array_of_arrays_is_valid_passes(self):
|
||||
# unique array of arrays is valid
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
[
|
||||
"foo",
|
||||
],
|
||||
[
|
||||
"bar",
|
||||
],
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_non_unique_array_of_nested_objects_is_invalid_fails(self):
|
||||
# non-unique array of nested objects is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
"foo":
|
||||
{
|
||||
"bar":
|
||||
{
|
||||
"baz":
|
||||
True,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"foo":
|
||||
{
|
||||
"bar":
|
||||
{
|
||||
"baz":
|
||||
True,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_non_unique_array_of_more_than_two_integers_is_invalid_fails(self):
|
||||
# non-unique array of more than two integers is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_true_is_not_equal_to_one_passes(self):
|
||||
# true is not equal to one
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
1,
|
||||
True,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_objects_are_non_unique_despite_key_order_fails(self):
|
||||
# objects are non-unique despite key order
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
"a":
|
||||
1,
|
||||
"b":
|
||||
2,
|
||||
},
|
||||
{
|
||||
"b":
|
||||
2,
|
||||
"a":
|
||||
1,
|
||||
},
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_unique_array_of_strings_is_valid_passes(self):
|
||||
# unique array of strings is valid
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
"foo",
|
||||
"bar",
|
||||
"baz",
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_1_and_true_are_unique_passes(self):
|
||||
# [1] and [true] are unique
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
[
|
||||
1,
|
||||
],
|
||||
[
|
||||
True,
|
||||
],
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_different_objects_are_unique_passes(self):
|
||||
# different objects are unique
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
"a":
|
||||
1,
|
||||
"b":
|
||||
2,
|
||||
},
|
||||
{
|
||||
"a":
|
||||
2,
|
||||
"b":
|
||||
1,
|
||||
},
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_unique_array_of_integers_is_valid_passes(self):
|
||||
# unique array of integers is valid
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
1,
|
||||
2,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_non_unique_array_of_more_than_two_arrays_is_invalid_fails(self):
|
||||
# non-unique array of more than two arrays is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
[
|
||||
"foo",
|
||||
],
|
||||
[
|
||||
"bar",
|
||||
],
|
||||
[
|
||||
"foo",
|
||||
],
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_non_unique_array_of_objects_is_invalid_fails(self):
|
||||
# non-unique array of objects is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
"foo":
|
||||
"bar",
|
||||
},
|
||||
{
|
||||
"foo":
|
||||
"bar",
|
||||
},
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_unique_array_of_nested_objects_is_valid_passes(self):
|
||||
# unique array of nested objects is valid
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
"foo":
|
||||
{
|
||||
"bar":
|
||||
{
|
||||
"baz":
|
||||
True,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"foo":
|
||||
{
|
||||
"bar":
|
||||
{
|
||||
"baz":
|
||||
False,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_non_unique_array_of_arrays_is_invalid_fails(self):
|
||||
# non-unique array of arrays is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
[
|
||||
"foo",
|
||||
],
|
||||
[
|
||||
"foo",
|
||||
],
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_non_unique_array_of_strings_is_invalid_fails(self):
|
||||
# non-unique array of strings is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
"foo",
|
||||
"bar",
|
||||
"foo",
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_nested1_and_true_are_unique_passes(self):
|
||||
# nested [1] and [true] are unique
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
[
|
||||
[
|
||||
1,
|
||||
],
|
||||
"foo",
|
||||
],
|
||||
[
|
||||
[
|
||||
True,
|
||||
],
|
||||
"foo",
|
||||
],
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_unique_heterogeneous_types_are_valid_passes(self):
|
||||
# unique heterogeneous types are valid
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
{
|
||||
},
|
||||
[
|
||||
1,
|
||||
],
|
||||
True,
|
||||
None,
|
||||
1,
|
||||
"{}",
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_non_unique_array_of_integers_is_invalid_fails(self):
|
||||
# non-unique array of integers is invalid
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
UniqueitemsValidation._from_openapi_data(
|
||||
[
|
||||
1,
|
||||
1,
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,69 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.uri_format import UriFormat
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestUriFormat(unittest.TestCase):
|
||||
"""UriFormat unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_all_string_formats_ignore_objects_passes(self):
|
||||
# all string formats ignore objects
|
||||
UriFormat._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_booleans_passes(self):
|
||||
# all string formats ignore booleans
|
||||
UriFormat._from_openapi_data(
|
||||
False,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_integers_passes(self):
|
||||
# all string formats ignore integers
|
||||
UriFormat._from_openapi_data(
|
||||
12,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_floats_passes(self):
|
||||
# all string formats ignore floats
|
||||
UriFormat._from_openapi_data(
|
||||
13.7,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_arrays_passes(self):
|
||||
# all string formats ignore arrays
|
||||
UriFormat._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_nulls_passes(self):
|
||||
# all string formats ignore nulls
|
||||
UriFormat._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,69 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.uri_reference_format import UriReferenceFormat
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestUriReferenceFormat(unittest.TestCase):
|
||||
"""UriReferenceFormat unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_all_string_formats_ignore_objects_passes(self):
|
||||
# all string formats ignore objects
|
||||
UriReferenceFormat._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_booleans_passes(self):
|
||||
# all string formats ignore booleans
|
||||
UriReferenceFormat._from_openapi_data(
|
||||
False,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_integers_passes(self):
|
||||
# all string formats ignore integers
|
||||
UriReferenceFormat._from_openapi_data(
|
||||
12,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_floats_passes(self):
|
||||
# all string formats ignore floats
|
||||
UriReferenceFormat._from_openapi_data(
|
||||
13.7,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_arrays_passes(self):
|
||||
# all string formats ignore arrays
|
||||
UriReferenceFormat._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_nulls_passes(self):
|
||||
# all string formats ignore nulls
|
||||
UriReferenceFormat._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,69 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
openapi 3.0.3 sample spec
|
||||
|
||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.model.uri_template_format import UriTemplateFormat
|
||||
from unit_test_api import configuration
|
||||
|
||||
|
||||
class TestUriTemplateFormat(unittest.TestCase):
|
||||
"""UriTemplateFormat unit test stubs"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def test_all_string_formats_ignore_objects_passes(self):
|
||||
# all string formats ignore objects
|
||||
UriTemplateFormat._from_openapi_data(
|
||||
{
|
||||
},
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_booleans_passes(self):
|
||||
# all string formats ignore booleans
|
||||
UriTemplateFormat._from_openapi_data(
|
||||
False,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_integers_passes(self):
|
||||
# all string formats ignore integers
|
||||
UriTemplateFormat._from_openapi_data(
|
||||
12,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_floats_passes(self):
|
||||
# all string formats ignore floats
|
||||
UriTemplateFormat._from_openapi_data(
|
||||
13.7,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_arrays_passes(self):
|
||||
# all string formats ignore arrays
|
||||
UriTemplateFormat._from_openapi_data(
|
||||
[
|
||||
],
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
def test_all_string_formats_ignore_nulls_passes(self):
|
||||
# all string formats ignore nulls
|
||||
UriTemplateFormat._from_openapi_data(
|
||||
None,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,68 @@
|
||||
import json
|
||||
import typing
|
||||
|
||||
import urllib3
|
||||
from urllib3._collections import HTTPHeaderDict
|
||||
|
||||
|
||||
class ApiTestMixin:
|
||||
json_content_type = 'application/json'
|
||||
user_agent = 'OpenAPI-Generator/1.0.0/python'
|
||||
|
||||
@classmethod
|
||||
def assert_pool_manager_request_called_with(
|
||||
cls,
|
||||
mock_request,
|
||||
url: str,
|
||||
method: str = 'POST',
|
||||
body: typing.Optional[bytes] = None,
|
||||
content_type: typing.Optional[str] = None,
|
||||
accept_content_type: typing.Optional[str] = None,
|
||||
stream: bool = False,
|
||||
):
|
||||
headers = {
|
||||
'User-Agent': cls.user_agent
|
||||
}
|
||||
if accept_content_type:
|
||||
headers['Accept'] = accept_content_type
|
||||
if content_type:
|
||||
headers['Content-Type'] = content_type
|
||||
kwargs = dict(
|
||||
headers=HTTPHeaderDict(headers),
|
||||
preload_content=not stream,
|
||||
timeout=None,
|
||||
)
|
||||
if content_type and method != 'GET':
|
||||
kwargs['body'] = body
|
||||
mock_request.assert_called_with(
|
||||
method,
|
||||
url,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def headers_for_content_type(content_type: str) -> dict[str, str]:
|
||||
return {'content-type': content_type}
|
||||
|
||||
@classmethod
|
||||
def response(
|
||||
cls,
|
||||
body: typing.Union[str, bytes],
|
||||
status: int = 200,
|
||||
content_type: str = json_content_type,
|
||||
headers: typing.Optional[dict[str, str]] = None,
|
||||
preload_content: bool = True
|
||||
) -> urllib3.HTTPResponse:
|
||||
if headers is None:
|
||||
headers = {}
|
||||
headers.update(cls.headers_for_content_type(content_type))
|
||||
return urllib3.HTTPResponse(
|
||||
body,
|
||||
headers=headers,
|
||||
status=status,
|
||||
preload_content=preload_content
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def json_bytes(in_data: typing.Any) -> bytes:
|
||||
return json.dumps(in_data, separators=(",", ":"), ensure_ascii=False).encode('utf-8')
|
||||
@@ -0,0 +1,78 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import urllib3
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.paths.request_body_post_additionalproperties_are_allowed_by_default_request_body import post # noqa: E501
|
||||
from unit_test_api import configuration, schemas, api_client
|
||||
|
||||
from .. import ApiTestMixin
|
||||
|
||||
|
||||
class TestRequestBodyPostAdditionalpropertiesAreAllowedByDefaultRequestBody(ApiTestMixin, unittest.TestCase):
|
||||
"""
|
||||
RequestBodyPostAdditionalpropertiesAreAllowedByDefaultRequestBody unit test stubs
|
||||
"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def setUp(self):
|
||||
used_api_client = api_client.ApiClient(configuration=self._configuration)
|
||||
self.api = post.ApiForpost(api_client=used_api_client) # noqa: E501
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
response_status = 200
|
||||
response_body = ''
|
||||
|
||||
def test_additional_properties_are_allowed_passes(self):
|
||||
content_type = 'application/json'
|
||||
# additional properties are allowed
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
"bar":
|
||||
2,
|
||||
"quux":
|
||||
True,
|
||||
}
|
||||
)
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
mock_request.return_value = self.response(
|
||||
self.json_bytes(self.response_body),
|
||||
status=self.response_status
|
||||
)
|
||||
api_response = self.api.post(
|
||||
body=body,
|
||||
content_type=content_type
|
||||
)
|
||||
self.assert_pool_manager_request_called_with(
|
||||
mock_request,
|
||||
self._configuration.host + '/requestBody/postAdditionalpropertiesAreAllowedByDefaultRequestBody',
|
||||
method='post'.upper(),
|
||||
body=self.json_bytes(payload),
|
||||
content_type=content_type,
|
||||
)
|
||||
|
||||
assert isinstance(api_response.response, urllib3.HTTPResponse)
|
||||
assert isinstance(api_response.body, schemas.Unset)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import urllib3
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.paths.request_body_post_additionalproperties_can_exist_by_itself_request_body import post # noqa: E501
|
||||
from unit_test_api import configuration, schemas, api_client
|
||||
|
||||
from .. import ApiTestMixin
|
||||
|
||||
|
||||
class TestRequestBodyPostAdditionalpropertiesCanExistByItselfRequestBody(ApiTestMixin, unittest.TestCase):
|
||||
"""
|
||||
RequestBodyPostAdditionalpropertiesCanExistByItselfRequestBody unit test stubs
|
||||
"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def setUp(self):
|
||||
used_api_client = api_client.ApiClient(configuration=self._configuration)
|
||||
self.api = post.ApiForpost(api_client=used_api_client) # noqa: E501
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
response_status = 200
|
||||
response_body = ''
|
||||
|
||||
def test_an_additional_invalid_property_is_invalid_fails(self):
|
||||
content_type = 'application/json'
|
||||
# an additional invalid property is invalid
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
}
|
||||
)
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
self.api.post(body=body)
|
||||
|
||||
def test_an_additional_valid_property_is_valid_passes(self):
|
||||
content_type = 'application/json'
|
||||
# an additional valid property is valid
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
{
|
||||
"foo":
|
||||
True,
|
||||
}
|
||||
)
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
mock_request.return_value = self.response(
|
||||
self.json_bytes(self.response_body),
|
||||
status=self.response_status
|
||||
)
|
||||
api_response = self.api.post(
|
||||
body=body,
|
||||
content_type=content_type
|
||||
)
|
||||
self.assert_pool_manager_request_called_with(
|
||||
mock_request,
|
||||
self._configuration.host + '/requestBody/postAdditionalpropertiesCanExistByItselfRequestBody',
|
||||
method='post'.upper(),
|
||||
body=self.json_bytes(payload),
|
||||
content_type=content_type,
|
||||
)
|
||||
|
||||
assert isinstance(api_response.response, urllib3.HTTPResponse)
|
||||
assert isinstance(api_response.body, schemas.Unset)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,95 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import urllib3
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.paths.request_body_post_additionalproperties_should_not_look_in_applicators_request_body import post # noqa: E501
|
||||
from unit_test_api import configuration, schemas, api_client
|
||||
|
||||
from .. import ApiTestMixin
|
||||
|
||||
|
||||
class TestRequestBodyPostAdditionalpropertiesShouldNotLookInApplicatorsRequestBody(ApiTestMixin, unittest.TestCase):
|
||||
"""
|
||||
RequestBodyPostAdditionalpropertiesShouldNotLookInApplicatorsRequestBody unit test stubs
|
||||
"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def setUp(self):
|
||||
used_api_client = api_client.ApiClient(configuration=self._configuration)
|
||||
self.api = post.ApiForpost(api_client=used_api_client) # noqa: E501
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
response_status = 200
|
||||
response_body = ''
|
||||
|
||||
def test_properties_defined_in_allof_are_not_examined_fails(self):
|
||||
content_type = 'application/json'
|
||||
# properties defined in allOf are not examined
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
{
|
||||
"foo":
|
||||
1,
|
||||
"bar":
|
||||
True,
|
||||
}
|
||||
)
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
self.api.post(body=body)
|
||||
|
||||
def test_valid_test_case_passes(self):
|
||||
content_type = 'application/json'
|
||||
# valid test case
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
{
|
||||
"foo":
|
||||
False,
|
||||
"bar":
|
||||
True,
|
||||
}
|
||||
)
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
mock_request.return_value = self.response(
|
||||
self.json_bytes(self.response_body),
|
||||
status=self.response_status
|
||||
)
|
||||
api_response = self.api.post(
|
||||
body=body,
|
||||
content_type=content_type
|
||||
)
|
||||
self.assert_pool_manager_request_called_with(
|
||||
mock_request,
|
||||
self._configuration.host + '/requestBody/postAdditionalpropertiesShouldNotLookInApplicatorsRequestBody',
|
||||
method='post'.upper(),
|
||||
body=self.json_bytes(payload),
|
||||
content_type=content_type,
|
||||
)
|
||||
|
||||
assert isinstance(api_response.response, urllib3.HTTPResponse)
|
||||
assert isinstance(api_response.body, schemas.Unset)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,85 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import urllib3
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.paths.request_body_post_allof_simple_types_request_body import post # noqa: E501
|
||||
from unit_test_api import configuration, schemas, api_client
|
||||
|
||||
from .. import ApiTestMixin
|
||||
|
||||
|
||||
class TestRequestBodyPostAllofSimpleTypesRequestBody(ApiTestMixin, unittest.TestCase):
|
||||
"""
|
||||
RequestBodyPostAllofSimpleTypesRequestBody unit test stubs
|
||||
"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def setUp(self):
|
||||
used_api_client = api_client.ApiClient(configuration=self._configuration)
|
||||
self.api = post.ApiForpost(api_client=used_api_client) # noqa: E501
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
response_status = 200
|
||||
response_body = ''
|
||||
|
||||
def test_valid_passes(self):
|
||||
content_type = 'application/json'
|
||||
# valid
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
25
|
||||
)
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
mock_request.return_value = self.response(
|
||||
self.json_bytes(self.response_body),
|
||||
status=self.response_status
|
||||
)
|
||||
api_response = self.api.post(
|
||||
body=body,
|
||||
content_type=content_type
|
||||
)
|
||||
self.assert_pool_manager_request_called_with(
|
||||
mock_request,
|
||||
self._configuration.host + '/requestBody/postAllofSimpleTypesRequestBody',
|
||||
method='post'.upper(),
|
||||
body=self.json_bytes(payload),
|
||||
content_type=content_type,
|
||||
)
|
||||
|
||||
assert isinstance(api_response.response, urllib3.HTTPResponse)
|
||||
assert isinstance(api_response.body, schemas.Unset)
|
||||
|
||||
def test_mismatch_one_fails(self):
|
||||
content_type = 'application/json'
|
||||
# mismatch one
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
35
|
||||
)
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
self.api.post(body=body)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,152 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import urllib3
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.paths.request_body_post_allof_with_base_schema_request_body import post # noqa: E501
|
||||
from unit_test_api import configuration, schemas, api_client
|
||||
|
||||
from .. import ApiTestMixin
|
||||
|
||||
|
||||
class TestRequestBodyPostAllofWithBaseSchemaRequestBody(ApiTestMixin, unittest.TestCase):
|
||||
"""
|
||||
RequestBodyPostAllofWithBaseSchemaRequestBody unit test stubs
|
||||
"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def setUp(self):
|
||||
used_api_client = api_client.ApiClient(configuration=self._configuration)
|
||||
self.api = post.ApiForpost(api_client=used_api_client) # noqa: E501
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
response_status = 200
|
||||
response_body = ''
|
||||
|
||||
def test_valid_passes(self):
|
||||
content_type = 'application/json'
|
||||
# valid
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
{
|
||||
"foo":
|
||||
"quux",
|
||||
"bar":
|
||||
2,
|
||||
"baz":
|
||||
None,
|
||||
}
|
||||
)
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
mock_request.return_value = self.response(
|
||||
self.json_bytes(self.response_body),
|
||||
status=self.response_status
|
||||
)
|
||||
api_response = self.api.post(
|
||||
body=body,
|
||||
content_type=content_type
|
||||
)
|
||||
self.assert_pool_manager_request_called_with(
|
||||
mock_request,
|
||||
self._configuration.host + '/requestBody/postAllofWithBaseSchemaRequestBody',
|
||||
method='post'.upper(),
|
||||
body=self.json_bytes(payload),
|
||||
content_type=content_type,
|
||||
)
|
||||
|
||||
assert isinstance(api_response.response, urllib3.HTTPResponse)
|
||||
assert isinstance(api_response.body, schemas.Unset)
|
||||
|
||||
def test_mismatch_first_allof_fails(self):
|
||||
content_type = 'application/json'
|
||||
# mismatch first allOf
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
{
|
||||
"bar":
|
||||
2,
|
||||
"baz":
|
||||
None,
|
||||
}
|
||||
)
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
self.api.post(body=body)
|
||||
|
||||
def test_mismatch_base_schema_fails(self):
|
||||
content_type = 'application/json'
|
||||
# mismatch base schema
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
{
|
||||
"foo":
|
||||
"quux",
|
||||
"baz":
|
||||
None,
|
||||
}
|
||||
)
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
self.api.post(body=body)
|
||||
|
||||
def test_mismatch_both_fails(self):
|
||||
content_type = 'application/json'
|
||||
# mismatch both
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
{
|
||||
"bar":
|
||||
2,
|
||||
}
|
||||
)
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
self.api.post(body=body)
|
||||
|
||||
def test_mismatch_second_allof_fails(self):
|
||||
content_type = 'application/json'
|
||||
# mismatch second allOf
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
{
|
||||
"foo":
|
||||
"quux",
|
||||
"bar":
|
||||
2,
|
||||
}
|
||||
)
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
self.api.post(body=body)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,161 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import urllib3
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.paths.request_body_post_anyof_complex_types_request_body import post # noqa: E501
|
||||
from unit_test_api import configuration, schemas, api_client
|
||||
|
||||
from .. import ApiTestMixin
|
||||
|
||||
|
||||
class TestRequestBodyPostAnyofComplexTypesRequestBody(ApiTestMixin, unittest.TestCase):
|
||||
"""
|
||||
RequestBodyPostAnyofComplexTypesRequestBody unit test stubs
|
||||
"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def setUp(self):
|
||||
used_api_client = api_client.ApiClient(configuration=self._configuration)
|
||||
self.api = post.ApiForpost(api_client=used_api_client) # noqa: E501
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
response_status = 200
|
||||
response_body = ''
|
||||
|
||||
def test_second_anyof_valid_complex_passes(self):
|
||||
content_type = 'application/json'
|
||||
# second anyOf valid (complex)
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
{
|
||||
"foo":
|
||||
"baz",
|
||||
}
|
||||
)
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
mock_request.return_value = self.response(
|
||||
self.json_bytes(self.response_body),
|
||||
status=self.response_status
|
||||
)
|
||||
api_response = self.api.post(
|
||||
body=body,
|
||||
content_type=content_type
|
||||
)
|
||||
self.assert_pool_manager_request_called_with(
|
||||
mock_request,
|
||||
self._configuration.host + '/requestBody/postAnyofComplexTypesRequestBody',
|
||||
method='post'.upper(),
|
||||
body=self.json_bytes(payload),
|
||||
content_type=content_type,
|
||||
)
|
||||
|
||||
assert isinstance(api_response.response, urllib3.HTTPResponse)
|
||||
assert isinstance(api_response.body, schemas.Unset)
|
||||
|
||||
def test_neither_anyof_valid_complex_fails(self):
|
||||
content_type = 'application/json'
|
||||
# neither anyOf valid (complex)
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
{
|
||||
"foo":
|
||||
2,
|
||||
"bar":
|
||||
"quux",
|
||||
}
|
||||
)
|
||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
self.api.post(body=body)
|
||||
|
||||
def test_both_anyof_valid_complex_passes(self):
|
||||
content_type = 'application/json'
|
||||
# both anyOf valid (complex)
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
{
|
||||
"foo":
|
||||
"baz",
|
||||
"bar":
|
||||
2,
|
||||
}
|
||||
)
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
mock_request.return_value = self.response(
|
||||
self.json_bytes(self.response_body),
|
||||
status=self.response_status
|
||||
)
|
||||
api_response = self.api.post(
|
||||
body=body,
|
||||
content_type=content_type
|
||||
)
|
||||
self.assert_pool_manager_request_called_with(
|
||||
mock_request,
|
||||
self._configuration.host + '/requestBody/postAnyofComplexTypesRequestBody',
|
||||
method='post'.upper(),
|
||||
body=self.json_bytes(payload),
|
||||
content_type=content_type,
|
||||
)
|
||||
|
||||
assert isinstance(api_response.response, urllib3.HTTPResponse)
|
||||
assert isinstance(api_response.body, schemas.Unset)
|
||||
|
||||
def test_first_anyof_valid_complex_passes(self):
|
||||
content_type = 'application/json'
|
||||
# first anyOf valid (complex)
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
{
|
||||
"bar":
|
||||
2,
|
||||
}
|
||||
)
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
mock_request.return_value = self.response(
|
||||
self.json_bytes(self.response_body),
|
||||
status=self.response_status
|
||||
)
|
||||
api_response = self.api.post(
|
||||
body=body,
|
||||
content_type=content_type
|
||||
)
|
||||
self.assert_pool_manager_request_called_with(
|
||||
mock_request,
|
||||
self._configuration.host + '/requestBody/postAnyofComplexTypesRequestBody',
|
||||
method='post'.upper(),
|
||||
body=self.json_bytes(payload),
|
||||
content_type=content_type,
|
||||
)
|
||||
|
||||
assert isinstance(api_response.response, urllib3.HTTPResponse)
|
||||
assert isinstance(api_response.body, schemas.Unset)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,101 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
import urllib3
|
||||
|
||||
import unit_test_api
|
||||
from unit_test_api.paths.request_body_post_anyof_with_one_empty_schema_request_body import post # noqa: E501
|
||||
from unit_test_api import configuration, schemas, api_client
|
||||
|
||||
from .. import ApiTestMixin
|
||||
|
||||
|
||||
class TestRequestBodyPostAnyofWithOneEmptySchemaRequestBody(ApiTestMixin, unittest.TestCase):
|
||||
"""
|
||||
RequestBodyPostAnyofWithOneEmptySchemaRequestBody unit test stubs
|
||||
"""
|
||||
_configuration = configuration.Configuration()
|
||||
|
||||
def setUp(self):
|
||||
used_api_client = api_client.ApiClient(configuration=self._configuration)
|
||||
self.api = post.ApiForpost(api_client=used_api_client) # noqa: E501
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
response_status = 200
|
||||
response_body = ''
|
||||
|
||||
def test_string_is_valid_passes(self):
|
||||
content_type = 'application/json'
|
||||
# string is valid
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
"foo"
|
||||
)
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
mock_request.return_value = self.response(
|
||||
self.json_bytes(self.response_body),
|
||||
status=self.response_status
|
||||
)
|
||||
api_response = self.api.post(
|
||||
body=body,
|
||||
content_type=content_type
|
||||
)
|
||||
self.assert_pool_manager_request_called_with(
|
||||
mock_request,
|
||||
self._configuration.host + '/requestBody/postAnyofWithOneEmptySchemaRequestBody',
|
||||
method='post'.upper(),
|
||||
body=self.json_bytes(payload),
|
||||
content_type=content_type,
|
||||
)
|
||||
|
||||
assert isinstance(api_response.response, urllib3.HTTPResponse)
|
||||
assert isinstance(api_response.body, schemas.Unset)
|
||||
|
||||
def test_number_is_valid_passes(self):
|
||||
content_type = 'application/json'
|
||||
# number is valid
|
||||
with patch.object(urllib3.PoolManager, 'request') as mock_request:
|
||||
payload = (
|
||||
123
|
||||
)
|
||||
body = post.SchemaForRequestBodyApplicationJson._from_openapi_data(
|
||||
payload,
|
||||
_configuration=self._configuration
|
||||
)
|
||||
mock_request.return_value = self.response(
|
||||
self.json_bytes(self.response_body),
|
||||
status=self.response_status
|
||||
)
|
||||
api_response = self.api.post(
|
||||
body=body,
|
||||
content_type=content_type
|
||||
)
|
||||
self.assert_pool_manager_request_called_with(
|
||||
mock_request,
|
||||
self._configuration.host + '/requestBody/postAnyofWithOneEmptySchemaRequestBody',
|
||||
method='post'.upper(),
|
||||
body=self.json_bytes(payload),
|
||||
content_type=content_type,
|
||||
)
|
||||
|
||||
assert isinstance(api_response.response, urllib3.HTTPResponse)
|
||||
assert isinstance(api_response.body, schemas.Unset)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user