Register ResourceWithResourceID in HeatTestCase

Move registration of the ResourceWithResourceID resource to the main
test class.

Change-Id: Id4412680c774910d798318e754132d8191306517
This commit is contained in:
Sergey Kraynev 2015-06-08 11:47:43 -04:00
parent 75885a8e7d
commit 8253735a21
2 changed files with 7 additions and 8 deletions

View File

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

View File

@ -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',