def _in_new(self, dep_update, source_node_id, relationships, source_relationship_index, target_relationship_index): source_node = utils.get_raw_node(dep_update.deployment_plan, source_node_id) if not (source_node and len(source_node[relationships]) > source_relationship_index): return target_node_id = \ source_node[relationships][source_relationship_index]['target_id'] raw_target_node = utils.get_raw_node(dep_update.deployment_plan, target_node_id) return raw_target_node
def test_get_raw_node(self): blueprint_to_test = { 'nodes': [{'id': 1, 'name': 'n1'}, {'id': 2, 'name': 'n2'}] } # assert the right id is returned on existing node self.assertDictEqual(utils.get_raw_node(blueprint_to_test, 1), {'id': 1, 'name': 'n1'}) # assert no value is returned on non existing id self.assertEqual(len(utils.get_raw_node(blueprint_to_test, 3)), 0) # assert nothing is return on invalid blueprint self.assertEqual(len(utils.get_raw_node({'no_nodes': 1}, 1)), 0)
def test_get_raw_node(self): blueprint_to_test = { 'nodes': [{ 'id': 1, 'name': 'n1' }, { 'id': 2, 'name': 'n2' }] } # assert the right id is returned on existing node self.assertDictEqual(utils.get_raw_node(blueprint_to_test, 1), { 'id': 1, 'name': 'n1' }) # assert no value is returned on non existing id self.assertEqual(len(utils.get_raw_node(blueprint_to_test, 3)), 0) # assert nothing is return on invalid blueprint self.assertEqual(len(utils.get_raw_node({'no_nodes': 1}, 1)), 0)
def _in_new(self, dep_update, node_id): raw_node = utils.get_raw_node(dep_update.deployment_plan, node_id) return bool(raw_node)
def _in_new(self, dep_update, node_id, operation_id): raw_node = utils.get_raw_node(dep_update.deployment_plan, node_id) return utils.traverse_object(raw_node, operation_id) is not None
def _in_new(dep_update, node_id, property_id): raw_node = utils.get_raw_node(dep_update.deployment_plan, node_id) return utils.traverse_object(raw_node, property_id) is not None