Merge "No need to stub is_service_available"

This commit is contained in:
Jenkins 2015-09-17 13:51:49 +00:00 committed by Gerrit Code Review
commit a8ae73b35e
2 changed files with 14 additions and 26 deletions

View File

@ -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(

View File

@ -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)()