_get_explicit_relationship() only looks at the first relationship

- Fixed a bug in _get_explicit_relationship() that was causing only
    the first relationship to be returned, or none at all.  The break
    statement needed to be inside the if condition so that it would
    loop through all of the available relationships to find the one
    it is looking for.

Change-Id: I74e4a9945c25f87a0d6d5fdf4f302d762655e48b
This commit is contained in:
Bob.Haddleton
2016-01-29 14:05:47 -06:00
parent 5fca97c7f8
commit 3d069c936a
2 changed files with 3 additions and 1 deletions

View File

@@ -104,7 +104,7 @@ class NodeTemplate(EntityTemplate):
if key in req_dict.keys():
relationship = (req_dict.get(key).
get('relationship'))
break
break
if relationship:
found_relationship_tpl = False
# apply available relationship templates if found

View File

@@ -218,6 +218,8 @@ class ToscaTemplateTest(TestCase):
interface.name)
self.assertEqual(artifact,
interface.implementation)
if node_tpl.name == 'paypal_pizzastore':
self.assertEqual(len(node_tpl.relationships), 2)
def test_template_macro(self):
template = ToscaTemplate(self.tosca_elk_tpl)