summaryrefslogtreecommitdiffstats
path: root/tosca2heat/tosca-parser/toscaparser/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tosca2heat/tosca-parser/toscaparser/tests')
-rw-r--r--tosca2heat/tosca-parser/toscaparser/tests/data/topology_template/subsystem.yaml3
-rw-r--r--tosca2heat/tosca-parser/toscaparser/tests/test_topology_template.py5
-rw-r--r--tosca2heat/tosca-parser/toscaparser/tests/test_toscadef.py9
-rw-r--r--tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py6
4 files changed, 19 insertions, 4 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/tests/data/topology_template/subsystem.yaml b/tosca2heat/tosca-parser/toscaparser/tests/data/topology_template/subsystem.yaml
index b27e698..99d645b 100644
--- a/tosca2heat/tosca-parser/toscaparser/tests/data/topology_template/subsystem.yaml
+++ b/tosca2heat/tosca-parser/toscaparser/tests/data/topology_template/subsystem.yaml
@@ -12,12 +12,15 @@ topology_template:
inputs:
mq_server_ip:
type: string
+ required: true
description: IP address of the message queuing server to receive messages from.
receiver_port:
type: string
+ required: true
description: Port to be used for receiving messages.
my_cpus:
type: integer
+ default: 2
description: Number of CPUs for the server.
constraints:
- valid_values: [ 1, 2, 4, 8 ]
diff --git a/tosca2heat/tosca-parser/toscaparser/tests/test_topology_template.py b/tosca2heat/tosca-parser/toscaparser/tests/test_topology_template.py
index 0f1a33e..cbd4e3b 100644
--- a/tosca2heat/tosca-parser/toscaparser/tests/test_topology_template.py
+++ b/tosca2heat/tosca-parser/toscaparser/tests/test_topology_template.py
@@ -34,6 +34,11 @@ class TopologyTemplateTest(TestCase):
self.topo = TopologyTemplate(self.topo_tpl,
self._get_all_custom_def())
+ self.tosca_system_tpl_path = os.path.join(
+ os.path.dirname(os.path.abspath(__file__)),
+ "data/topology_template/system.yaml")
+ self.system_template = ToscaTemplate(self.tosca_system_tpl_path)
+
def _get_custom_def(self, type_definition):
custom_defs = {}
for definition in self.imports:
diff --git a/tosca2heat/tosca-parser/toscaparser/tests/test_toscadef.py b/tosca2heat/tosca-parser/toscaparser/tests/test_toscadef.py
index 7783b0c..7c29e67 100644
--- a/tosca2heat/tosca-parser/toscaparser/tests/test_toscadef.py
+++ b/tosca2heat/tosca-parser/toscaparser/tests/test_toscadef.py
@@ -283,8 +283,9 @@ class ToscaDefTest(TestCase):
key=lambda x: str(x)))
def test_policies(self):
+ self.assertEqual(policy_root_type.parent_type, None)
self.assertEqual('tosca.policies.Root',
- policy_placement_type.parent_type)
+ policy_placement_type.parent_type.type)
self.assertEqual({}, policy_placement_type.parent_policies)
self.assertEqual(sorted(['tosca.policies.Root',
'The TOSCA Policy Type definition that is '
@@ -296,7 +297,7 @@ class ToscaDefTest(TestCase):
key=lambda x: str(x)))
self.assertEqual('tosca.policies.Root',
- policy_scaling_type.parent_type)
+ policy_scaling_type.parent_type.type)
self.assertEqual({}, policy_scaling_type.parent_policies)
self.assertEqual(sorted(['tosca.policies.Root',
'The TOSCA Policy Type definition that is '
@@ -308,7 +309,7 @@ class ToscaDefTest(TestCase):
key=lambda x: str(x)))
self.assertEqual('tosca.policies.Root',
- policy_update_type.parent_type)
+ policy_update_type.parent_type.type)
self.assertEqual({}, policy_update_type.parent_policies)
self.assertEqual(sorted(['tosca.policies.Root',
'The TOSCA Policy Type definition that is '
@@ -320,7 +321,7 @@ class ToscaDefTest(TestCase):
key=lambda x: str(x)))
self.assertEqual('tosca.policies.Root',
- policy_performance_type.parent_type)
+ policy_performance_type.parent_type.type)
self.assertEqual({}, policy_performance_type.parent_policies)
self.assertEqual(sorted(['tosca.policies.Root',
'The TOSCA Policy Type definition that is '
diff --git a/tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py b/tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py
index 3fd49bf..564f4cd 100644
--- a/tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py
+++ b/tosca2heat/tosca-parser/toscaparser/tests/test_toscatpl.py
@@ -211,6 +211,10 @@ class ToscaTemplateTest(TestCase):
for key in relation.keys():
rel_tpl = relation.get(key).get_relationship_template()
if rel_tpl:
+ self.assertEqual(
+ rel_tpl[0].type, "tosca.relationships.ConnectsTo")
+ self.assertTrue(rel_tpl[0].is_derived_from(
+ "tosca.relationships.Root"))
interfaces = rel_tpl[0].interfaces
for interface in interfaces:
self.assertEqual(config_interface,
@@ -728,5 +732,7 @@ class ToscaTemplateTest(TestCase):
"data/test_tosca_custom_rel_with_script.yaml")
tosca = ToscaTemplate(tosca_tpl)
rel = tosca.relationship_templates[0]
+ self.assertEqual(rel.type, "tosca.relationships.HostedOn")
+ self.assertTrue(rel.is_derived_from("tosca.relationships.Root"))
self.assertEqual(len(rel.interfaces), 1)
self.assertEqual(rel.interfaces[0].type, "Configure")