diff options
Diffstat (limited to 'app/tests')
-rw-r--r-- | app/tests/test_node_templates.py | 34 | ||||
-rw-r--r-- | app/tests/test_value_templates.py | 23 |
2 files changed, 27 insertions, 30 deletions
diff --git a/app/tests/test_node_templates.py b/app/tests/test_node_templates.py index 15d5480..2d79b95 100644 --- a/app/tests/test_node_templates.py +++ b/app/tests/test_node_templates.py @@ -20,25 +20,23 @@ class TestNodeTemplateMethods(unittest.TestCase): node._parse_pre_defined_content(prop_sec) self.assertEqual('template_value', node.properties.get('propertyName').value.value) - # TODO uncomment after merging ecomp latest code - # def test_update_get_node_name_property_value(self): - # template = init_template() - # node = Node(template, 'myNode', template.db.NODE_TYPES.get('nodeTypeName')) - # prop_sec = {'properties': {'propertyName': '__GET_NODE_NAME__'}} - # node._parse_pre_defined_content(prop_sec) - # self.assertEqual('__GET_NODE_NAME__', node.properties.get('propertyName').value.value) - # node._update_get_node_name() - # self.assertEqual('myNode', node.properties.get('propertyName').value.value) + def test_update_get_node_name_property_value(self): + template = init_template() + node = Node(template, 'myNode', template.db.NODE_TYPES.get('nodeTypeName')) + prop_sec = {'properties': {'propertyName': '__GET_NODE_NAME__'}} + node._parse_pre_defined_content(prop_sec) + self.assertEqual('__GET_NODE_NAME__', node.properties.get('propertyName').value.value) + node._update_get_node_name() + self.assertEqual('myNode', node.properties.get('propertyName').value.value) - # TODO uncomment after merging ecomp latest code - # def test_update_get_node_name_capability_property_value(self): - # template = init_template() - # node = Node(template, 'myNode', template.db.NODE_TYPES.get('nodeTypeName')) - # prop_sec = {'capabilities': {'capabilityName': {'properties': {'capabilityProperty': '__GET_NODE_NAME__'}}}} - # node._parse_pre_defined_content(prop_sec) - # self.assertEqual('__GET_NODE_NAME__', node._get_capability_property('capabilityName', 'capabilityProperty').value.value) - # node._update_get_node_name() - # self.assertEqual('myNode', node._get_capability_property('capabilityName', 'capabilityProperty').value.value) + def test_update_get_node_name_capability_property_value(self): + template = init_template() + node = Node(template, 'myNode', template.db.NODE_TYPES.get('nodeTypeName')) + prop_sec = {'capabilities': {'capabilityName': {'properties': {'capabilityProperty': '__GET_NODE_NAME__'}}}} + node._parse_pre_defined_content(prop_sec) + self.assertEqual('__GET_NODE_NAME__', node._get_capability_property('capabilityName', 'capabilityProperty').value.value) + node._update_get_node_name() + self.assertEqual('myNode', node._get_capability_property('capabilityName', 'capabilityProperty').value.value) def test_update_prefix(self): template = init_template() diff --git a/app/tests/test_value_templates.py b/app/tests/test_value_templates.py index bc98fa8..7ebe95d 100644 --- a/app/tests/test_value_templates.py +++ b/app/tests/test_value_templates.py @@ -79,18 +79,17 @@ class TestValueMethods(unittest.TestCase): res._update_function_reference(template) self.assertEqual(res.value_from_item, template.inputs.get('inputName')) - # TODO uncomment after merging latest ecomp code - # def test_update_get_input_function_reference_auto_generate_input(self): - # template = init_template() - # node = template.node_dict.get('nodeName') - # value = {'get_input': 'propertyName'} - # res = _is_function(value) - # self.assertIsNone(res.value_from_item) - # self.assertIsNone(template.inputs.get('nodeName_propertyName')) - # self.assertEqual(res.target_property, 'propertyName') - # res._update_function_reference(template, node, node.properties.get('propertyName')) - # self.assertIsNotNone(res.value_from_item) - # self.assertEqual(res.value_from_item, template.inputs.get('nodeName_propertyName')) + def test_update_get_input_function_reference_auto_generate_input(self): + template = init_template() + node = template.node_dict.get('nodeName') + value = {'get_input': 'propertyName'} + res = _is_function(value) + self.assertIsNone(res.value_from_item) + self.assertIsNone(template.inputs.get('nodeName_propertyName')) + self.assertEqual(res.target_property, 'propertyName') + res._update_function_reference(template, node, node.properties.get('propertyName')) + self.assertIsNotNone(res.value_from_item) + self.assertEqual(res.value_from_item, template.inputs.get('nodeName_propertyName')) def test_update_get_property_function_reference_node_not_found(self): value = {'get_property': ['node_name', 'property_name']} |