From d60d60c0bc51c87e7f7a543ef81547b877302f8d Mon Sep 17 00:00:00 2001 From: Oleksii Chuprykov Date: Wed, 16 Sep 2015 18:30:23 +0300 Subject: [PATCH] No need to stub is_service_available Now mistralclient is in project requirements.txt, no need to patch is_service_available anymore. Change-Id: Icb2f2334cbf3a5920c4c3daac372f8654f7f7c00 --- .../mistral/test_mistral_cron_trigger.py | 10 ++----- heat/tests/mistral/test_mistral_workflow.py | 30 ++++++++----------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/heat/tests/mistral/test_mistral_cron_trigger.py b/heat/tests/mistral/test_mistral_cron_trigger.py index f675a79625..f1fba24ee0 100644 --- a/heat/tests/mistral/test_mistral_cron_trigger.py +++ b/heat/tests/mistral/test_mistral_cron_trigger.py @@ -44,12 +44,6 @@ class FakeCronTrigger(object): self._data = {'trigger': 'info'} -class MistralCronTriggerTestResource(cron_trigger.CronTrigger): - @classmethod - def is_service_available(cls, context): - return True - - class MistralCronTriggerTest(common.HeatTestCase): def setUp(self): @@ -64,11 +58,11 @@ class MistralCronTriggerTest(common.HeatTestCase): self.rsrc_defn = resource_defns['cron_trigger'] self.client = mock.Mock() - self.patchobject(MistralCronTriggerTestResource, 'client', + self.patchobject(cron_trigger.CronTrigger, 'client', return_value=self.client) def _create_resource(self, name, snippet, stack): - ct = MistralCronTriggerTestResource(name, snippet, stack) + ct = cron_trigger.CronTrigger(name, snippet, stack) self.client.cron_triggers.create.return_value = FakeCronTrigger( 'my_cron_trigger') self.client.cron_triggers.get.return_value = FakeCronTrigger( diff --git a/heat/tests/mistral/test_mistral_workflow.py b/heat/tests/mistral/test_mistral_workflow.py index 4dfbcdba42..431f008088 100644 --- a/heat/tests/mistral/test_mistral_workflow.py +++ b/heat/tests/mistral/test_mistral_workflow.py @@ -176,12 +176,6 @@ class FakeWorkflow(object): self._data = {'workflow': 'info'} -class MistralWorkFlowTestResource(workflow.Workflow): - @classmethod - def is_service_available(cls, context): - return True - - class TestMistralWorkflow(common.HeatTestCase): def setUp(self): @@ -196,7 +190,7 @@ class TestMistralWorkflow(common.HeatTestCase): self.rsrc_defn = resource_defns['workflow'] self.mistral = mock.Mock() - self.patchobject(MistralWorkFlowTestResource, 'client', + self.patchobject(workflow.Workflow, 'client', return_value=self.mistral) self.patches = [] @@ -219,7 +213,7 @@ class TestMistralWorkflow(common.HeatTestCase): patch.stop() def _create_resource(self, name, snippet, stack): - wf = MistralWorkFlowTestResource(name, snippet, stack) + wf = workflow.Workflow(name, snippet, stack) self.mistral.workflows.create.return_value = [ FakeWorkflow('test_stack-workflow-b5fiekfci3yc')] scheduler.TaskRunner(wf.create)() @@ -237,7 +231,7 @@ class TestMistralWorkflow(common.HeatTestCase): rsrc_defns = stack.t.resource_definitions(stack)['create_vm'] - wf = MistralWorkFlowTestResource('create_vm', rsrc_defns, stack) + wf = workflow.Workflow('create_vm', rsrc_defns, stack) self.mistral.workflows.create.return_value = [ FakeWorkflow('create_vm')] scheduler.TaskRunner(wf.create)() @@ -275,7 +269,7 @@ class TestMistralWorkflow(common.HeatTestCase): rsrc_defns = stack.t.resource_definitions(stack)['workflow'] - wf = MistralWorkFlowTestResource('workflow', rsrc_defns, stack) + wf = workflow.Workflow('workflow', rsrc_defns, stack) exc = self.assertRaises(exception.StackValidationFailed, wf.validate) @@ -287,7 +281,7 @@ class TestMistralWorkflow(common.HeatTestCase): rsrc_defns = stack.t.resource_definitions(stack)['workflow'] - wf = MistralWorkFlowTestResource('workflow', rsrc_defns, stack) + wf = workflow.Workflow('workflow', rsrc_defns, stack) self.mistral.workflows.create.side_effect = Exception('boom!') @@ -385,7 +379,7 @@ class TestMistralWorkflow(common.HeatTestCase): tmpl = template_format.parse(workflow_template_full) stack = utils.parse_stack(tmpl) rsrc_defns = stack.t.resource_definitions(stack)['create_vm'] - wf = MistralWorkFlowTestResource('create_vm', rsrc_defns, stack) + wf = workflow.Workflow('create_vm', rsrc_defns, stack) self.mistral.workflows.create.return_value = [ FakeWorkflow('create_vm')] scheduler.TaskRunner(wf.create)() @@ -400,7 +394,7 @@ class TestMistralWorkflow(common.HeatTestCase): tmpl = template_format.parse(workflow_template_full) stack = utils.parse_stack(tmpl) rsrc_defns = stack.t.resource_definitions(stack)['create_vm'] - wf = MistralWorkFlowTestResource('create_vm', rsrc_defns, stack) + wf = workflow.Workflow('create_vm', rsrc_defns, stack) self.mistral.workflows.create.return_value = [ FakeWorkflow('create_vm')] scheduler.TaskRunner(wf.create)() @@ -423,7 +417,7 @@ class TestMistralWorkflow(common.HeatTestCase): tmpl = template_format.parse(workflow_template_full) stack = utils.parse_stack(tmpl) rsrc_defns = stack.t.resource_definitions(stack)['create_vm'] - wf = MistralWorkFlowTestResource('create_vm', rsrc_defns, stack) + wf = workflow.Workflow('create_vm', rsrc_defns, stack) self.mistral.workflows.create.return_value = [ FakeWorkflow('create_vm')] scheduler.TaskRunner(wf.create)() @@ -438,7 +432,7 @@ class TestMistralWorkflow(common.HeatTestCase): tmpl = template_format.parse(workflow_template_full) stack = utils.parse_stack(tmpl) rsrc_defns = stack.t.resource_definitions(stack)['create_vm'] - wf = MistralWorkFlowTestResource('create_vm', rsrc_defns, stack) + wf = workflow.Workflow('create_vm', rsrc_defns, stack) self.mistral.workflows.create.return_value = [ FakeWorkflow('create_vm')] scheduler.TaskRunner(wf.create)() @@ -460,7 +454,7 @@ class TestMistralWorkflow(common.HeatTestCase): tmpl = template_format.parse(workflow_template_full) stack = utils.parse_stack(tmpl) rsrc_defns = stack.t.resource_definitions(stack)['create_vm'] - wf = MistralWorkFlowTestResource('create_vm', rsrc_defns, stack) + wf = workflow.Workflow('create_vm', rsrc_defns, stack) self.mistral.workflows.create.return_value = [ FakeWorkflow('create_vm')] scheduler.TaskRunner(wf.create)() @@ -476,7 +470,7 @@ class TestMistralWorkflow(common.HeatTestCase): tmpl = template_format.parse(workflow_template_with_params) stack = utils.parse_stack(tmpl) rsrc_defns = stack.t.resource_definitions(stack)['workflow'] - wf = MistralWorkFlowTestResource('workflow', rsrc_defns, stack) + wf = workflow.Workflow('workflow', rsrc_defns, stack) self.mistral.workflows.create.return_value = [ FakeWorkflow('workflow')] scheduler.TaskRunner(wf.create)() @@ -491,7 +485,7 @@ class TestMistralWorkflow(common.HeatTestCase): tmpl = template_format.parse(workflow_template_with_params_override) stack = utils.parse_stack(tmpl) rsrc_defns = stack.t.resource_definitions(stack)['workflow'] - wf = MistralWorkFlowTestResource('workflow', rsrc_defns, stack) + wf = workflow.Workflow('workflow', rsrc_defns, stack) self.mistral.workflows.create.return_value = [ FakeWorkflow('workflow')] scheduler.TaskRunner(wf.create)()