From 8253735a211ca81cacd51d01db8e859dc97e9127 Mon Sep 17 00:00:00 2001 From: Sergey Kraynev Date: Mon, 8 Jun 2015 11:47:43 -0400 Subject: [PATCH] Register ResourceWithResourceID in HeatTestCase Move registration of the ResourceWithResourceID resource to the main test class. Change-Id: Id4412680c774910d798318e754132d8191306517 --- heat/tests/common.py | 7 +++++++ heat/tests/test_stack_update.py | 8 -------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/heat/tests/common.py b/heat/tests/common.py index 9690dd720f..55aba80ea7 100644 --- a/heat/tests/common.py +++ b/heat/tests/common.py @@ -33,9 +33,11 @@ from heat.engine.clients.os import neutron from heat.engine.clients.os import nova from heat.engine.clients.os import trove from heat.engine import environment +from heat.engine import resource from heat.engine import resources from heat.engine import scheduler from heat.tests import fakes +from heat.tests import generic_resource as generic_rsrc from heat.tests import utils @@ -119,8 +121,13 @@ class HeatTestCase(testscenarios.WithScenarios, if mock_keystone: self.stub_keystoneclient() utils.setup_dummy_db() + self.register_test_resources() self.addCleanup(utils.reset_dummy_db) + def register_test_resources(self): + resource._register_class('ResourceWithResourceIDType', + generic_rsrc.ResourceWithResourceID) + def stub_wallclock(self): """ Overrides scheduler wallclock to speed up tests expecting timeouts. diff --git a/heat/tests/test_stack_update.py b/heat/tests/test_stack_update.py index 4838dfb4e0..6172bb0a8d 100644 --- a/heat/tests/test_stack_update.py +++ b/heat/tests/test_stack_update.py @@ -459,8 +459,6 @@ class StackUpdateTest(common.HeatTestCase): mock_create.assert_called_once_with() def test_update_modify_replace_failed_create_and_delete_1(self): - resource._register_class('ResourceWithResourceIDType', - generic_rsrc.ResourceWithResourceID) tmpl = {'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'AResource': {'Type': 'ResourceWithResourceIDType', @@ -514,8 +512,6 @@ class StackUpdateTest(common.HeatTestCase): [mock.call(None), mock.call('b_res'), mock.call('a_res')]) def test_update_modify_replace_failed_create_and_delete_2(self): - resource._register_class('ResourceWithResourceIDType', - generic_rsrc.ResourceWithResourceID) tmpl = {'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'AResource': {'Type': 'ResourceWithResourceIDType', @@ -571,8 +567,6 @@ class StackUpdateTest(common.HeatTestCase): mock.call('a_res')]) def test_update_modify_replace_create_in_progress_and_delete_1(self): - resource._register_class('ResourceWithResourceIDType', - generic_rsrc.ResourceWithResourceID) tmpl = {'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'AResource': {'Type': 'ResourceWithResourceIDType', @@ -627,8 +621,6 @@ class StackUpdateTest(common.HeatTestCase): [mock.call(None), mock.call('b_res'), mock.call('a_res')]) def test_update_modify_replace_create_in_progress_and_delete_2(self): - resource._register_class('ResourceWithResourceIDType', - generic_rsrc.ResourceWithResourceID) tmpl = {'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'AResource': {'Type': 'ResourceWithResourceIDType',