Commit 37402bdf authored by Spiros Koulouzis's avatar Spiros Koulouzis

this deserialize_model error keeps happening no idea why

parent 0d49ba8c
......@@ -115,8 +115,8 @@ def node_dict_2_node_template(node_name, node_dict, all_custom_def):
# node_dict[node_name].pop(name_to_remove)
node_template = NodeTemplate(node_name, node_templates=copy.deepcopy(node_dict), custom_def=all_custom_def)
# For some reason the tosca.nodes.ARTICONF.Orchestrator doesn't have all definitions so we need to add them
# manually. We get 'toscaparser.common.exception.InvalidTypeError: Type "tosca.nodes.ARTICONF.Orchestrator"
# For some reason the tosca.nodes.QC.Orchestrator doesn't have all definitions so we need to add them
# manually. We get 'toscaparser.common.exception.InvalidTypeError: Type "tosca.nodes.QC.Orchestrator"
# is not a valid type.'
if len(node_template.custom_def) < len(all_custom_def):
for def_key in all_custom_def:
......@@ -144,8 +144,8 @@ def node_type_2_node_template(node_type, all_custom_def):
node_type[next(iter(node_type))].pop('type')
node_template = NodeTemplate(name, node_template_dict, node_type)
# For some reason the tosca.nodes.ARTICONF.Orchestrator doesn't have all definitions so we need to add them
# manually. We get 'toscaparser.common.exception.InvalidTypeError: Type "tosca.nodes.ARTICONF.Orchestrator"
# For some reason the tosca.nodes.QC.Orchestrator doesn't have all definitions so we need to add them
# manually. We get 'toscaparser.common.exception.InvalidTypeError: Type "tosca.nodes.QC.Orchestrator"
# is not a valid type.'
if len(node_template.custom_def) < len(all_custom_def):
for def_key in all_custom_def:
......
......@@ -169,7 +169,7 @@ class TestDefaultController(BaseTestCase):
self.assertEqual(response.status_code, 200)
self.assertIsInstance(response.json, list)
query_string = [('type_name', 'tosca.nodes.ARTICONF.Container.Application.Docker'),
query_string = [('type_name', 'tosca.nodes.QC.Container.Application.Docker'),
('node_name', None),
('has_interfaces', None),
('has_properties', None),
......@@ -185,7 +185,7 @@ class TestDefaultController(BaseTestCase):
self.assertEqual(response.status_code, 200)
self.assertIsInstance(response.json, list)
query_string = [('type_name', 'tosca.nodes.ARTICONF.Application'),
query_string = [('type_name', 'tosca.nodes.QC.Application'),
('node_name', None),
('has_interfaces', True),
('has_properties', None),
......@@ -298,7 +298,7 @@ class TestDefaultController(BaseTestCase):
self.assertTrue(id_example.strip().isdigit())
query_string = [('kind_of_type', 'interface_types'),
('has_interfaces', None),
('type_name', 'tosca.interfaces.ARTICONF.CloudsStorm'),
('type_name', 'tosca.interfaces.QC.CloudsStorm'),
('has_properties', None),
('has_attributes', None),
('has_requirements', None),
......@@ -376,7 +376,7 @@ class TestDefaultController(BaseTestCase):
('operation_name', 'provision')]
response = self.client.open(
'/tosca-sure/1.0.0/tosca_template/{id}/interface/{interface_type}/default'.format(id=id_example,
interface_type='tosca.interfaces.ARTICONF.CloudsStorm'),
interface_type='tosca.interfaces.QC.CloudsStorm'),
method='GET',
query_string=query_string)
self.assertTrue(response.is_json)
......
......@@ -23,11 +23,16 @@ def _deserialize(data, klass):
return deserialize_date(data)
elif klass == datetime.datetime:
return deserialize_datetime(data)
elif hasattr(klass, '__origin__'):
if klass.__origin__ == list:
elif type(klass) == typing.GenericMeta:
if klass.__extra__ == list:
return _deserialize_list(data, klass.__args__[0])
if klass.__origin__ == dict:
if klass.__extra__ == dict:
return _deserialize_dict(data, klass.__args__[1])
# elif hasattr(klass, '__origin__'):
# if klass.__origin__ == list:
# return _deserialize_list(data, klass.__args__[0])
# if klass.__origin__ == dict:
# return _deserialize_dict(data, klass.__args__[1])
else:
return deserialize_model(data, klass)
......@@ -127,6 +132,8 @@ def deserialize_model(data, klass):
return data
for attr, attr_type in six.iteritems(instance.swagger_types):
# print(attr)
# print(attr_type)
if data is not None and isinstance(data, (list, dict)):
value = None
if instance.attribute_map[attr] in data:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment