Use HeatTestCase as parent instead of testtools

Let's use base class for test, which allows to write scenarious tests in
child clases.

Change-Id: I8276513d6ce5a83ce1b46ff3107cc0e3223d9b4d
changes/96/169296/2
Sergey Kraynev 8 years ago
parent 34157ca28c
commit 82f07cc69b
  1. 4
      heat/tests/db/test_sqlalchemy_types.py
  2. 3
      heat/tests/test_attributes.py
  3. 6
      heat/tests/test_constraints.py
  4. 5
      heat/tests/test_dependencies.py
  5. 9
      heat/tests/test_identifier.py
  6. 7
      heat/tests/test_parameters.py
  7. 4
      heat/tests/test_plugin_loader.py
  8. 10
      heat/tests/test_properties.py
  9. 11
      heat/tests/test_rpc_client.py
  10. 5
      heat/tests/test_short_id.py
  11. 6
      heat/tests/test_sqlalchemy_types.py

@ -14,12 +14,12 @@
from sqlalchemy.dialects.mysql import base as mysql_base
from sqlalchemy.dialects.sqlite import base as sqlite_base
from sqlalchemy import types
import testtools
from heat.db.sqlalchemy import types as db_types
from heat.tests import common
class ListTest(testtools.TestCase):
class ListTest(common.HeatTestCase):
def setUp(self):
super(ListTest, self).setUp()

@ -12,7 +12,6 @@
# under the License.
import mock
import testtools
from heat.engine import attributes
from heat.engine import resources
@ -20,7 +19,7 @@ from heat.engine import support
from heat.tests import common
class AttributeSchemaTest(testtools.TestCase):
class AttributeSchemaTest(common.HeatTestCase):
def test_schema_all(self):
d = {'description': 'A attribute'}
s = attributes.Schema('A attribute')

@ -13,14 +13,14 @@
import six
import testtools
from heat.common import exception
from heat.engine import constraints
from heat.engine import environment
from heat.tests import common
class SchemaTest(testtools.TestCase):
class SchemaTest(common.HeatTestCase):
def test_range_schema(self):
d = {'range': {'min': 5, 'max': 10}, 'description': 'a range'}
r = constraints.Range(5, 10, description='a range')
@ -432,7 +432,7 @@ class SchemaTest(testtools.TestCase):
self.assertEqual(['a', 'b'], res)
class CustomConstraintTest(testtools.TestCase):
class CustomConstraintTest(common.HeatTestCase):
def setUp(self):
super(CustomConstraintTest, self).setUp()

@ -12,12 +12,11 @@
# under the License.
import testtools
from heat.engine import dependencies
from heat.tests import common
class dependenciesTest(testtools.TestCase):
class dependenciesTest(common.HeatTestCase):
def _dep_test(self, func, checkorder, deps):
nodes = set.union(*[set(e) for e in deps])

@ -12,12 +12,11 @@
# under the License.
import testtools
from heat.common import identifier
from heat.tests import common
class IdentifierTest(testtools.TestCase):
class IdentifierTest(common.HeatTestCase):
url_prefix = 'http://1.2.3.4/foo/'
def test_attrs(self):
@ -361,7 +360,7 @@ class IdentifierTest(testtools.TestCase):
self.assertEqual(['p1', 'p2', 'p3'], hi._path_components())
class ResourceIdentifierTest(testtools.TestCase):
class ResourceIdentifierTest(common.HeatTestCase):
def test_resource_init_no_path(self):
si = identifier.HeatIdentifier('t', 's', 'i')
ri = identifier.ResourceIdentifier(resource_name='r', **si)
@ -392,7 +391,7 @@ class ResourceIdentifierTest(testtools.TestCase):
't', 's', 'i', 'p', 'r/r')
class EventIdentifierTest(testtools.TestCase):
class EventIdentifierTest(common.HeatTestCase):
def test_event_init_integer_id(self):
self._test_event_init('42')

@ -13,7 +13,6 @@
from oslo_serialization import jsonutils as json
import six
import testtools
from heat.common import exception
from heat.common import identifier
@ -156,7 +155,7 @@ class ParameterTestCommon(common.HeatTestCase):
self.assertEqual(self.zero, p.value())
class ParameterTestSpecific(testtools.TestCase):
class ParameterTestSpecific(common.HeatTestCase):
def test_new_bad_type(self):
self.assertRaises(exception.InvalidSchemaError, new_parameter,
'p', {'Type': 'List'}, validate_value=False)
@ -434,7 +433,7 @@ params_schema = json.loads('''{
}''')
class ParametersTest(testtools.TestCase):
class ParametersTest(common.HeatTestCase):
def new_parameters(self, stack_name, tmpl, user_params=None,
stack_id=None, validate_value=True,
param_defaults=None):
@ -566,7 +565,7 @@ class ParametersTest(testtools.TestCase):
self.assertEqual(111, params['a'])
class ParameterSchemaTest(testtools.TestCase):
class ParameterSchemaTest(common.HeatTestCase):
def test_validate_schema_wrong_key(self):
error = self.assertRaises(exception.InvalidSchemaError,

@ -16,13 +16,13 @@ import pkgutil
import sys
import mock
import testtools
from heat.common import plugin_loader
import heat.engine
from heat.tests import common
class PluginLoaderTest(testtools.TestCase):
class PluginLoaderTest(common.HeatTestCase):
def test_module_name(self):
self.assertEqual('foo.bar.blarg.wibble',
plugin_loader._module_name('foo.bar', 'blarg.wibble'))

@ -13,7 +13,6 @@
from oslo_serialization import jsonutils
import six
import testtools
from heat.common import exception
from heat.engine.cfn import functions as cfn_funcs
@ -23,9 +22,10 @@ from heat.engine import parameters
from heat.engine import properties
from heat.engine import resources
from heat.engine import support
from heat.tests import common
class PropertySchemaTest(testtools.TestCase):
class PropertySchemaTest(common.HeatTestCase):
def test_schema_all(self):
d = {
'type': 'string',
@ -582,7 +582,7 @@ class PropertySchemaTest(testtools.TestCase):
self.assertTrue(schema.allow_conversion)
class PropertyTest(testtools.TestCase):
class PropertyTest(common.HeatTestCase):
def test_required_default(self):
p = properties.Property({'Type': 'String'})
self.assertFalse(p.required())
@ -932,7 +932,7 @@ class PropertyTest(testtools.TestCase):
"an integer", six.text_type(ex))
class PropertiesTest(testtools.TestCase):
class PropertiesTest(common.HeatTestCase):
def setUp(self):
super(PropertiesTest, self).setUp()
schema = {
@ -1509,7 +1509,7 @@ class PropertiesTest(testtools.TestCase):
self.assertTrue(props_a != props_b)
class PropertiesValidationTest(testtools.TestCase):
class PropertiesValidationTest(common.HeatTestCase):
def test_required(self):
schema = {'foo': {'Type': 'String', 'Required': True}}
props = properties.Properties(schema, {'foo': 'bar'})

@ -22,28 +22,23 @@ import copy
import mock
from oslo_messaging._drivers import common as rpc_common
import stubout
import testtools
from heat.common import exception
from heat.common import identifier
from heat.common import messaging
from heat.rpc import client as rpc_client
from heat.tests import common
from heat.tests import utils
class EngineRpcAPITestCase(testtools.TestCase):
class EngineRpcAPITestCase(common.HeatTestCase):
def setUp(self):
messaging.setup("fake://", optional=True)
self.addCleanup(messaging.cleanup)
self.context = utils.dummy_context()
super(EngineRpcAPITestCase, self).setUp()
self.stubs = stubout.StubOutForTesting()
self.identity = dict(identifier.HeatIdentifier('engine_test_tenant',
'6',
'wordpress'))
self.rpcapi = rpc_client.EngineClient()
super(EngineRpcAPITestCase, self).setUp()
def _to_remote_error(self, error):
"""Converts the given exception to the one with the _Remote suffix.

@ -13,12 +13,11 @@
import uuid
import testtools
from heat.common import short_id
from heat.tests import common
class ShortIdTest(testtools.TestCase):
class ShortIdTest(common.HeatTestCase):
def test_byte_string_8(self):
self.assertEqual('\xab', short_id._to_byte_string(0xab, 8))

@ -14,12 +14,12 @@
from sqlalchemy.dialects.mysql import base as mysql_base
from sqlalchemy.dialects.sqlite import base as sqlite_base
from sqlalchemy import types
import testtools
from heat.db.sqlalchemy import types as db_types
from heat.tests import common
class LongTextTest(testtools.TestCase):
class LongTextTest(common.HeatTestCase):
def setUp(self):
super(LongTextTest, self).setUp()
@ -34,7 +34,7 @@ class LongTextTest(testtools.TestCase):
self.assertEqual(types.Text, type(impl))
class JsonTest(testtools.TestCase):
class JsonTest(common.HeatTestCase):
def setUp(self):
super(JsonTest, self).setUp()

Loading…
Cancel
Save