Register ResourceWithProps in HeatTestCase

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

Change-Id: I9acf89e18d9f84eae4ad00432f0a438b8f84fa5f
This commit is contained in:
Sergey Kraynev 2015-06-09 01:09:15 -04:00
parent 4f3919e94e
commit ce7ad1095f
7 changed files with 2 additions and 18 deletions

View File

@ -125,6 +125,8 @@ class HeatTestCase(testscenarios.WithScenarios,
self.addCleanup(utils.reset_dummy_db) self.addCleanup(utils.reset_dummy_db)
def register_test_resources(self): def register_test_resources(self):
resource._register_class('ResourceWithPropsType',
generic_rsrc.ResourceWithProps)
resource._register_class('ResourceWithResourceIDType', resource._register_class('ResourceWithResourceIDType',
generic_rsrc.ResourceWithResourceID) generic_rsrc.ResourceWithResourceID)
resource._register_class('ResWithComplexPropsAndAttrs', resource._register_class('ResWithComplexPropsAndAttrs',

View File

@ -942,8 +942,6 @@ class StackServiceAdoptUpdateTest(common.HeatTestCase):
def test_stack_update_stack_id_equal(self): def test_stack_update_stack_id_equal(self):
stack_name = 'test_stack_update_stack_id_equal' stack_name = 'test_stack_update_stack_id_equal'
res._register_class('ResourceWithPropsType',
generic_rsrc.ResourceWithProps)
tpl = { tpl = {
'HeatTemplateFormatVersion': '2012-12-12', 'HeatTemplateFormatVersion': '2012-12-12',
'Resources': { 'Resources': {
@ -1256,8 +1254,6 @@ class StackServiceAuthorizeTest(common.HeatTestCase):
self.eng = service.EngineService('a-host', 'a-topic') self.eng = service.EngineService('a-host', 'a-topic')
self.eng.engine_id = 'engine-fake-uuid' self.eng.engine_id = 'engine-fake-uuid'
cfg.CONF.set_default('heat_stack_user_role', 'stack_user_role') cfg.CONF.set_default('heat_stack_user_role', 'stack_user_role')
res._register_class('ResourceWithPropsType',
generic_rsrc.ResourceWithProps)
@tools.stack_context('service_authorize_stack_user_nocreds_test_stack') @tools.stack_context('service_authorize_stack_user_nocreds_test_stack')
def test_stack_authorize_stack_user_nocreds(self): def test_stack_authorize_stack_user_nocreds(self):
@ -1348,8 +1344,6 @@ class StackServiceTest(common.HeatTestCase):
self.eng.create_periodic_tasks() self.eng.create_periodic_tasks()
self.eng.engine_id = 'engine-fake-uuid' self.eng.engine_id = 'engine-fake-uuid'
cfg.CONF.set_default('heat_stack_user_role', 'stack_user_role') cfg.CONF.set_default('heat_stack_user_role', 'stack_user_role')
res._register_class('ResourceWithPropsType',
generic_rsrc.ResourceWithProps)
@mock.patch.object(service_stack_watch.StackWatch, 'start_watch_task') @mock.patch.object(service_stack_watch.StackWatch, 'start_watch_task')
@mock.patch.object(stack_object.Stack, 'get_all') @mock.patch.object(stack_object.Stack, 'get_all')

View File

@ -898,8 +898,6 @@ class HotStackTest(common.HeatTestCase):
resource._register_class('GenericResourceType', resource._register_class('GenericResourceType',
generic_rsrc.GenericResource) generic_rsrc.GenericResource)
resource._register_class('ResourceWithPropsType',
generic_rsrc.ResourceWithProps)
def resolve(self, snippet): def resolve(self, snippet):
return function.resolve(self.stack.t.parse(self.stack, snippet)) return function.resolve(self.stack.t.parse(self.stack, snippet))

View File

@ -1559,8 +1559,6 @@ class ResourceDependenciesTest(common.HeatTestCase):
resource._register_class('GenericResourceType', resource._register_class('GenericResourceType',
generic_rsrc.GenericResource) generic_rsrc.GenericResource)
resource._register_class('ResourceWithPropsType',
generic_rsrc.ResourceWithProps)
self.deps = dependencies.Dependencies() self.deps = dependencies.Dependencies()

View File

@ -55,8 +55,6 @@ class StackTest(common.HeatTestCase):
resource._register_class('GenericResourceType', resource._register_class('GenericResourceType',
generic_rsrc.GenericResource) generic_rsrc.GenericResource)
resource._register_class('ResourceWithPropsType',
generic_rsrc.ResourceWithProps)
def test_stack_reads_tenant(self): def test_stack_reads_tenant(self):
self.stack = stack.Stack(self.ctx, 'test_stack', self.tmpl, self.stack = stack.Stack(self.ctx, 'test_stack', self.tmpl,

View File

@ -14,11 +14,9 @@
import six import six
from heat.common import template_format from heat.common import template_format
from heat.engine import resource
from heat.engine import stack from heat.engine import stack
from heat.engine import template from heat.engine import template
from heat.tests import common from heat.tests import common
from heat.tests import generic_resource as generic_rsrc
from heat.tests import utils from heat.tests import utils
@ -167,8 +165,6 @@ class DepAttrsTest(common.HeatTestCase):
def setUp(self): def setUp(self):
super(DepAttrsTest, self).setUp() super(DepAttrsTest, self).setUp()
self.ctx = utils.dummy_context() self.ctx = utils.dummy_context()
resource._register_class('ResourceWithPropsType',
generic_rsrc.ResourceWithProps)
def test_dep_attrs(self): def test_dep_attrs(self):

View File

@ -39,8 +39,6 @@ class StackUpdateTest(common.HeatTestCase):
resource._register_class('GenericResourceType', resource._register_class('GenericResourceType',
generic_rsrc.GenericResource) generic_rsrc.GenericResource)
resource._register_class('ResourceWithPropsType',
generic_rsrc.ResourceWithProps)
def test_update_add(self): def test_update_add(self):
tmpl = {'HeatTemplateFormatVersion': '2012-12-12', tmpl = {'HeatTemplateFormatVersion': '2012-12-12',