Move registration of resources to HeatTestCase

Move registration of the follow generic resources to HeatTestCase class:
- SignalResource
- StackUserResource
- ResourceWithRequiredProps
- ResourceWithCustomConstraint
- ResourceWithAttributeType

Change-Id: I0d984a2a05f70db077e68305abdea85393c96c08
changes/52/189752/2
Sergey Kraynev 7 years ago
parent f7c165d5c3
commit ee7ad5f106
  1. 10
      heat/tests/common.py
  2. 4
      heat/tests/test_ceilometer_alarm.py
  3. 2
      heat/tests/test_engine_service.py
  4. 4
      heat/tests/test_event.py
  5. 6
      heat/tests/test_resource.py
  6. 2
      heat/tests/test_signal.py
  7. 4
      heat/tests/test_stack_user.py

@ -125,14 +125,24 @@ class HeatTestCase(testscenarios.WithScenarios,
self.addCleanup(utils.reset_dummy_db)
def register_test_resources(self):
resource._register_class('SignalResourceType',
generic_rsrc.SignalResource)
resource._register_class('ResourceWithPropsType',
generic_rsrc.ResourceWithProps)
resource._register_class('StackUserResourceType',
generic_rsrc.StackUserResource)
resource._register_class('ResourceWithResourceIDType',
generic_rsrc.ResourceWithResourceID)
resource._register_class('ResourceWithAttributeType',
generic_rsrc.ResourceWithAttributeType)
resource._register_class('ResourceWithRequiredProps',
generic_rsrc.ResourceWithRequiredProps)
resource._register_class('ResourceWithPropsAndAttrs',
generic_rsrc.ResourceWithPropsAndAttrs)
resource._register_class('ResWithComplexPropsAndAttrs',
generic_rsrc.ResWithComplexPropsAndAttrs)
resource._register_class('ResourceWithCustomConstraint',
generic_rsrc.ResourceWithCustomConstraint)
resource._register_class('ResourceWithComplexAttributesType',
generic_rsrc.ResourceWithComplexAttributes)

@ -30,7 +30,6 @@ from heat.engine import scheduler
from heat.engine import stack as parser
from heat.engine import template as tmpl
from heat.tests import common
from heat.tests import generic_resource
from heat.tests import utils
@ -114,9 +113,6 @@ class FakeCeilometerAlarm(object):
class CeilometerAlarmTest(common.HeatTestCase):
def setUp(self):
super(CeilometerAlarmTest, self).setUp()
resource._register_class('SignalResourceType',
generic_resource.SignalResource)
self.fa = mock.Mock()
def create_stack(self, template=None):

@ -2131,8 +2131,6 @@ class StackServiceTest(common.HeatTestCase):
self.assertEqual(expected, schema)
def test_resource_schema_with_attr_type(self):
res._register_class('ResourceWithAttributeType',
generic_rsrc.ResourceWithAttributeType)
type_name = 'ResourceWithAttributeType'
expected = {

@ -14,7 +14,6 @@
from oslo_config import cfg
from heat.engine import event
from heat.engine import resource
from heat.engine import rsrc_defn
from heat.engine import stack
from heat.engine import template
@ -48,9 +47,6 @@ class EventTest(common.HeatTestCase):
self.m.ReplayAll()
resource._register_class('ResourceWithRequiredProps',
generic_rsrc.ResourceWithRequiredProps)
self.stack = stack.Stack(self.ctx, 'event_load_test_stack',
template.Template(tmpl))
self.stack.store()

@ -56,8 +56,6 @@ class ResourceTest(common.HeatTestCase):
resource._register_class('GenericResourceType',
generic_rsrc.GenericResource)
resource._register_class('ResourceWithCustomConstraint',
generic_rsrc.ResourceWithCustomConstraint)
self.env = environment.Environment()
self.env.load({u'resource_registry':
@ -1300,8 +1298,6 @@ class ResourceTest(common.HeatTestCase):
res_class.__name__)
def test_getatt_invalid_type(self):
resource._register_class('ResourceWithAttributeType',
generic_rsrc.ResourceWithAttributeType)
tmpl = template.Template({
'heat_template_version': '2013-05-23',
@ -2151,8 +2147,6 @@ class ResourceHookTest(common.HeatTestCase):
resource._register_class('GenericResourceType',
generic_rsrc.GenericResource)
resource._register_class('ResourceWithCustomConstraint',
generic_rsrc.ResourceWithCustomConstraint)
self.env = environment.Environment()
self.env.load({u'resource_registry':

@ -48,8 +48,6 @@ class SignalTest(common.HeatTestCase):
def setUp(self):
super(SignalTest, self).setUp()
resource._register_class('SignalResourceType',
generic_resource.SignalResource)
resource._register_class('GenericResourceType',
generic_resource.GenericResource)

@ -17,13 +17,11 @@ import six
from heat.common import exception
from heat.common import short_id
from heat.common import template_format
from heat.engine import resource
from heat.engine.resources import stack_user
from heat.engine import scheduler
from heat.objects import resource_data as resource_data_object
from heat.tests import common
from heat.tests import fakes
from heat.tests import generic_resource
from heat.tests import utils
@ -40,8 +38,6 @@ class StackUserTest(common.HeatTestCase):
def setUp(self):
super(StackUserTest, self).setUp()
resource._register_class('StackUserResourceType',
generic_resource.StackUserResource)
self.fc = fakes.FakeKeystoneClient()
def _user_create(self, stack_name, project_id, user_id,

Loading…
Cancel
Save