summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Razumovsky <prazumovsky@mirantis.com>2015-09-24 18:15:11 +0300
committerPeter Razumovsky <prazumovsky@mirantis.com>2015-10-12 14:08:16 +0300
commitc4b0ced813ba355c7e54cdacb4c347a44379ef16 (patch)
treea4d3662832bbee6686dceeafd6f7594a3a449f0b
parent34f32eef0e54bc7f19a9083a6f673e501da9255a (diff)
downloadheat-c4b0ced813ba355c7e54cdacb4c347a44379ef16.tar.gz
Fix [H405] pep rule in heat/tests
Implements bp docstring-improvements Change-Id: I2fd82d698f42aca3b34822875cf4d706fedbf5f2
-rw-r--r--heat/tests/api/aws/test_api_aws.py5
-rw-r--r--heat/tests/api/aws/test_api_ec2token.py4
-rw-r--r--heat/tests/api/cfn/test_api_cfn_v1.py3
-rw-r--r--heat/tests/api/cloudwatch/test_api_cloudwatch.py5
-rw-r--r--heat/tests/api/openstack_v1/test_actions.py5
-rw-r--r--heat/tests/api/openstack_v1/test_events.py5
-rw-r--r--heat/tests/api/openstack_v1/test_resources.py5
-rw-r--r--heat/tests/api/openstack_v1/test_stacks.py5
-rw-r--r--heat/tests/api/openstack_v1/tools.py7
-rw-r--r--heat/tests/autoscaling/test_heat_scaling_group.py4
-rw-r--r--heat/tests/autoscaling/test_scaling_template.py15
-rw-r--r--heat/tests/aws/test_instance.py37
-rw-r--r--heat/tests/ceilometer/test_ceilometer_alarm.py17
-rw-r--r--heat/tests/clients/test_cinder_client.py6
-rw-r--r--heat/tests/clients/test_glance_client.py5
-rw-r--r--heat/tests/clients/test_heat_client.py17
-rw-r--r--heat/tests/clients/test_nova_client.py9
-rw-r--r--heat/tests/clients/test_sahara_client.py5
-rw-r--r--heat/tests/convergence/framework/engine_wrapper.py12
-rw-r--r--heat/tests/convergence/framework/message_processor.py22
-rw-r--r--heat/tests/engine/service/test_stack_update.py14
-rw-r--r--heat/tests/engine/tools.py5
-rw-r--r--heat/tests/fakes.py11
-rw-r--r--heat/tests/generic_resource.py4
-rw-r--r--heat/tests/nova/test_server.py21
-rw-r--r--heat/tests/openstack/monasca/test_alarm_definition.py7
-rw-r--r--heat/tests/openstack/monasca/test_notification.py7
-rw-r--r--heat/tests/test_common_context.py16
-rw-r--r--heat/tests/test_constraints.py22
-rw-r--r--heat/tests/test_convg_stack.py1
-rw-r--r--heat/tests/test_cw_alarm.py12
-rw-r--r--heat/tests/test_dbinstance.py9
-rw-r--r--heat/tests/test_engine_api_utils.py4
-rw-r--r--heat/tests/test_engine_service.py13
-rw-r--r--heat/tests/test_engine_service_stack_watch.py12
-rw-r--r--heat/tests/test_environment.py16
-rw-r--r--heat/tests/test_hot.py37
-rw-r--r--heat/tests/test_lifecycle_plugin_utils.py41
-rw-r--r--heat/tests/test_metadata_refresh.py15
-rw-r--r--heat/tests/test_provider_template.py6
-rw-r--r--heat/tests/test_resource.py32
-rw-r--r--heat/tests/test_resource_group.py34
-rw-r--r--heat/tests/test_rpc_client.py3
-rw-r--r--heat/tests/test_software_deployment.py3
-rw-r--r--heat/tests/test_stack.py44
-rw-r--r--heat/tests/test_stack_resource.py28
-rw-r--r--heat/tests/test_stack_update.py71
-rw-r--r--heat/tests/test_structured_config.py3
-rw-r--r--heat/tests/test_swift.py6
49 files changed, 343 insertions, 347 deletions
diff --git a/heat/tests/api/aws/test_api_aws.py b/heat/tests/api/aws/test_api_aws.py
index 98d199f4f..50f7e345b 100644
--- a/heat/tests/api/aws/test_api_aws.py
+++ b/heat/tests/api/aws/test_api_aws.py
@@ -18,9 +18,8 @@ from heat.tests import common
class AWSCommonTest(common.HeatTestCase):
- '''
- Tests the api/aws common components
- '''
+ """Tests the api/aws common components."""
+
# The tests
def test_format_response(self):
response = api_utils.format_response("Foo", "Bar")
diff --git a/heat/tests/api/aws/test_api_ec2token.py b/heat/tests/api/aws/test_api_ec2token.py
index dae129b53..22d33a92b 100644
--- a/heat/tests/api/aws/test_api_ec2token.py
+++ b/heat/tests/api/aws/test_api_ec2token.py
@@ -28,9 +28,7 @@ from heat.tests import utils
class Ec2TokenTest(common.HeatTestCase):
- """
- Tests the Ec2Token middleware
- """
+ """Tests the Ec2Token middleware."""
def setUp(self):
super(Ec2TokenTest, self).setUp()
diff --git a/heat/tests/api/cfn/test_api_cfn_v1.py b/heat/tests/api/cfn/test_api_cfn_v1.py
index 16ec97e21..c863c4f91 100644
--- a/heat/tests/api/cfn/test_api_cfn_v1.py
+++ b/heat/tests/api/cfn/test_api_cfn_v1.py
@@ -33,7 +33,8 @@ policy_path = os.path.dirname(os.path.realpath(__file__)) + "/../../policy/"
class CfnStackControllerTest(common.HeatTestCase):
- """
+ """Tests the API class CfnStackController.
+
Tests the API class which acts as the WSGI controller,
the endpoint processing API requests after they are routed
"""
diff --git a/heat/tests/api/cloudwatch/test_api_cloudwatch.py b/heat/tests/api/cloudwatch/test_api_cloudwatch.py
index 55756529e..28ce12b2b 100644
--- a/heat/tests/api/cloudwatch/test_api_cloudwatch.py
+++ b/heat/tests/api/cloudwatch/test_api_cloudwatch.py
@@ -27,10 +27,11 @@ from heat.tests import utils
class WatchControllerTest(common.HeatTestCase):
- '''
+ """Tests the API class WatchController.
+
Tests the API class which acts as the WSGI controller,
the endpoint processing API requests after they are routed
- '''
+ """
def setUp(self):
super(WatchControllerTest, self).setUp()
diff --git a/heat/tests/api/openstack_v1/test_actions.py b/heat/tests/api/openstack_v1/test_actions.py
index d206764b1..701f0cc69 100644
--- a/heat/tests/api/openstack_v1/test_actions.py
+++ b/heat/tests/api/openstack_v1/test_actions.py
@@ -28,10 +28,11 @@ from heat.tests import common
@mock.patch.object(policy.Enforcer, 'enforce')
class ActionControllerTest(tools.ControllerTest, common.HeatTestCase):
- '''
+ """Tests the API class ActionController.
+
Tests the API class which acts as the WSGI controller,
the endpoint processing API requests after they are routed
- '''
+ """
def setUp(self):
super(ActionControllerTest, self).setUp()
diff --git a/heat/tests/api/openstack_v1/test_events.py b/heat/tests/api/openstack_v1/test_events.py
index f71bbcf58..e96eaf09a 100644
--- a/heat/tests/api/openstack_v1/test_events.py
+++ b/heat/tests/api/openstack_v1/test_events.py
@@ -27,10 +27,11 @@ from heat.tests import common
@mock.patch.object(policy.Enforcer, 'enforce')
class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
- '''
+ """Tests the API class EventController.
+
Tests the API class which acts as the WSGI controller,
the endpoint processing API requests after they are routed
- '''
+ """
def setUp(self):
super(EventControllerTest, self).setUp()
diff --git a/heat/tests/api/openstack_v1/test_resources.py b/heat/tests/api/openstack_v1/test_resources.py
index 9fe899f83..27e2da256 100644
--- a/heat/tests/api/openstack_v1/test_resources.py
+++ b/heat/tests/api/openstack_v1/test_resources.py
@@ -28,10 +28,11 @@ from heat.tests import common
@mock.patch.object(policy.Enforcer, 'enforce')
class ResourceControllerTest(tools.ControllerTest, common.HeatTestCase):
- '''
+ """Tests the API class ResourceController.
+
Tests the API class which acts as the WSGI controller,
the endpoint processing API requests after they are routed
- '''
+ """
def setUp(self):
super(ResourceControllerTest, self).setUp()
diff --git a/heat/tests/api/openstack_v1/test_stacks.py b/heat/tests/api/openstack_v1/test_stacks.py
index 0c1e51320..c17eb9404 100644
--- a/heat/tests/api/openstack_v1/test_stacks.py
+++ b/heat/tests/api/openstack_v1/test_stacks.py
@@ -201,10 +201,11 @@ blarg: wibble
@mock.patch.object(policy.Enforcer, 'enforce')
class StackControllerTest(tools.ControllerTest, common.HeatTestCase):
- '''
+ """Tests the API class StackController.
+
Tests the API class which acts as the WSGI controller,
the endpoint processing API requests after they are routed
- '''
+ """
def setUp(self):
super(StackControllerTest, self).setUp()
diff --git a/heat/tests/api/openstack_v1/tools.py b/heat/tests/api/openstack_v1/tools.py
index 1bddc9bee..5212cc659 100644
--- a/heat/tests/api/openstack_v1/tools.py
+++ b/heat/tests/api/openstack_v1/tools.py
@@ -33,8 +33,7 @@ def request_with_middleware(middleware, func, req, *args, **kwargs):
def to_remote_error(error):
- """Converts the given exception to the one with the _Remote suffix.
- """
+ """Converts the given exception to the one with the _Remote suffix."""
exc_info = (type(error), error, None)
serialized = rpc_common.serialize_remote_exception(exc_info)
remote_error = rpc_common.deserialize_remote_exception(
@@ -43,9 +42,7 @@ def to_remote_error(error):
class ControllerTest(object):
- """
- Common utilities for testing API Controllers.
- """
+ """Common utilities for testing API Controllers."""
def __init__(self, *args, **kwargs):
super(ControllerTest, self).__init__(*args, **kwargs)
diff --git a/heat/tests/autoscaling/test_heat_scaling_group.py b/heat/tests/autoscaling/test_heat_scaling_group.py
index 903fa7fcf..623cb28dc 100644
--- a/heat/tests/autoscaling/test_heat_scaling_group.py
+++ b/heat/tests/autoscaling/test_heat_scaling_group.py
@@ -397,7 +397,9 @@ class HeatScalingGroupAttrTest(common.HeatTestCase):
self.assertIsNone(self.group.validate())
def test_no_instance_list(self):
- """The InstanceList attribute is not inherited from
+ """Tests inheritance of InstanceList attribute.
+
+ The InstanceList attribute is not inherited from
AutoScalingResourceGroup's superclasses.
"""
self.assertRaises(exception.InvalidTemplateAttribute,
diff --git a/heat/tests/autoscaling/test_scaling_template.py b/heat/tests/autoscaling/test_scaling_template.py
index b9b35ce86..989e10813 100644
--- a/heat/tests/autoscaling/test_scaling_template.py
+++ b/heat/tests/autoscaling/test_scaling_template.py
@@ -25,7 +25,8 @@ class ResourceTemplatesTest(common.HeatTestCase):
self.next_id = lambda: next(ids)
def test_create_template(self):
- """
+ """Test case for creating template.
+
When creating a template from scratch, an empty list is accepted as
the "old" resources and new resources are created up to num_resource.
"""
@@ -37,7 +38,8 @@ class ResourceTemplatesTest(common.HeatTestCase):
self.assertEqual(expected, list(templates))
def test_replace_template(self):
- """
+ """Test case for replacing template.
+
If num_replace is the number of old resources, then all of the
resources will be replaced.
"""
@@ -50,7 +52,8 @@ class ResourceTemplatesTest(common.HeatTestCase):
self.assertEqual(expected, list(templates))
def test_replace_some_units(self):
- """
+ """Test case for making only the number of replacements specified.
+
If the resource definition changes, only the number of replacements
specified will be made; beyond that, the original templates are used.
"""
@@ -66,7 +69,8 @@ class ResourceTemplatesTest(common.HeatTestCase):
self.assertEqual(expected, list(templates))
def test_growth_counts_as_replacement(self):
- """
+ """Test case for growing template.
+
If we grow the template and replace some elements at the same time, the
number of replacements to perform is reduced by the number of new
resources to be created.
@@ -86,7 +90,8 @@ class ResourceTemplatesTest(common.HeatTestCase):
self.assertEqual(expected, list(templates))
def test_replace_units_some_already_up_to_date(self):
- """
+ """Test case for up-to-date resources in template.
+
If some of the old resources already have the new resource definition,
then they won't be considered for replacement, and the next resource
that is out-of-date will be replaced.
diff --git a/heat/tests/aws/test_instance.py b/heat/tests/aws/test_instance.py
index 66876524c..d6c87205c 100644
--- a/heat/tests/aws/test_instance.py
+++ b/heat/tests/aws/test_instance.py
@@ -714,7 +714,8 @@ class InstancesTest(common.HeatTestCase):
self.assertEqual({'test': 123}, instance.metadata_get())
def test_instance_update_instance_type(self):
- """
+ """Test case for updating InstanceType.
+
Instance.handle_update supports changing the InstanceType, and makes
the change making a resize API call against Nova.
"""
@@ -761,7 +762,8 @@ class InstancesTest(common.HeatTestCase):
self.m.VerifyAll()
def test_instance_update_instance_type_failed(self):
- """
+ """Test case for raising exception due to resize call failed.
+
If the status after a resize is not VERIFY_RESIZE, it means the resize
call failed, so we raise an explicit error.
"""
@@ -812,7 +814,8 @@ class InstancesTest(common.HeatTestCase):
return fake_interface(port, net, ip)
def test_instance_update_network_interfaces(self):
- """
+ """Test case for updating NetworkInterfaces.
+
Instance.handle_update supports changing the NetworkInterfaces,
and makes the change making a resize API call against Nova.
"""
@@ -853,7 +856,8 @@ class InstancesTest(common.HeatTestCase):
self.m.VerifyAll()
def test_instance_update_network_interfaces_old_include_new(self):
- """
+ """Test case for updating NetworkInterfaces when old prop includes new.
+
Instance.handle_update supports changing the NetworkInterfaces,
and makes the change making a resize API call against Nova.
"""
@@ -888,7 +892,8 @@ class InstancesTest(common.HeatTestCase):
self.assertEqual((instance.UPDATE, instance.COMPLETE), instance.state)
def test_instance_update_network_interfaces_new_include_old(self):
- """
+ """Test case for updating NetworkInterfaces when new prop includes old.
+
Instance.handle_update supports changing the NetworkInterfaces,
and makes the change making a resize API call against Nova.
"""
@@ -923,7 +928,8 @@ class InstancesTest(common.HeatTestCase):
self.assertEqual((instance.UPDATE, instance.COMPLETE), instance.state)
def test_instance_update_network_interfaces_new_old_all_different(self):
- """
+ """Tests updating NetworkInterfaces when new and old are different.
+
Instance.handle_update supports changing the NetworkInterfaces,
and makes the change making a resize API call against Nova.
"""
@@ -963,7 +969,8 @@ class InstancesTest(common.HeatTestCase):
self.assertEqual((instance.UPDATE, instance.COMPLETE), instance.state)
def test_instance_update_network_interfaces_no_old(self):
- """
+ """Test case for updating NetworkInterfaces when there's no old prop.
+
Instance.handle_update supports changing the NetworkInterfaces,
and makes the change making a resize API call against Nova.
"""
@@ -1004,8 +1011,9 @@ class InstancesTest(common.HeatTestCase):
self.m.VerifyAll()
def test_instance_update_network_interfaces_no_old_empty_new(self):
- """
- Instance.handle_update supports changing the NetworkInterfaces
+ """Test case for updating NetworkInterfaces when no old, no new prop.
+
+ Instance.handle_update supports changing the NetworkInterfaces.
"""
return_server = self.fc.servers.list()[1]
return_server.id = '1234'
@@ -1083,9 +1091,7 @@ class InstancesTest(common.HeatTestCase):
self.m.VerifyAll()
def test_instance_update_network_interfaces_empty_new_with_subnet(self):
- """
- Test update NetworkInterfaces to empty, and update with subnet.
- """
+ """Test update NetworkInterfaces to empty, and update with subnet."""
stack_name = 'ud_network_interfaces_empty_with_subnet'
self._test_instance_update_with_subnet(
stack_name, new_interfaces=[])
@@ -1334,9 +1340,10 @@ class InstancesTest(common.HeatTestCase):
))
def test_build_nics_with_security_groups(self):
- """
- Test the security groups defined in heat template can be associated
- to a new created port.
+ """Test the security groups can be associated to a new created port.
+
+ Test the security groups defined in heat template can be associated to
+ a new created port.
"""
return_server = self.fc.servers.list()[1]
instance = self._create_test_instance(return_server,
diff --git a/heat/tests/ceilometer/test_ceilometer_alarm.py b/heat/tests/ceilometer/test_ceilometer_alarm.py
index 066e322e7..afe63895b 100644
--- a/heat/tests/ceilometer/test_ceilometer_alarm.py
+++ b/heat/tests/ceilometer/test_ceilometer_alarm.py
@@ -205,10 +205,8 @@ class CeilometerAlarmTest(common.HeatTestCase):
return stack
def test_mem_alarm_high_update_no_replace(self):
- '''
- Make sure that we can change the update-able properties
- without replacing the Alarm rsrc.
- '''
+ """Tests update updatable properties without replacing the Alarm."""
+
# short circuit the alarm's references
t = template_format.parse(alarm_template)
properties = t['Resources']['MEMAlarmHigh']['Properties']
@@ -270,10 +268,8 @@ class CeilometerAlarmTest(common.HeatTestCase):
self.m.VerifyAll()
def test_mem_alarm_high_update_replace(self):
- '''
- Make sure that the Alarm resource IS replaced when non-update-able
- properties are changed.
- '''
+ """Tests resource replacing when changing non-updatable properties."""
+
t = template_format.parse(alarm_template)
properties = t['Resources']['MEMAlarmHigh']['Properties']
properties['alarm_actions'] = ['signal_handler']
@@ -297,9 +293,10 @@ class CeilometerAlarmTest(common.HeatTestCase):
self.m.VerifyAll()
def test_mem_alarm_suspend_resume(self):
- """
+ """Tests suspending and resuming of the alarm.
+
Make sure that the Alarm resource gets disabled on suspend
- and reenabled on resume.
+ and re-enabled on resume.
"""
self.stack = self.create_stack()
diff --git a/heat/tests/clients/test_cinder_client.py b/heat/tests/clients/test_cinder_client.py
index fefd94185..98c089395 100644
--- a/heat/tests/clients/test_cinder_client.py
+++ b/heat/tests/clients/test_cinder_client.py
@@ -23,10 +23,8 @@ from heat.tests import utils
class CinderClientPluginTests(common.HeatTestCase):
- """
- Basic tests for the helper methods in
- :module:'heat.engine.clients.os.cinder'.
- """
+ """Basic tests for :module:'heat.engine.clients.os.cinder'."""
+
def setUp(self):
super(CinderClientPluginTests, self).setUp()
self.cinder_client = mock.MagicMock()
diff --git a/heat/tests/clients/test_glance_client.py b/heat/tests/clients/test_glance_client.py
index 27dabac07..c8db6e2e9 100644
--- a/heat/tests/clients/test_glance_client.py
+++ b/heat/tests/clients/test_glance_client.py
@@ -24,10 +24,7 @@ from heat.tests import utils
class GlanceUtilsTests(common.HeatTestCase):
- """
- Basic tests for the helper methods in
- :module:'heat.engine.resources.clients.os.glance'.
- """
+ """Basic tests for :module:'heat.engine.resources.clients.os.glance'."""
def setUp(self):
super(GlanceUtilsTests, self).setUp()
diff --git a/heat/tests/clients/test_heat_client.py b/heat/tests/clients/test_heat_client.py
index d4e5289a8..c32bf5392 100644
--- a/heat/tests/clients/test_heat_client.py
+++ b/heat/tests/clients/test_heat_client.py
@@ -1372,10 +1372,7 @@ class KeystoneClientTest(common.HeatTestCase):
project_id='aprojectid'))
def _test_url_for(self, service_url, expected_kwargs, ctx=None, **kwargs):
- """
- Helper function for testing url_for depending on different ways to
- pass region name.
- """
+ """Testing url_for depending on different ways to pass region name."""
mock_ks_auth, mock_auth_ref = self._stubs_v3(client=False)
mock_ks_auth.get_endpoint(mox.IsA(ks_session.Session),
**expected_kwargs).AndReturn(service_url)
@@ -1387,7 +1384,8 @@ class KeystoneClientTest(common.HeatTestCase):
self.m.VerifyAll()
def test_url_for(self):
- """
+ """Test that None value is passed as region name.
+
Test that None value is passed as region name if region name is not
specified in the config file or as one of the arguments.
"""
@@ -1399,7 +1397,8 @@ class KeystoneClientTest(common.HeatTestCase):
self._test_url_for(service_url, kwargs)
def test_url_for_with_region(self):
- """
+ """Test that region name passed as argument.
+
Test that region name passed as argument is not override by region name
specified in the config file.
"""
@@ -1411,7 +1410,8 @@ class KeystoneClientTest(common.HeatTestCase):
self._test_url_for(service_url, kwargs, None, **kwargs)
def test_url_for_with_region_name_from_config(self):
- """
+ """Test default region name for services from config file is passed.
+
Test that default region name for services from config file is passed
if region name is not specified in arguments.
"""
@@ -1425,7 +1425,8 @@ class KeystoneClientTest(common.HeatTestCase):
self._test_url_for(service_url, kwargs)
def test_url_for_with_region_name_from_context(self):
- """
+ """Test that default region name for services from context is passed.
+
Test that default region name for services from context is passed
if region name is not specified in arguments.
"""
diff --git a/heat/tests/clients/test_nova_client.py b/heat/tests/clients/test_nova_client.py
index bd24aa914..83e74ae69 100644
--- a/heat/tests/clients/test_nova_client.py
+++ b/heat/tests/clients/test_nova_client.py
@@ -40,10 +40,7 @@ class NovaClientPluginTestCase(common.HeatTestCase):
class NovaClientPluginTests(NovaClientPluginTestCase):
- """
- Basic tests for the helper methods in
- :module:'heat.engine.clients.os.nova'.
- """
+ """Basic tests for :module:'heat.engine.clients.os.nova'."""
def test_create(self):
context = utils.dummy_context()
@@ -393,9 +390,7 @@ class NovaClientPluginMetadataTests(NovaClientPluginTestCase):
self.assertEqual(expected, self.nova_plugin.meta_serialize(original))
def test_serialize_no_value(self):
- """This test is to prove that the user can only pass in a dict to nova
- metadata.
- """
+ """Prove that the user can only pass in a dict to nova metadata."""
excp = self.assertRaises(exception.StackValidationFailed,
self.nova_plugin.meta_serialize, "foo")
self.assertIn('metadata needs to be a Map', six.text_type(excp))
diff --git a/heat/tests/clients/test_sahara_client.py b/heat/tests/clients/test_sahara_client.py
index 10c19b29e..9f8f504f0 100644
--- a/heat/tests/clients/test_sahara_client.py
+++ b/heat/tests/clients/test_sahara_client.py
@@ -24,10 +24,7 @@ from heat.tests import utils
class SaharaUtilsTests(common.HeatTestCase):
- """
- Basic tests for the helper methods in
- :module:'heat.engine.resources.clients.os.sahara'.
- """
+ """Basic tests :module:'heat.engine.resources.clients.os.sahara'."""
def setUp(self):
super(SaharaUtilsTests, self).setUp()
diff --git a/heat/tests/convergence/framework/engine_wrapper.py b/heat/tests/convergence/framework/engine_wrapper.py
index a76af6409..965e3b6bc 100644
--- a/heat/tests/convergence/framework/engine_wrapper.py
+++ b/heat/tests/convergence/framework/engine_wrapper.py
@@ -23,10 +23,10 @@ from heat.tests import utils
class Engine(message_processor.MessageProcessor):
- '''
- Wrapper to the engine service. Methods of this
- class will be called from the scenario tests.
- '''
+ """Wrapper to the engine service.
+
+ Methods of this class will be called from the scenario tests.
+ """
queue = message_queue.MessageQueue('engine')
@@ -34,9 +34,7 @@ class Engine(message_processor.MessageProcessor):
super(Engine, self).__init__('engine')
def scenario_template_to_hot(self, scenario_tmpl):
- '''
- Converts the scenario template into hot template.
- '''
+ """Converts the scenario template into hot template."""
hot_tmpl = {"heat_template_version": "2013-05-23"}
resources = {}
for res_name, res_def in six.iteritems(scenario_tmpl.resources):
diff --git a/heat/tests/convergence/framework/message_processor.py b/heat/tests/convergence/framework/message_processor.py
index 7aff5353a..66d5dbd9c 100644
--- a/heat/tests/convergence/framework/message_processor.py
+++ b/heat/tests/convergence/framework/message_processor.py
@@ -21,12 +21,13 @@ LOG = logging.getLogger(__name__)
def asynchronous(function):
- '''Decorator for MessageProcessor methods to make them asynchronous.
+ """Decorator for MessageProcessor methods to make them asynchronous.
To use, simply call the method as usual. Instead of being executed
immediately, it will be placed on the queue for the MessageProcessor and
run on a future iteration of the event loop.
- '''
+ """
+
arg_names = inspect.getargspec(function).args
MessageData = collections.namedtuple(function.__name__, arg_names[1:])
@@ -76,9 +77,7 @@ class MessageProcessor(object):
@asynchronous
def noop(self, count=1):
- '''
- Insert <count> No-op operations in the message queue.
- '''
+ """Insert <count> No-op operations in the message queue."""
assert isinstance(count, int)
if count > 1:
self.queue.send_priority('noop',
@@ -86,24 +85,19 @@ class MessageProcessor(object):
@asynchronous
def _execute(self, func):
- '''
- Insert a function call in the message queue.
+ """Insert a function call in the message queue.
The function takes no arguments, so use functools.partial to curry the
arguments before passing it here.
- '''
+ """
func()
def call(self, func, *args, **kwargs):
- '''
- Insert a function call in the message queue.
- '''
+ """Insert a function call in the message queue."""
self._execute(functools.partial(func, *args, **kwargs))
def clear(self):
- '''
- Delete all the messages from the queue.
- '''
+ """Delete all the messages from the queue."""
self.queue.clear()
__all__ = ['MessageProcessor', 'asynchronous']
diff --git a/heat/tests/engine/service/test_stack_update.py b/heat/tests/engine/service/test_stack_update.py
index 01c08818f..4551eb02a 100644
--- a/heat/tests/engine/service/test_stack_update.py
+++ b/heat/tests/engine/service/test_stack_update.py
@@ -127,10 +127,12 @@ class ServiceStackUpdateTest(common.HeatTestCase):
self.assertEqual(stk.identifier(), result)
def test_stack_update_existing_parameters_remove(self):
- '''Use a template with existing parameters, then update with a
+ """Test case for updating stack with changed parameters.
+
+ Use a template with existing parameters, then update with a
template containing additional parameters and a list of
parameters to be removed.
- '''
+ """
stack_name = 'service_update_test_stack_existing_parameters_remove'
update_params = {'encrypted_param_names': [],
'parameter_defaults': {},
@@ -227,9 +229,11 @@ class ServiceStackUpdateTest(common.HeatTestCase):
self.assertEqual(stk.identifier(), result)
def test_stack_update_existing_parameter_defaults(self):
- '''Use a template with existing flag and ensure the
- environment parameter_defaults are preserved.
- '''
+ """Ensure the environment parameter_defaults are preserved.
+
+ Use a template with existing flag and ensure the environment
+ parameter_defaults are preserved.
+ """
stack_name = 'service_update_test_stack_existing_param_defaults'
intial_params = {'encrypted_param_names': [],
'parameter_defaults': {'mydefault': 123},
diff --git a/heat/tests/engine/tools.py b/heat/tests/engine/tools.py
index af71ce279..283cb1b07 100644
--- a/heat/tests/engine/tools.py
+++ b/heat/tests/engine/tools.py
@@ -250,10 +250,11 @@ def clean_up_stack(stack, delete_res=True):
def stack_context(stack_name, create_res=True):
- """
+ """Decorator for creating and deleting stack.
+
Decorator which creates a stack by using the test case's context and
deletes it afterwards to ensure tests clean up their stacks regardless
- of test success/failure
+ of test success/failure.
"""
def stack_delete(test_fn):
@six.wraps(test_fn)
diff --git a/heat/tests/fakes.py b/heat/tests/fakes.py
index 02d5d9eda..edeb2d661 100644
--- a/heat/tests/fakes.py
+++ b/heat/tests/fakes.py
@@ -11,8 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-"""
-A fake server that "responds" to API methods with pre-canned responses.
+"""A fake server that "responds" to API methods with pre-canned responses.
All of these responses come from the spec, so if for some reason the spec's
wrong the tests might raise AssertionError. I've indicated in comments the
@@ -28,9 +27,7 @@ from heat.common import context
class FakeClient(object):
def assert_called(self, method, url, body=None, pos=-1):
- """
- Assert than an API method was just called.
- """
+ """Assert that an API method was just called."""
expected = (method, url)
called = self.client.callstack[pos][0:2]
@@ -44,9 +41,7 @@ class FakeClient(object):
assert self.client.callstack[pos][2] == body
def assert_called_anytime(self, method, url, body=None):
- """
- Assert than an API method was called anytime in the test.
- """
+ """Assert that an API method was called anytime in the test."""
expected = (method, url)
assert self.client.callstack, ("Expected %s %s but no calls "
diff --git a/heat/tests/generic_resource.py b/heat/tests/generic_resource.py
index 7306c770b..6e4c63bb5 100644
--- a/heat/tests/generic_resource.py
+++ b/heat/tests/generic_resource.py
@@ -28,9 +28,7 @@ LOG = logging.getLogger(__name__)
class GenericResource(resource.Resource):
- '''
- Dummy resource for use in tests
- '''
+ """Dummy resource for use in tests."""
properties_schema = {}
attributes_schema = collections.OrderedDict([
('foo', attributes.Schema('A generic attribute')),
diff --git a/heat/tests/nova/test_server.py b/heat/tests/nova/test_server.py
index 342433d7b..11150e9ce 100644
--- a/heat/tests/nova/test_server.py
+++ b/heat/tests/nova/test_server.py
@@ -1646,9 +1646,10 @@ class ServersTest(common.HeatTestCase):
self.m.VerifyAll()
def test_server_update_nova_metadata_complex(self):
- """
- Test that complex metadata values are correctly serialized
- to JSON when sent to Nova.
+ """Test that complex metadata values are correctly serialized to JSON.
+
+ Test that complex metadata values are correctly serialized to JSON when
+ sent to Nova.
"""
return_server = self.fc.servers.list()[1]
@@ -1720,9 +1721,7 @@ class ServersTest(common.HeatTestCase):
self.m.VerifyAll()
def test_server_update_server_name(self):
- """
- Server.handle_update supports changing the name.
- """
+ """Server.handle_update supports changing the name."""
return_server = self.fc.servers.list()[1]
return_server.id = '5678'
server = self._create_test_server(return_server,
@@ -1743,9 +1742,7 @@ class ServersTest(common.HeatTestCase):
self.m.VerifyAll()
def test_server_update_server_admin_password(self):
- """
- Server.handle_update supports changing the admin password.
- """
+ """Server.handle_update supports changing the admin password."""
return_server = self.fc.servers.list()[1]
return_server.id = '5678'
server = self._create_test_server(return_server,
@@ -1764,7 +1761,8 @@ class ServersTest(common.HeatTestCase):
self.assertEqual(1, return_server.change_password.call_count)
def test_server_update_server_flavor(self):
- """
+ """Tests update server changing the flavor.
+
Server.handle_update supports changing the flavor, and makes
the change making a resize API call against Nova.
"""
@@ -1811,7 +1809,8 @@ class ServersTest(common.HeatTestCase):
self.m.VerifyAll()
def test_server_update_server_flavor_failed(self):
- """
+ """Check raising exception due to resize call failing.
+
If the status after a resize is not VERIFY_RESIZE, it means the resize
call failed, so we raise an explicit error.
"""
diff --git a/heat/tests/openstack/monasca/test_alarm_definition.py b/heat/tests/openstack/monasca/test_alarm_definition.py
index 6b2563207..5157ddc1e 100644
--- a/heat/tests/openstack/monasca/test_alarm_definition.py
+++ b/heat/tests/openstack/monasca/test_alarm_definition.py
@@ -46,10 +46,11 @@ RESOURCE_TYPE = 'OS::Monasca::AlarmDefinition'
class MonascaAlarmDefinition(alarm_definition.MonascaAlarmDefinition):
- '''
+ """This class overrides the is_service_available to return True.
+
Monasca service is not available by default. So, this class overrides
- the is_service_available to return True
- '''
+ the is_service_available to return True.
+ """
@classmethod
def is_service_available(cls, context):
return True
diff --git a/heat/tests/openstack/monasca/test_notification.py b/heat/tests/openstack/monasca/test_notification.py
index b5365afaf..619dea94c 100644
--- a/heat/tests/openstack/monasca/test_notification.py
+++ b/heat/tests/openstack/monasca/test_notification.py
@@ -40,10 +40,11 @@ RESOURCE_TYPE = 'OS::Monasca::Notification'
class MonascaNotification(notification.MonascaNotification):
- '''
+ """This class overrides the is_service_available to return True.
+
Monasca service is not available by default. So, this class overrides
- the is_service_available to return True
- '''
+ the is_service_available to return True.
+ """
@classmethod
def is_service_available(cls, context):
return True
diff --git a/heat/tests/test_common_context.py b/heat/tests/test_common_context.py
index 5de3515b8..a883b3e90 100644
--- a/heat/tests/test_common_context.py
+++ b/heat/tests/test_common_context.py
@@ -114,9 +114,7 @@ class TestRequestContext(common.HeatTestCase):
self.assertFalse(ctx.is_admin)
def test_keystone_v3_endpoint_in_context(self):
- """Ensure that the context is the preferred source for the
- auth_uri.
- """
+ """Ensure that the context is the preferred source for the auth_uri."""
cfg.CONF.set_override('auth_uri', 'http://xyz',
group='clients_keystone')
policy_check = 'heat.common.policy.Enforcer.check_is_admin'
@@ -128,7 +126,9 @@ class TestRequestContext(common.HeatTestCase):
'http://example.com:5000/v3')
def test_keystone_v3_endpoint_in_clients_keystone_config(self):
- """Ensure that the [clients_keystone] section of the configuration is
+ """Ensure that the [clients_keystone] section is the preferred source.
+
+ Ensure that the [clients_keystone] section of the configuration is
the preferred source when the context does not have the auth_uri.
"""
cfg.CONF.set_override('auth_uri', 'http://xyz',
@@ -149,7 +149,9 @@ class TestRequestContext(common.HeatTestCase):
self.assertEqual(ctx.keystone_v3_endpoint, 'http://xyz/v3')
def test_keystone_v3_endpoint_in_keystone_authtoken_config(self):
- """Ensure that the [keystone_authtoken] section of the configuration
+ """Ensure that the [keystone_authtoken] section is used.
+
+ Ensure that the [keystone_authtoken] section of the configuration
is used when the auth_uri is not defined in the context or the
[clients_keystone] section.
"""
@@ -163,7 +165,9 @@ class TestRequestContext(common.HeatTestCase):
self.assertEqual(ctx.keystone_v3_endpoint, 'http://abc/v3')
def test_keystone_v3_endpoint_not_set_in_config(self):
- """Ensure an exception is raised when the auth_uri cannot be obtained
+ """Ensure an exception is raised when the auth_uri cannot be obtained.
+
+ Ensure an exception is raised when the auth_uri cannot be obtained
from any source.
"""
policy_check = 'heat.common.policy.Enforcer.check_is_admin'
diff --git a/heat/tests/test_constraints.py b/heat/tests/test_constraints.py
index 053062253..292b544c7 100644
--- a/heat/tests/test_constraints.py
+++ b/heat/tests/test_constraints.py
@@ -278,13 +278,12 @@ class SchemaTest(common.HeatTestCase):
six.text_type(err))
def test_allowed_values_numeric_int(self):
- '''
- Test AllowedValues constraint for numeric integer values.
+ """Test AllowedValues constraint for numeric integer values.
Test if the AllowedValues constraint works for numeric values in any
combination of numeric strings or numbers in the constraint and
numeric strings or numbers as value.
- '''
+ """
# Allowed values defined as integer numbers
schema = constraints.Schema(
@@ -321,13 +320,12 @@ class SchemaTest(common.HeatTestCase):
six.text_type(err))
def test_allowed_values_numeric_float(self):
- '''
- Test AllowedValues constraint for numeric floating point values.
+ """Test AllowedValues constraint for numeric floating point values.
Test if the AllowedValues constraint works for numeric values in any
combination of numeric strings or numbers in the constraint and
numeric strings or numbers as value.
- '''
+ """
# Allowed values defined as numbers
schema = constraints.Schema(
@@ -364,7 +362,7 @@ class SchemaTest(common.HeatTestCase):
six.text_type(err))
def test_to_schema_type_int(self):
- '''Test Schema.to_schema_type method for type Integer.'''
+ """Test Schema.to_schema_type method for type Integer."""
schema = constraints.Schema('Integer')
# test valid values, i.e. integeres as string or number
res = schema.to_schema_type(1)
@@ -384,7 +382,7 @@ class SchemaTest(common.HeatTestCase):
six.text_type(err))
def test_to_schema_type_num(self):
- '''Test Schema.to_schema_type method for type Number.'''
+ """Test Schema.to_schema_type method for type Number."""
schema = constraints.Schema('Number')
res = schema.to_schema_type(1)
self.assertIsInstance(res, int)
@@ -400,7 +398,7 @@ class SchemaTest(common.HeatTestCase):
six.text_type(err))
def test_to_schema_type_string(self):
- '''Test Schema.to_schema_type method for type String.'''
+ """Test Schema.to_schema_type method for type String."""
schema = constraints.Schema('String')
res = schema.to_schema_type('one')
self.assertIsInstance(res, six.string_types)
@@ -414,7 +412,7 @@ class SchemaTest(common.HeatTestCase):
self.assertIsInstance(res, six.string_types)
def test_to_schema_type_boolean(self):
- '''Test Schema.to_schema_type method for type Boolean.'''
+ """Test Schema.to_schema_type method for type Boolean."""
schema = constraints.Schema('Boolean')
true_values = [1, '1', True, 'true', 'True', 'yes', 'Yes']
@@ -434,14 +432,14 @@ class SchemaTest(common.HeatTestCase):
six.text_type(err))
def test_to_schema_type_map(self):
- '''Test Schema.to_schema_type method for type Map.'''
+ """Test Schema.to_schema_type method for type Map."""
schema = constraints.Schema('Map')
res = schema.to_schema_type({'a': 'aa', 'b': 'bb'})
self.assertIsInstance(res, dict)
self.assertEqual({'a': 'aa', 'b': 'bb'}, res)
def test_to_schema_type_list(self):
- '''Test Schema.to_schema_type method for type List.'''
+ """Test Schema.to_schema_type method for type List."""
schema = constraints.Schema('List')
res = schema.to_schema_type(['a', 'b'])
self.assertIsInstance(res, list)
diff --git a/heat/tests/test_convg_stack.py b/heat/tests/test_convg_stack.py
index eecae5640..1a339b749 100644
--- a/heat/tests/test_convg_stack.py
+++ b/heat/tests/test_convg_stack.py
@@ -133,6 +133,7 @@ class StackConvergenceCreateUpdateDeleteTest(common.HeatTestCase):
def _mock_convg_db_update_requires(self, key_id=False):
"""Updates requires column of resources.
+
Required for testing the generation of convergence dependency graph
on an update.
"""
diff --git a/heat/tests/test_cw_alarm.py b/heat/tests/test_cw_alarm.py
index 313a8da9f..31f05434d 100644
--- a/heat/tests/test_cw_alarm.py
+++ b/heat/tests/test_cw_alarm.py
@@ -65,10 +65,11 @@ class CloudWatchAlarmTest(common.HeatTestCase):
return rsrc
def test_mem_alarm_high_update_no_replace(self):
- '''
- Make sure that we can change the update-able properties
+ """Test case for updating the alarm with updatable properties.
+
+ Make sure that we can change the updatable properties
without replacing the Alarm rsrc.
- '''
+ """
t = template_format.parse(alarm_template)
# short circuit the alarm's references
@@ -101,10 +102,11 @@ class CloudWatchAlarmTest(common.HeatTestCase):
self.m.VerifyAll()
def test_mem_alarm_high_update_replace(self):
- '''
+ """Test case for replacing the alarm with non-updatable properties.
+
Make sure that the Alarm resource IS replaced when non-update-able
properties are changed.
- '''
+ """
t = template_format.parse(alarm_template)
# short circuit the alarm's references
diff --git a/heat/tests/test_dbinstance.py b/heat/tests/test_dbinstance.py
index 0e59f3837..f74757fd2 100644
--- a/heat/tests/test_dbinstance.py
+++ b/heat/tests/test_dbinstance.py
@@ -52,8 +52,9 @@ rds_template = '''
class DBInstance(resource.Resource):
- """This is copied from the old DBInstance
- to verify the schema of the new TemplateResource.
+ """Verify the schema of the new TemplateResource.
+
+ This is copied from the old DBInstance.
"""
properties_schema = {
'DBSnapshotIdentifier': properties.Schema(
@@ -152,9 +153,7 @@ class DBInstanceTest(common.HeatTestCase):
super(DBInstanceTest, self).setUp()
def test_dbinstance(self):
- """test that the Template is parsable and
- publishes the correct properties.
- """
+ """Test that Template is parsable and publishes correct properties."""
templ = template.Template(template_format.parse(rds_template))
stack = parser.Stack(utils.dummy_context(), 'test_stack',
templ)
diff --git a/heat/tests/test_engine_api_utils.py b/heat/tests/test_engine_api_utils.py
index 500312067..826f204b7 100644
--- a/heat/tests/test_engine_api_utils.py
+++ b/heat/tests/test_engine_api_utils.py
@@ -954,9 +954,7 @@ class FormatValidateParameterTest(common.HeatTestCase):
]
def test_format_validate_parameter(self):
- """
- Test format of a parameter.
- """
+ """Test format of a parameter."""
t = template_format.parse(self.template % self.param)
tmpl = template.Template(t)
diff --git a/heat/tests/test_engine_service.py b/heat/tests/test_engine_service.py
index 36962b843..e628bbb39 100644
--- a/heat/tests/test_engine_service.py
+++ b/heat/tests/test_engine_service.py
@@ -957,16 +957,15 @@ class StackServiceTest(common.HeatTestCase):
def test_list_template_functions(self, templ_mock):
class DummyFunc1(object):
- """
- Dummy Func1
+ """Dummy Func1.
- Dummy Func1 Long Description
+ Dummy Func1 Long Description.
"""
class DummyFunc2(object):
- """Dummy Func2
+ """Dummy Func2.
- Dummy Func2 Long Description
+ Dummy Func2 Long Description.
"""
plugin_mock = mock.Mock(
@@ -982,9 +981,9 @@ class StackServiceTest(common.HeatTestCase):
templ_mock.return_value = DummyMgr()
functions = self.eng.list_template_functions(self.ctx, 'dummytemplate')
expected = [{'functions': 'dummy1',
- 'description': 'Dummy Func1'},
+ 'description': 'Dummy Func1.'},
{'functions': 'dummy2',
- 'description': 'Dummy Func2'}]
+ 'description': 'Dummy Func2.'}]
self.assertEqual(sorted(expected, key=lambda k: k['functions']),
sorted(functions, key=lambda k: k['functions']))
diff --git a/heat/tests/test_engine_service_stack_watch.py b/heat/tests/test_engine_service_stack_watch.py
index 52b6cd3ac..3ff191609 100644
--- a/heat/tests/test_engine_service_stack_watch.py
+++ b/heat/tests/test_engine_service_stack_watch.py
@@ -34,8 +34,10 @@ class StackServiceWatcherTest(common.HeatTestCase):
def test_periodic_watch_task_not_created(self, watch_rule_update,
watch_rule_get_all_by_stack,
stack_get_all_by_owner_id):
- """If there is no cloud watch lite alarm, then don't create
- a periodic task for it.
+ """Test case for not creating periodic task for cloud watch lite alarm.
+
+ If there is no cloud watch lite alarm, then don't create a periodic
+ task for it.
"""
stack_id = 83
watch_rule_get_all_by_stack.return_value = []
@@ -56,8 +58,10 @@ class StackServiceWatcherTest(common.HeatTestCase):
def test_periodic_watch_task_created(self, watch_rule_update,
watch_rule_get_all_by_stack,
stack_get_all_by_owner_id):
- """If there is no cloud watch lite alarm, then DO create
- a periodic task for it.
+ """Test case for creating periodic task for cloud watch lite alarm.
+
+ If there is no cloud watch lite alarm, then DO create a periodic task
+ for it.
"""
stack_id = 86
wr1 = mock.Mock()
diff --git a/heat/tests/test_environment.py b/heat/tests/test_environment.py
index c7d5509f3..fab3aab4b 100644
--- a/heat/tests/test_environment.py
+++ b/heat/tests/test_environment.py
@@ -289,8 +289,12 @@ class GlobalEnvLoadingTest(common.HeatTestCase):
m_ldir.assert_called_once_with(env_dir + '/*')
def test_continue_on_ioerror(self):
- """assert we get all files processed even if there are
- processing exceptions.
+ """Assert we get all files processed.
+
+ Assert we get all files processed even if there are processing
+ exceptions.
+
+ Test uses IOError as side effect of mock open.
"""
with mock.patch('glob.glob') as m_ldir:
m_ldir.return_value = ['/etc_etc/heat/environment.d/a.yaml',
@@ -312,8 +316,12 @@ class GlobalEnvLoadingTest(common.HeatTestCase):
self.assertEqual(expected, m_open.call_args_list)
def test_continue_on_parse_error(self):
- """assert we get all files processed even if there are
- processing exceptions.
+ """Assert we get all files processed.
+
+ Assert we get all files processed even if there are processing
+ exceptions.
+
+ Test checks case when env content is incorrect.
"""
with mock.patch('glob.glob') as m_ldir:
m_ldir.return_value = ['/etc_etc/heat/environment.d/a.yaml',
diff --git a/heat/tests/test_hot.py b/heat/tests/test_hot.py
index 4b4094709..7e3107e66 100644
--- a/heat/tests/test_hot.py
+++ b/heat/tests/test_hot.py
@@ -533,8 +533,7 @@ class HOTemplateTest(common.HeatTestCase):
self.assertEqual(snippet_resolved, self.resolve(snippet, tmpl))
def test_str_replace_syntax(self):
- """
- Test str_replace function syntax.
+ """Test str_replace function syntax.
Pass wrong syntax (array instead of dictionary) to function and
validate that we get a TypeError.
@@ -548,8 +547,7 @@ class HOTemplateTest(common.HeatTestCase):
self.assertRaises(TypeError, self.resolve, snippet, tmpl)
def test_str_replace_invalid_param_keys(self):
- """
- Test str_replace function parameter keys.
+ """Test str_replace function parameter keys.
Pass wrong parameters to function and verify that we get
a KeyError.
@@ -568,8 +566,7 @@ class HOTemplateTest(common.HeatTestCase):
self.assertRaises(KeyError, self.resolve, snippet, tmpl)
def test_str_replace_invalid_param_types(self):
- """
- Test str_replace function parameter values.
+ """Test str_replace function parameter values.
Pass parameter values of wrong type to function and verify that we get
a TypeError.
@@ -755,9 +752,10 @@ class HOTemplateTest(common.HeatTestCase):
self.assertIn(item, snippet_resolved)
def test_repeat_bad_args(self):
- """
- Test that the repeat function reports a proper error when missing
- or invalid arguments.
+ """Tests reporting error by repeat function.
+
+ Test that the repeat function reports a proper error when missing or
+ invalid arguments.
"""
tmpl = template.Template(hot_kilo_tpl_empty)
@@ -871,7 +869,8 @@ class HOTemplateTest(common.HeatTestCase):
six.text_type(exc))
def test_prevent_parameters_access(self):
- """
+ """Check parameters section inaccessible using the template as a dict.
+
Test that the parameters section can't be accessed using the template
as a dictionary.
"""
@@ -898,7 +897,8 @@ class HOTemplateTest(common.HeatTestCase):
self.assertIn(err_str, six.text_type(keyError))
def test_parameters_section_not_iterable(self):
- """
+ """Check parameters section is not returned using the template as iter.
+
Test that the parameters section is not returned when the template is
used as an iterable.
"""
@@ -912,8 +912,7 @@ class HOTemplateTest(common.HeatTestCase):
self.assertNotIn('parameters', six.iterkeys(tmpl))
def test_invalid_hot_version(self):
- """
- Test HOT version check.
+ """Test HOT version check.
Pass an invalid HOT version to template.Template.__new__() and
validate that we get a ValueError.
@@ -925,8 +924,7 @@ class HOTemplateTest(common.HeatTestCase):
template.Template, hot_tmpl)
def test_valid_hot_version(self):
- """
- Test HOT version check.
+ """Test HOT version check.
Pass a valid HOT version to template.Template.__new__() and
validate that we get back a parsed template.
@@ -1283,9 +1281,8 @@ class HotStackTest(common.HeatTestCase):
class StackAttributesTest(common.HeatTestCase):
- """
- Test stack get_attr function when stack was created from HOT template.
- """
+ """Test get_attr function when stack was created from HOT template."""
+
def setUp(self):
super(StackAttributesTest, self).setUp()
@@ -1414,9 +1411,7 @@ class StackGetAttrValidationTest(common.HeatTestCase):
class StackParametersTest(common.HeatTestCase):
- """
- Test stack get_param function when stack was created from HOT template.
- """
+ """Test get_param function when stack was created from HOT template."""
scenarios = [
('Ref_string',
diff --git a/heat/tests/test_lifecycle_plugin_utils.py b/heat/tests/test_lifecycle_plugin_utils.py
index 288c42649..2d17933e4 100644
--- a/heat/tests/test_lifecycle_plugin_utils.py
+++ b/heat/tests/test_lifecycle_plugin_utils.py
@@ -27,7 +27,8 @@ resources:
class LifecyclePluginUtilsTests(common.HeatTestCase):
- """
+ """Basic tests for :module:'heat.common.lifecycle_plugin_utils'.
+
Basic tests for the helper methods in
:module:'heat.common.lifecycle_plugin_utils'.
"""
@@ -180,9 +181,8 @@ class LifecyclePluginUtilsTests(common.HeatTestCase):
class TestLifecycleCallout1(lifecycle_plugin.LifecyclePlugin):
- '''
- Sample test class for testing pre-op and post-op work on a stack
- '''
+ """Sample test class for testing pre-op and post-op work on a stack."""
+
def do_pre_op(self, cnxt, stack, current_stack=None, action=None):
cnxt.pre_counter_for_unit_test += 1
@@ -195,10 +195,11 @@ class TestLifecycleCallout1(lifecycle_plugin.LifecyclePlugin):
class TestLifecycleCallout2(lifecycle_plugin.LifecyclePlugin):
- '''
- Sample test class for testing pre-op and post-op work on a stack,
- different ordinal, and increment counters by 2
- '''
+ """Sample test class for testing pre-op and post-op work on a stack.
+
+ Different ordinal and increment counters by 2.
+ """
+
def do_pre_op(self, cnxt, stack, current_stack=None, action=None):
cnxt.pre_counter_for_unit_test += 2
@@ -211,10 +212,10 @@ class TestLifecycleCallout2(lifecycle_plugin.LifecyclePlugin):
class TestLifecycleCallout3(lifecycle_plugin.LifecyclePlugin):
- '''
- Sample test class for testing pre-op and post-op work on a stack,
- methods raise exceptions
- '''
+ """Sample test class for testing pre-op and post-op work on a stack.
+
+ Methods raise exceptions.
+ """
def do_pre_op(self, cnxt, stack, current_stack=None, action=None):
raise Exception()
@@ -227,10 +228,10 @@ class TestLifecycleCallout3(lifecycle_plugin.LifecyclePlugin):
class TestLifecycleCallout4(lifecycle_plugin.LifecyclePlugin):
- '''
- Sample test class for testing pre-op and post-op work on a stack;
- do_pre_op, do_post_op both throw exception
- '''
+ """Sample test class for testing pre-op and post-op work on a stack.
+
+ do_pre_op, do_post_op both throw exception.
+ """
def do_pre_op(self, cnxt, stack, current_stack=None, action=None):
raise Exception()
@@ -243,10 +244,10 @@ class TestLifecycleCallout4(lifecycle_plugin.LifecyclePlugin):
class TestLifecycleCallout5(lifecycle_plugin.LifecyclePlugin):
- '''
- Sample test class for testing pre-op and post-op work on a stack;
- do_post_op throws exception
- '''
+ """Sample test class for testing pre-op and post-op work on a stack.
+
+ do_post_op throws exception.
+ """
def do_pre_op(self, cnxt, stack, current_stack=None, action=None):
cnxt.pre_counter_for_unit_test += 1
diff --git a/heat/tests/test_metadata_refresh.py b/heat/tests/test_metadata_refresh.py
index ce3d5d1fc..27fd72f2a 100644
--- a/heat/tests/test_metadata_refresh.py
+++ b/heat/tests/test_metadata_refresh.py
@@ -144,10 +144,11 @@ resources:
class MetadataRefreshTest(common.HeatTestCase):
- '''
+ """Metadata gets updated when FnGetAtt() returns something different.
+
The point of the test is to confirm that metadata gets updated
when FnGetAtt() returns something different.
- '''
+ """
def setUp(self):
super(MetadataRefreshTest, self).setUp()
@@ -243,13 +244,14 @@ class WaitCondMetadataUpdateTest(common.HeatTestCase):
@mock.patch(('heat.engine.resources.aws.ec2.instance.Instance'
'.is_service_available'))
def test_wait_meta(self, mock_is_service_available):
- '''
+ """Tests valid waitcondition metadata after signal call.
+
1 create stack
2 assert empty instance metadata
3 service.resource_signal()
4 assert valid waitcond metadata
5 assert valid instance metadata
- '''
+ """
mock_is_service_available.return_value = True
self.stack = self.create_stack()
@@ -299,13 +301,14 @@ class WaitCondMetadataUpdateTest(common.HeatTestCase):
class MetadataRefreshTestServer(common.HeatTestCase):
- '''
+ """Metadata gets updated when FnGetAtt() returns something different.
+
The point of the test is to confirm that metadata gets updated
when FnGetAtt() returns something different when using a native
OS::Nova::Server resource, and that metadata keys set inside the
resource (as opposed to in the template), e.g for deployments, don't
get overwritten on update/refresh.
- '''
+ """
def setUp(self):
super(MetadataRefreshTestServer, self).setUp()
diff --git a/heat/tests/test_provider_template.py b/heat/tests/test_provider_template.py
index 72ccedc06..91cbe91b1 100644
--- a/heat/tests/test_provider_template.py
+++ b/heat/tests/test_provider_template.py
@@ -674,8 +674,7 @@ class ProviderTemplateTest(common.HeatTestCase):
self.m.VerifyAll()
def test_template_as_resource(self):
- """
- Test that the resulting resource has the right prop and attrib schema.
+ """Test that resulting resource has the right prop and attrib schema.
Note that this test requires the Wordpress_Single_Instance.yaml
template in the templates directory since we want to test using a
@@ -734,7 +733,8 @@ class ProviderTemplateTest(common.HeatTestCase):
resources.global_env().registry._registry)
def test_persisted_unregistered_provider_templates(self):
- """
+ """Test that templates are registered correctly.
+
Test that templates persisted in the database prior to
https://review.openstack.org/#/c/79953/1 are registered correctly.
"""
diff --git a/heat/tests/test_resource.py b/heat/tests/test_resource.py
index ff2e5c265..b4182b4e6 100644
--- a/heat/tests/test_resource.py
+++ b/heat/tests/test_resource.py
@@ -1665,10 +1665,11 @@ class ResourceTest(common.HeatTestCase):
0)
def test_create_convergence_sets_requires_for_failure(self):
- '''
+ """Ensure that requires are computed correctly.
+
Ensure that requires are computed correctly even if resource
- create fails,
- '''
+ create fails.
+ """
tmpl = rsrc_defn.ResourceDefinition('test_res', 'Foo')
res = generic_rsrc.GenericResource('test_res', tmpl, self.stack)
res._store()
@@ -2851,9 +2852,10 @@ class ResourceAvailabilityTest(common.HeatTestCase):
return mock_service_types, mock_client_plugin
def test_default_true_with_default_client_name_none(self):
- '''
+ """Test availability of resource when default_client_name is None.
+
When default_client_name is None, resource is considered as available.
- '''
+ """
with mock.patch(('heat.tests.generic_resource'
'.ResourceWithDefaultClientName.default_client_name'),
new_callable=mock.PropertyMock) as mock_client_name:
@@ -2865,9 +2867,10 @@ class ResourceAvailabilityTest(common.HeatTestCase):
def test_default_true_empty_service_types(
self,
mock_client_plugin_method):
- '''
+ """Test availability of resource when service_types is empty list.
+
When service_types is empty list, resource is considered as available.
- '''
+ """
mock_service_types, mock_client_plugin = self._mock_client_plugin()
mock_client_plugin_method.return_value = mock_client_plugin
@@ -2883,9 +2886,10 @@ class ResourceAvailabilityTest(common.HeatTestCase):
def test_service_deployed(
self,
mock_client_plugin_method):
- '''
+ """Test availability of resource when the service is deployed.
+
When the service is deployed, resource is considered as available.
- '''
+ """
mock_service_types, mock_client_plugin = self._mock_client_plugin(
['test_type']
@@ -2908,10 +2912,11 @@ class ResourceAvailabilityTest(common.HeatTestCase):
def test_service_not_deployed(
self,
mock_client_plugin_method):
- '''
+ """Test availability of resource when the service is not deployed.
+
When the service is not deployed, resource is considered as
unavailable.
- '''
+ """
mock_service_types, mock_client_plugin = self._mock_client_plugin(
['test_type_un_deployed'],
@@ -2932,10 +2937,11 @@ class ResourceAvailabilityTest(common.HeatTestCase):
)
def test_service_not_deployed_throws_exception(self):
- '''
+ """Test raising exception when the service is not deployed.
+
When the service is not deployed, make sure resource is throwing
ResourceTypeUnavailable exception.
- '''
+ """
with mock.patch.object(
generic_rsrc.ResourceWithDefaultClientName,
'is_service_available') as mock_method:
diff --git a/heat/tests/test_resource_group.py b/heat/tests/test_resource_group.py
index 06e98fdd7..587377822 100644
--- a/heat/tests/test_resource_group.py
+++ b/heat/tests/test_resource_group.py
@@ -121,7 +121,8 @@ class ResourceGroupTest(common.HeatTestCase):
self.m.StubOutWithMock(stackm.Stack, 'validate')
def test_assemble_nested(self):
- """
+ """Tests nested stack creation based on props.
+
Tests that the nested stack that implements the group is created
appropriately based on properties.
"""
@@ -636,7 +637,8 @@ class ResourceGroupNameListTest(common.HeatTestCase):
class ResourceGroupAttrTest(common.HeatTestCase):
def test_aggregate_attribs(self):
- """
+ """Test attribute aggregation.
+
Test attribute aggregation and that we mimic the nested resource's
attributes.
"""
@@ -646,7 +648,8 @@ class ResourceGroupAttrTest(common.HeatTestCase):
self.assertEqual(expected, resg.FnGetAtt('Foo'))
def test_index_dotted_attribs(self):
- """
+ """Test attribute aggregation.
+
Test attribute aggregation and that we mimic the nested resource's
attributes.
"""
@@ -655,7 +658,8 @@ class ResourceGroupAttrTest(common.HeatTestCase):
self.assertEqual('1', resg.FnGetAtt('resource.1.Foo'))
def test_index_path_attribs(self):
- """
+ """Test attribute aggregation.
+
Test attribute aggregation and that we mimic the nested resource's
attributes.
"""
@@ -664,7 +668,8 @@ class ResourceGroupAttrTest(common.HeatTestCase):
self.assertEqual('1', resg.FnGetAtt('resource.1', 'Foo'))
def test_index_deep_path_attribs(self):
- """
+ """Test attribute aggregation.
+
Test attribute aggregation and that we mimic the nested resource's
attributes.
"""
@@ -676,7 +681,8 @@ class ResourceGroupAttrTest(common.HeatTestCase):
'nested_dict', 'dict', 'b'))
def test_aggregate_deep_path_attribs(self):
- """
+ """Test attribute aggregation.
+
Test attribute aggregation and that we mimic the nested resource's
attributes.
"""
@@ -686,17 +692,13 @@ class ResourceGroupAttrTest(common.HeatTestCase):
self.assertEqual(expected, resg.FnGetAtt('nested_dict', 'list', 2))
def test_aggregate_refs(self):
- """
- Test resource id aggregation
- """
+ """Test resource id aggregation."""
resg = self._create_dummy_stack()
expected = ['ID-0', 'ID-1']
self.assertEqual(expected, resg.FnGetAtt("refs"))
def test_aggregate_refs_with_index(self):
- """
- Test resource id aggregation with index
- """
+ """Test resource id aggregation with index."""
resg = self._create_dummy_stack()
expected = ['ID-0', 'ID-1']
self.assertEqual(expected[0], resg.FnGetAtt("refs", 0))
@@ -704,17 +706,13 @@ class ResourceGroupAttrTest(common.HeatTestCase):
self.assertIsNone(resg.FnGetAtt("refs", 2))
def test_aggregate_outputs(self):
- """
- Test outputs aggregation
- """
+ """Test outputs aggregation."""
expected = {'0': ['foo', 'bar'], '1': ['foo', 'bar']}
resg = self._create_dummy_stack(template_attr, expect_attrs=expected)
self.assertEqual(expected, resg.FnGetAtt('attributes', 'list'))
def test_aggregate_outputs_no_path(self):
- """
- Test outputs aggregation with missing path
- """
+ """Test outputs aggregation with missing path."""
resg = self._create_dummy_stack(template_attr)
self.assertRaises(exception.InvalidTemplateAttribute,
resg.FnGetAtt, 'attributes')
diff --git a/heat/tests/test_rpc_client.py b/heat/tests/test_rpc_client.py
index 65c4f8a6e..ec17aa9c1 100644
--- a/heat/tests/test_rpc_client.py
+++ b/heat/tests/test_rpc_client.py
@@ -41,8 +41,7 @@ class EngineRpcAPITestCase(common.HeatTestCase):
self.rpcapi = rpc_client.EngineClient()
def _to_remote_error(self, error):
- """Converts the given exception to the one with the _Remote suffix.
- """
+ """Converts the given exception to the one with the _Remote suffix."""
exc_info = (type(error), error, None)
serialized = rpc_common.serialize_remote_exception(exc_info)
remote_error = rpc_common.deserialize_remote_exception(
diff --git a/heat/tests/test_software_deployment.py b/heat/tests/test_software_deployment.py
index b5e27e9c5..a62c3d72e 100644
--- a/heat/tests/test_software_deployment.py
+++ b/heat/tests/test_software_deployment.py
@@ -1203,7 +1203,8 @@ class SoftwareDeploymentGroupTest(common.HeatTestCase):
set(resg._resource_names()))
def test_assemble_nested(self):
- """
+ """Tests nested stack implements group creation based on properties.
+
Tests that the nested stack that implements the group is created
appropriately based on properties.
"""
diff --git a/heat/tests/test_stack.py b/heat/tests/test_stack.py
index 93bd74490..4b0cf2479 100644
--- a/heat/tests/test_stack.py
+++ b/heat/tests/test_stack.py
@@ -963,11 +963,10 @@ class StackTest(common.HeatTestCase):
rsrc.state_set(rsrc.CREATE, rsrc.COMPLETE)
def test_create_failure_recovery(self):
- '''
- assertion:
- check that rollback still works with dynamic metadata
- this test fails the second instance
- '''
+ """Check that rollback still works with dynamic metadata.
+
+ This test fails the second instance.
+ """
tmpl = {'HeatTemplateFormatVersion': '2012-12-12',
'Resources': {
@@ -1179,9 +1178,7 @@ class StackTest(common.HeatTestCase):
self.stack[r].required_by())
def test_store_saves_owner(self):
- """
- The owner_id attribute of Store is saved to the database when stored.
- """
+ """owner_id attribute of Store is saved to the database when stored."""
self.stack = stack.Stack(self.ctx, 'owner_stack', self.tmpl)
stack_ownee = stack.Stack(self.ctx, 'ownee_stack', self.tmpl,
owner_id=self.stack.id)
@@ -1232,9 +1229,7 @@ class StackTest(common.HeatTestCase):
self.assertEqual('tag2', db_tags[1].tag)
def test_store_saves_creds(self):
- """
- A user_creds entry is created on first stack store
- """
+ """A user_creds entry is created on first stack store."""
cfg.CONF.set_default('deferred_auth_method', 'password')
self.stack = stack.Stack(self.ctx, 'creds_stack', self.tmpl)
self.stack.store()
@@ -1262,9 +1257,7 @@ class StackTest(common.HeatTestCase):
self.assertEqual(user_creds_id, db_stack.user_creds_id)
def test_store_saves_creds_trust(self):
- """
- A user_creds entry is created on first stack store
- """
+ """A user_creds entry is created on first stack store."""
cfg.CONF.set_override('deferred_auth_method', 'trusts')
self.m.StubOutWithMock(keystone.KeystoneClientPlugin, '_create')
@@ -1313,9 +1306,7 @@ class StackTest(common.HeatTestCase):
self.assertEqual(creds.id, backup.user_creds_id)
def test_stored_context_err(self):
- """
- Test stored_context error path.
- """
+ """Test stored_context error path."""
self.stack = stack.Stack(self.ctx, 'creds_stack', self.tmpl)
ex = self.assertRaises(exception.Error, self.stack.stored_context)
expected_err = 'Attempt to use stored_context with no user_creds'
@@ -1401,7 +1392,8 @@ class StackTest(common.HeatTestCase):
self.assertEqual(ctx_expected, load_stack.context.to_dict())
def test_load_honors_owner(self):
- """
+ """Loading a stack from the database will set the owner_id.
+
Loading a stack from the database will set the owner_id of the
resultant stack appropriately.
"""
@@ -1559,9 +1551,7 @@ class StackTest(common.HeatTestCase):
self.stack.state)
def test_stack_load_no_param_value_validation(self):
- '''
- Test stack loading with disabled parameter value validation.
- '''
+ """Test stack loading with disabled parameter value validation."""
tmpl = template_format.parse('''
heat_template_version: 2013-05-23
parameters:
@@ -2156,9 +2146,7 @@ class StackTest(common.HeatTestCase):
self.assertFalse(mock_drg.called)
def test_encrypt_parameters_false_parameters_stored_plaintext(self):
- '''
- Test stack loading with disabled parameter value validation.
- '''
+ """Test stack loading with disabled parameter value validation."""
tmpl = template_format.parse('''
heat_template_version: 2013-05-23
parameters:
@@ -2186,9 +2174,7 @@ class StackTest(common.HeatTestCase):
self.assertEqual('bar', params['param2'])
def test_parameters_stored_encrypted_decrypted_on_load(self):
- '''
- Test stack loading with disabled parameter value validation.
- '''
+ """Test stack loading with disabled parameter value validation."""
tmpl = template_format.parse('''
heat_template_version: 2013-05-23
parameters:
@@ -2223,9 +2209,7 @@ class StackTest(common.HeatTestCase):
self.assertEqual('bar', params.get('param2'))
def test_parameters_stored_decrypted_successful_load(self):
- '''
- Test stack loading with disabled parameter value validation.
- '''
+ """Test stack loading with disabled parameter value validation."""
tmpl = template_format.parse('''
heat_template_version: 2013-05-23
parameters:
diff --git a/heat/tests/test_stack_resource.py b/heat/tests/test_stack_resource.py
index d8f21e02e..1613c1b61 100644
--- a/heat/tests/test_stack_resource.py
+++ b/heat/tests/test_stack_resource.py
@@ -214,8 +214,10 @@ class StackResourceTest(StackResourceBaseTest):
self.assertNotEqual(sig2, sig2a)
def test_propagated_files(self):
- """Makes sure that the files map in the top level stack
- are passed on to the child stack.
+ """Test passing of the files map in the top level to the child.
+
+ Makes sure that the files map in the top level stack are passed on to
+ the child stack.
"""
self.parent_stack.t.files["foo"] = "bar"
parsed_t = self.parent_resource._parse_child_template(self.templ, None)
@@ -520,9 +522,10 @@ class StackResourceTest(StackResourceBaseTest):
self.parent_resource.context, mock.ANY)
def test_need_update_for_nested_resource(self):
- """
- The resource in Create or Update state and has nested stack,
- should need update.
+ """Test the resource with nested stack should need update.
+
+ The resource in Create or Update state and has nested stack, should
+ need update.
"""
self.parent_resource.action = self.parent_resource.CREATE
need_update = self.parent_resource._needs_update(
@@ -535,7 +538,8 @@ class StackResourceTest(StackResourceBaseTest):
self.assertEqual(True, need_update)
def test_need_update_in_failed_state_for_nested_resource(self):
- """
+ """Test the resource with no nested stack should need replacement.
+
The resource in failed state and has no nested stack,
should need update with UpdateReplace.
"""
@@ -551,7 +555,8 @@ class StackResourceTest(StackResourceBaseTest):
self.parent_resource)
def test_need_update_in_init_complete_state_for_nested_resource(self):
- """
+ """Test the resource with no nested stack should need replacement.
+
The resource in failed state and has no nested stack,
should need update with UpdateReplace.
"""
@@ -717,7 +722,8 @@ class StackResourceCheckCompleteTest(StackResourceBaseTest):
self.nested.COMPLETE = 'COMPLETE'
def test_state_ok(self):
- """
+ """Test case when check_create_complete should return True.
+
check_create_complete should return True create task is
done and the nested stack is in (<action>,COMPLETE) state.
"""
@@ -729,7 +735,8 @@ class StackResourceCheckCompleteTest(StackResourceBaseTest):
show_deleted=self.show_deleted, force_reload=True)
def test_state_err(self):
- """
+ """Test case when check_create_complete should raise error.
+
check_create_complete should raise error when create task is
done but the nested stack is not in (<action>,COMPLETE) state
"""
@@ -749,7 +756,8 @@ class StackResourceCheckCompleteTest(StackResourceBaseTest):
show_deleted=self.show_deleted, force_reload=True)
def test_state_unknown(self):
- """
+ """Test case when check_create_complete should raise error.
+
check_create_complete should raise error when create task is
done but the nested stack is not in (<action>,COMPLETE) state
"""
diff --git a/heat/tests/test_stack_update.py b/heat/tests/test_stack_update.py
index 28a7d700d..76021d36f 100644
--- a/heat/tests/test_stack_update.py
+++ b/heat/tests/test_stack_update.py
@@ -1056,11 +1056,11 @@ class StackUpdateTest(common.HeatTestCase):
self.m.UnsetStubs()
def test_update_replace_by_reference(self):
- '''
- assertion:
- changes in dynamic attributes, due to other resources been updated
+ """Test case for changes in dynamic attributes.
+
+ Changes in dynamic attributes, due to other resources been updated
are not ignored and can cause dependent resources to be updated.
- '''
+ """
tmpl = {'HeatTemplateFormatVersion': '2012-12-12',
'Resources': {
'AResource': {'Type': 'ResourceWithPropsType',
@@ -1111,11 +1111,11 @@ class StackUpdateTest(common.HeatTestCase):
mock_id.assert_called_with()
def test_update_with_new_resources_with_reference(self):
- '''
- assertion:
- check, that during update with new resources which one has
+ """Check correct resolving of references in new resources.
+
+ Check, that during update with new resources which one has
reference on second, reference will be correct resolved.
- '''
+ """
tmpl = {'HeatTemplateFormatVersion': '2012-12-12',
'Resources': {
'CResource': {'Type': 'ResourceWithPropsType',
@@ -1157,11 +1157,10 @@ class StackUpdateTest(common.HeatTestCase):
mock_create.assert_called_with()
def test_update_by_reference_and_rollback_1(self):
- '''
- assertion:
- check that rollback still works with dynamic metadata
- this test fails the first instance
- '''
+ """Check that rollback still works with dynamic metadata.
+
+ This test fails the first instance.
+ """
tmpl = {'HeatTemplateFormatVersion': '2012-12-12',
'Resources': {
'AResource': {'Type': 'ResourceWithPropsType',
@@ -1208,11 +1207,10 @@ class StackUpdateTest(common.HeatTestCase):
mock_create.assert_called_once_with()
def test_update_by_reference_and_rollback_2(self):
- '''
- assertion:
- check that rollback still works with dynamic metadata
- this test fails the second instance
- '''
+ """Check that rollback still works with dynamic metadata.
+
+ This test fails the second instance.
+ """
class ResourceTypeA(generic_rsrc.ResourceWithProps):
count = 0
@@ -1267,11 +1265,10 @@ class StackUpdateTest(common.HeatTestCase):
mock_create.assert_called_once_with()
def test_update_failure_recovery(self):
- '''
- assertion:
- check that rollback still works with dynamic metadata
- this test fails the second instance
- '''
+ """Check that rollback still works with dynamic metadata.
+
+ This test fails the second instance.
+ """
class ResourceTypeA(generic_rsrc.ResourceWithProps):
count = 0
@@ -1351,11 +1348,10 @@ class StackUpdateTest(common.HeatTestCase):
mock_delete_A.assert_called_once_with()
def test_update_failure_recovery_new_param(self):
- '''
- assertion:
- check that rollback still works with dynamic metadata
- this test fails the second instance
- '''
+ """Check that rollback still works with dynamic metadata.
+
+ This test fails the second instance.
+ """
class ResourceTypeA(generic_rsrc.ResourceWithProps):
count = 0
@@ -1446,11 +1442,10 @@ class StackUpdateTest(common.HeatTestCase):
self.assertEqual(2, mock_create.call_count)
def test_update_failure_recovery_new_param_stack_list(self):
- '''
- assertion:
- check that stack-list is not broken if update fails in between.
- Also ensure that next update passes
- '''
+ """Check that stack-list is not broken if update fails in between.
+
+ Also ensure that next update passes.
+ """
class ResourceTypeA(generic_rsrc.ResourceWithProps):
count = 0
@@ -1547,11 +1542,11 @@ class StackUpdateTest(common.HeatTestCase):
self.assertEqual(2, mock_create.call_count)
def test_update_replace_parameters(self):
- '''
- assertion:
- changes in static environment parameters
- are not ignored and can cause dependent resources to be updated.
- '''
+ """Check that changes in static environment parameters are not ignored.
+
+ Changes in static environment parameters are not ignored and can cause
+ dependent resources to be updated.
+ """
tmpl = {'HeatTemplateFormatVersion': '2012-12-12',
'Parameters': {'AParam': {'Type': 'String'}},
'Resources': {
diff --git a/heat/tests/test_structured_config.py b/heat/tests/test_structured_config.py
index 00d286452..67cd28a89 100644
--- a/heat/tests/test_structured_config.py
+++ b/heat/tests/test_structured_config.py
@@ -320,7 +320,8 @@ class StructuredDeploymentGroupTest(common.HeatTestCase):
set(resg._resource_names()))
def test_assemble_nested(self):
- """
+ """Tests nested stack implements group creation based on properties.
+
Tests that the nested stack that implements the group is created
appropriately based on properties.
"""
diff --git a/heat/tests/test_swift.py b/heat/tests/test_swift.py
index f99125e7b..84c382f42 100644
--- a/heat/tests/test_swift.py
+++ b/heat/tests/test_swift.py
@@ -402,10 +402,12 @@ class swiftTest(common.HeatTestCase):
self.m.VerifyAll()
def test_default_headers_not_none_empty_string(self):
- '''Test that we are not passing None when we have a default
+ """Test that we are not passing None.
+
+ Test that we are not passing None when we have a default
empty string or sc will pass them as string None. see
bug lp:1259571.
- '''
+ """
container_name = utils.PhysName('test_stack', 'test_resource')
sc.Connection.put_container(
container_name, {}).AndReturn(None)