def test__get_deployment_templates(self, mock_list): traits = ['CUSTOM_DT1', 'CUSTOM_DT2'] node = obj_utils.create_test_node( self.context, uuid=uuidutils.generate_uuid(), instance_info={'traits': traits}) template1 = obj_utils.get_test_deploy_template(self.context) template2 = obj_utils.get_test_deploy_template( self.context, name='CUSTOM_DT2', uuid=uuidutils.generate_uuid(), steps=[{'interface': 'bios', 'step': 'apply_configuration', 'args': {}, 'priority': 1}]) mock_list.return_value = [template1, template2] expected = [template1, template2] with task_manager.acquire( self.context, node.uuid, shared=False) as task: templates = conductor_steps._get_deployment_templates(task) self.assertEqual(expected, templates) mock_list.assert_called_once_with(task.context, traits)
def test__get_deployment_templates(self, mock_list): traits = ['CUSTOM_DT1', 'CUSTOM_DT2'] node = obj_utils.create_test_node( self.context, uuid=uuidutils.generate_uuid(), instance_info={'traits': traits}) template1 = obj_utils.get_test_deploy_template(self.context) template2 = obj_utils.get_test_deploy_template( self.context, name='CUSTOM_DT2', uuid=uuidutils.generate_uuid(), steps=[{'interface': 'bios', 'step': 'apply_configuration', 'args': {}, 'priority': 1}]) mock_list.return_value = [template1, template2] expected = [template1, template2] with task_manager.acquire( self.context, node.uuid, shared=False) as task: templates = conductor_steps._get_deployment_templates(task) self.assertEqual(expected, templates) mock_list.assert_called_once_with(task.context, traits)
def test__get_deployment_templates_no_traits(self, mock_list): with task_manager.acquire(self.context, self.node.uuid, shared=False) as task: templates = conductor_steps._get_deployment_templates(task) self.assertEqual([], templates) self.assertFalse(mock_list.called)
def test__get_deployment_templates_no_traits(self, mock_list): with task_manager.acquire( self.context, self.node.uuid, shared=False) as task: templates = conductor_steps._get_deployment_templates(task) self.assertEqual([], templates) self.assertFalse(mock_list.called)