Remove unnecessary setUp and tearDown
setUp and tearDown will be automatically called around each testcase, so this is to remove setUp and tearDown that doing nothing additional than super to keep code clean. Change-Id: I8b6943602419d3f360991721d90b61888b55ea60
This commit is contained in:
parent
bfd3797cd7
commit
bc3c16a8e5
@ -62,9 +62,6 @@ class CfnStackControllerTest(common.HeatTestCase):
|
||||
self.assertRaises(
|
||||
exception.HeatInvalidActionError, self.controller.default, None)
|
||||
|
||||
def tearDown(self):
|
||||
super(CfnStackControllerTest, self).tearDown()
|
||||
|
||||
def _dummy_GET_request(self, params=None):
|
||||
# Mangle the params dict into a query string
|
||||
params = params or {}
|
||||
|
@ -50,9 +50,6 @@ class WatchControllerTest(common.HeatTestCase):
|
||||
'deny_stack_user.json')
|
||||
self.addCleanup(self.m.VerifyAll)
|
||||
|
||||
def tearDown(self):
|
||||
super(WatchControllerTest, self).tearDown()
|
||||
|
||||
def _dummy_GET_request(self, params=None):
|
||||
# Mangle the params dict into a query string
|
||||
params = params or {}
|
||||
|
@ -32,9 +32,6 @@ from heat.tests import common
|
||||
|
||||
class RequestTest(common.HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(RequestTest, self).setUp()
|
||||
|
||||
def test_content_type_missing(self):
|
||||
request = wsgi.Request.blank('/tests/123')
|
||||
self.assertRaises(exception.InvalidContentType,
|
||||
@ -106,9 +103,6 @@ class RequestTest(common.HeatTestCase):
|
||||
|
||||
class ResourceTest(common.HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ResourceTest, self).setUp()
|
||||
|
||||
def test_get_action_args(self):
|
||||
env = {
|
||||
'wsgiorg.routing_args': [
|
||||
|
@ -84,9 +84,6 @@ class TestInitialGroupSize(common.HeatTestCase):
|
||||
('14n', dict(mins=1, maxs=4, desired=None, expected=1)),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(TestInitialGroupSize, self).setUp()
|
||||
|
||||
def test_initial_size(self):
|
||||
t = template_format.parse(inline_templates.as_heat_template)
|
||||
properties = t['resources']['my-group']['properties']
|
||||
|
@ -160,9 +160,6 @@ class TestAutoScalingPolicy(common.HeatTestCase):
|
||||
|
||||
|
||||
class TestCooldownMixin(common.HeatTestCase):
|
||||
def setUp(self):
|
||||
super(TestCooldownMixin, self).setUp()
|
||||
|
||||
def create_scaling_policy(self, t, stack, resource_name):
|
||||
rsrc = stack[resource_name]
|
||||
self.assertIsNone(rsrc.validate())
|
||||
|
@ -25,9 +25,6 @@ from heat.tests import utils
|
||||
|
||||
|
||||
class LaunchConfigurationTest(common.HeatTestCase):
|
||||
def setUp(self):
|
||||
super(LaunchConfigurationTest, self).setUp()
|
||||
|
||||
def validate_launch_config(self, stack, lc_name='LaunchConfig'):
|
||||
# create the launch configuration resource
|
||||
conf = stack[lc_name]
|
||||
|
@ -33,9 +33,6 @@ as_template = inline_templates.as_template
|
||||
|
||||
|
||||
class TestAutoScalingGroupValidation(common.HeatTestCase):
|
||||
def setUp(self):
|
||||
super(TestAutoScalingGroupValidation, self).setUp()
|
||||
|
||||
def validate_scaling_group(self, t, stack, resource_name):
|
||||
# create the launch configuration resource
|
||||
conf = stack['LaunchConfig']
|
||||
@ -271,9 +268,6 @@ class TestInitialGroupSize(common.HeatTestCase):
|
||||
('14n', dict(mins=1, maxs=4, desired=None, expected=1)),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(TestInitialGroupSize, self).setUp()
|
||||
|
||||
def test_initial_size(self):
|
||||
t = template_format.parse(as_template)
|
||||
properties = t['Resources']['WebServerGroup']['Properties']
|
||||
|
@ -32,9 +32,6 @@ as_params = inline_templates.as_params
|
||||
|
||||
|
||||
class TestAutoScalingPolicy(common.HeatTestCase):
|
||||
def setUp(self):
|
||||
super(TestAutoScalingPolicy, self).setUp()
|
||||
|
||||
def create_scaling_policy(self, t, stack, resource_name):
|
||||
rsrc = stack[resource_name]
|
||||
self.assertIsNone(rsrc.validate())
|
||||
@ -174,9 +171,6 @@ class TestAutoScalingPolicy(common.HeatTestCase):
|
||||
|
||||
|
||||
class TestCooldownMixin(common.HeatTestCase):
|
||||
def setUp(self):
|
||||
super(TestCooldownMixin, self).setUp()
|
||||
|
||||
def create_scaling_policy(self, t, stack, resource_name):
|
||||
rsrc = stack[resource_name]
|
||||
self.assertIsNone(rsrc.validate())
|
||||
|
@ -78,9 +78,6 @@ test_template_wc_count = '''
|
||||
|
||||
class WaitConditionTest(common.HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(WaitConditionTest, self).setUp()
|
||||
|
||||
def create_stack(self, stack_id=None,
|
||||
template=test_template_waitcondition, params=None,
|
||||
stub=True, stub_status=True):
|
||||
@ -379,9 +376,6 @@ class WaitConditionTest(common.HeatTestCase):
|
||||
|
||||
|
||||
class WaitConditionHandleTest(common.HeatTestCase):
|
||||
def setUp(self):
|
||||
super(WaitConditionHandleTest, self).setUp()
|
||||
|
||||
def create_stack(self, stack_name=None, stack_id=None):
|
||||
temp = template_format.parse(test_template_waitcondition)
|
||||
template = tmpl.Template(temp)
|
||||
@ -559,9 +553,6 @@ class WaitConditionHandleTest(common.HeatTestCase):
|
||||
|
||||
|
||||
class WaitConditionUpdateTest(common.HeatTestCase):
|
||||
def setUp(self):
|
||||
super(WaitConditionUpdateTest, self).setUp()
|
||||
|
||||
def create_stack(self, temp=None):
|
||||
if temp is None:
|
||||
temp = test_template_wc_count
|
||||
|
@ -35,9 +35,6 @@ class ScenarioTest(common.HeatTestCase):
|
||||
po.side_effect = self.procs.worker.check_resource
|
||||
cfg.CONF.set_default('convergence_engine', True)
|
||||
|
||||
def tearDown(self):
|
||||
super(ScenarioTest, self).tearDown()
|
||||
|
||||
def test_scenario(self):
|
||||
self.procs.clear()
|
||||
runner = scenario.Scenario(self.name, self.path)
|
||||
|
@ -80,9 +80,6 @@ class SqlAlchemyTest(common.HeatTestCase):
|
||||
self.fc = fakes_nova.FakeClient()
|
||||
self.ctx = utils.dummy_context()
|
||||
|
||||
def tearDown(self):
|
||||
super(SqlAlchemyTest, self).tearDown()
|
||||
|
||||
def _mock_get_image_id_success(self, imageId_input, imageId):
|
||||
self.m.StubOutWithMock(glance.GlanceClientPlugin,
|
||||
'find_image_by_name_or_id')
|
||||
|
@ -35,9 +35,6 @@ class DBMigrationUtilsTest(common.HeatTestCase):
|
||||
super(DBMigrationUtilsTest, self).setUp()
|
||||
self.engine = utils.get_engine()
|
||||
|
||||
def tearDown(self):
|
||||
super(DBMigrationUtilsTest, self).tearDown()
|
||||
|
||||
def test_clone_table_adds_or_deletes_columns(self):
|
||||
meta = MetaData()
|
||||
meta.bind = self.engine
|
||||
|
@ -27,9 +27,6 @@ from heat.tests import utils
|
||||
|
||||
|
||||
class WorkerServiceTest(common.HeatTestCase):
|
||||
def setUp(self):
|
||||
super(WorkerServiceTest, self).setUp()
|
||||
|
||||
def test_make_sure_rpc_version(self):
|
||||
self.assertEqual(
|
||||
'1.3',
|
||||
|
@ -40,9 +40,6 @@ restarter_template = '''
|
||||
|
||||
|
||||
class RestarterTest(common.HeatTestCase):
|
||||
def setUp(self):
|
||||
super(RestarterTest, self).setUp()
|
||||
|
||||
def create_restarter(self):
|
||||
snippet = template_format.parse(restarter_template)
|
||||
self.stack = utils.parse_stack(snippet)
|
||||
|
@ -149,9 +149,6 @@ class DBInstance(resource.Resource):
|
||||
|
||||
|
||||
class DBInstanceTest(common.HeatTestCase):
|
||||
def setUp(self):
|
||||
super(DBInstanceTest, self).setUp()
|
||||
|
||||
def test_dbinstance(self):
|
||||
"""Test that Template is parsable and publishes correct properties."""
|
||||
templ = template.Template(template_format.parse(rds_template))
|
||||
|
@ -113,9 +113,6 @@ resources:
|
||||
|
||||
|
||||
class StackCreateTest(common.HeatTestCase):
|
||||
def setUp(self):
|
||||
super(StackCreateTest, self).setUp()
|
||||
|
||||
def test_wordpress_single_instance_stack_create(self):
|
||||
stack = tools.get_stack('test_stack', utils.dummy_context())
|
||||
tools.setup_mocks(self.m, stack)
|
||||
|
@ -77,9 +77,6 @@ tmpl_multiple_srsly_too_large = {
|
||||
|
||||
class EventCommon(common.HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(EventCommon, self).setUp()
|
||||
|
||||
def _setup_stack(self, the_tmpl):
|
||||
self.username = 'event_test_user'
|
||||
|
||||
|
@ -33,9 +33,6 @@ class LifecyclePluginUtilsTest(common.HeatTestCase):
|
||||
:module:'heat.common.lifecycle_plugin_utils'.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(LifecyclePluginUtilsTest, self).setUp()
|
||||
|
||||
def tearDown(self):
|
||||
super(LifecyclePluginUtilsTest, self).tearDown()
|
||||
lifecycle_plugin_utils.pp_class_instances = None
|
||||
|
@ -20,9 +20,6 @@ from heat.tests import common
|
||||
|
||||
class ISO8601UtilityTest(common.HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ISO8601UtilityTest, self).setUp()
|
||||
|
||||
def test_valid_durations(self):
|
||||
self.assertEqual(0, util.parse_isoduration('PT'))
|
||||
self.assertEqual(3600, util.parse_isoduration('PT1H'))
|
||||
|
@ -307,9 +307,6 @@ resources:
|
||||
|
||||
class CreateUpdateResConditionTest(functional_base.FunctionalTestsBase):
|
||||
|
||||
def setUp(self):
|
||||
super(CreateUpdateResConditionTest, self).setUp()
|
||||
|
||||
def res_assert_for_prod(self, resources, bj_prod=True, fj_zone=False,
|
||||
shannxi_provice=False):
|
||||
res_names = [res.resource_name for res in resources]
|
||||
|
@ -74,9 +74,6 @@ def _change_rsrc_properties(template, rsrcs, values):
|
||||
|
||||
|
||||
class CreateStackTest(functional_base.FunctionalTestsBase):
|
||||
def setUp(self):
|
||||
super(CreateStackTest, self).setUp()
|
||||
|
||||
def test_create_rollback(self):
|
||||
values = {'fail': True, 'value': 'test_create_rollback'}
|
||||
template = _change_rsrc_properties(test_template_one_resource,
|
||||
@ -153,9 +150,6 @@ resources:
|
||||
wait_secs: 1
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(UpdateStackTest, self).setUp()
|
||||
|
||||
def test_stack_update_nochange(self):
|
||||
template = _change_rsrc_properties(test_template_one_resource,
|
||||
['test1'],
|
||||
|
@ -36,9 +36,6 @@ outputs:
|
||||
|
||||
class UpdateSubnetTest(functional_base.FunctionalTestsBase):
|
||||
|
||||
def setUp(self):
|
||||
super(UpdateSubnetTest, self).setUp()
|
||||
|
||||
def get_outputs(self, stack_identifier, output_key):
|
||||
stack = self.client.stacks.get(stack_identifier)
|
||||
output = self._stack_output(stack, output_key)
|
||||
|
@ -63,9 +63,6 @@ outputs:
|
||||
expect1=12, expect2=12)),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(DefaultParametersTest, self).setUp()
|
||||
|
||||
def test_defaults(self):
|
||||
env = {'parameters': {}, 'parameter_defaults': {}}
|
||||
if self.param:
|
||||
|
@ -43,9 +43,6 @@ outputs:
|
||||
value: { get_param: foo }
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(EncryptedParametersTest, self).setUp()
|
||||
|
||||
def test_db_encryption(self):
|
||||
# Create a stack with the value of 'foo' to be encrypted
|
||||
foo_param = 'my_encrypted_foo'
|
||||
|
@ -72,9 +72,6 @@ outputs:
|
||||
value: {get_attr: [random_str, value]}
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(HeatAutoscalingTest, self).setUp()
|
||||
|
||||
def _assert_output_values(self, stack_id):
|
||||
stack = self.client.stacks.get(stack_id)
|
||||
all_values = self._stack_output(stack, 'all_values')
|
||||
@ -120,9 +117,6 @@ resources:
|
||||
scaling_adjustment: 1
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(AutoScalingGroupUpdateWithNoChanges, self).setUp()
|
||||
|
||||
def test_as_group_update_without_resource_changes(self):
|
||||
stack_identifier = self.stack_create(template=self.template)
|
||||
new_template = self.template.replace(
|
||||
|
@ -42,9 +42,6 @@ outputs:
|
||||
value: {get_attr: [random_group, value]}
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(ResourceGroupTest, self).setUp()
|
||||
|
||||
def test_resource_group_zero_novalidate(self):
|
||||
# Nested resources should be validated only when size > 0
|
||||
# This allows features to be disabled via size=0 without
|
||||
@ -377,9 +374,6 @@ outputs:
|
||||
)),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(ResourceGroupTestNullParams, self).setUp()
|
||||
|
||||
def test_create_pass_zero_parameter(self):
|
||||
templ = self.template.replace('type: empty',
|
||||
'type: %s' % self.p_type)
|
||||
@ -417,9 +411,6 @@ outputs:
|
||||
value: {get_attr: [group1, resource.1.value]}
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(ResourceGroupAdoptTest, self).setUp()
|
||||
|
||||
def _yaml_to_json(self, yaml_templ):
|
||||
return yaml.safe_load(yaml_templ)
|
||||
|
||||
@ -489,9 +480,6 @@ resources:
|
||||
wait_secs: 2
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(ResourceGroupErrorResourceTest, self).setUp()
|
||||
|
||||
def test_fail(self):
|
||||
stack_identifier = self.stack_create(
|
||||
template=self.template,
|
||||
|
@ -32,9 +32,6 @@ outputs:
|
||||
value: { get_resource: test_resource }
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(StackEventsTest, self).setUp()
|
||||
|
||||
def _verify_event_fields(self, event, event_characteristics):
|
||||
self.assertIsNotNone(event_characteristics)
|
||||
self.assertIsNotNone(event.event_time)
|
||||
|
@ -33,9 +33,6 @@ outputs:
|
||||
|
||||
class SwiftSignalHandleUpdateTest(functional_base.FunctionalTestsBase):
|
||||
|
||||
def setUp(self):
|
||||
super(SwiftSignalHandleUpdateTest, self).setUp()
|
||||
|
||||
def test_stack_update_same_template_replace_no_url(self):
|
||||
stack_identifier = self.stack_create(template=test_template)
|
||||
stack = self.client.stacks.get(stack_identifier)
|
||||
|
@ -47,9 +47,6 @@ resource_registry:
|
||||
"OS::Heat::RandomString": nested.yaml
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(TemplateResourceTest, self).setUp()
|
||||
|
||||
def test_nested_env(self):
|
||||
main_templ = '''
|
||||
heat_template_version: 2013-05-23
|
||||
@ -172,9 +169,6 @@ resource_registry:
|
||||
"My::NestedSecret": nested.yaml
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(NestedAttributesTest, self).setUp()
|
||||
|
||||
def test_stack_ref(self):
|
||||
nested_templ = '''
|
||||
heat_template_version: 2014-10-16
|
||||
@ -496,9 +490,6 @@ Outputs:
|
||||
expect=NOCHANGE)),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(TemplateResourceUpdateTest, self).setUp()
|
||||
|
||||
def test_template_resource_update_template_schema(self):
|
||||
stack_identifier = self.stack_create(
|
||||
template=self.main_template,
|
||||
@ -598,9 +589,6 @@ Outputs:
|
||||
Value: {'Fn::GetAtt': [RealRandom, value]}
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(TemplateResourceAdoptTest, self).setUp()
|
||||
|
||||
def _yaml_to_json(self, yaml_templ):
|
||||
return yaml.safe_load(yaml_templ)
|
||||
|
||||
@ -680,9 +668,6 @@ Outputs:
|
||||
Value: {'Fn::GetAtt': [RealRandom, value]}
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(TemplateResourceCheckTest, self).setUp()
|
||||
|
||||
def test_check(self):
|
||||
stack_identifier = self.stack_create(
|
||||
template=self.main_template,
|
||||
@ -712,9 +697,6 @@ Resources:
|
||||
wait_secs: 2
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(TemplateResourceErrorMessageTest, self).setUp()
|
||||
|
||||
def test_fail(self):
|
||||
stack_identifier = self.stack_create(
|
||||
template=self.template,
|
||||
@ -747,9 +729,6 @@ resources:
|
||||
type: OS::Heat::RandomString
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(TemplateResourceSuspendResumeTest, self).setUp()
|
||||
|
||||
def test_suspend_resume(self):
|
||||
"""Basic test for template resource suspend resume."""
|
||||
stack_identifier = self.stack_create(
|
||||
|
@ -39,9 +39,6 @@ class TemplateAPITest(functional_base.FunctionalTestsBase):
|
||||
}
|
||||
}
|
||||
|
||||
def setUp(self):
|
||||
super(TemplateAPITest, self).setUp()
|
||||
|
||||
def test_get_stack_template(self):
|
||||
stack_identifier = self.stack_create(
|
||||
template=self.template
|
||||
|
@ -35,9 +35,6 @@ outputs:
|
||||
value: {get_attr: [\u8d44\u6e90, value]}
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(StackUnicodeTemplateTest, self).setUp()
|
||||
|
||||
def _assert_results(self, result):
|
||||
self.assertTrue(result['disable_rollback'])
|
||||
self.assertIsNone(result['parent'])
|
||||
|
Loading…
Reference in New Issue
Block a user