summaryrefslogtreecommitdiff
path: root/heat/tests/test_attributes.py
diff options
context:
space:
mode:
authorSergey Kraynev <skraynev@mirantis.com>2014-04-22 08:20:01 -0400
committerSergey Kraynev <skraynev@mirantis.com>2014-05-28 02:00:53 -0400
commitbe26f4089eb51b84a455057aaddbcb2f2cbbc57c (patch)
tree7b5c9caad0b5ac1ab24e061952bc5fe163eabda3 /heat/tests/test_attributes.py
parent9ba541b9eec1990033c040d56babd0350d1a6e6f (diff)
downloadheat-be26f4089eb51b84a455057aaddbcb2f2cbbc57c.tar.gz
Deprecating the old style attribute Schema
There is last patch to migrate on new attribute Schema. The main changes are: - Deprecation warning was added in from_attribute function. If attribute have old format, it will be converted to new schema format and Deprecation warning will be raised. - Translation to new Schema was added in function schema_from_outputs. - All generic resources have been changed and use new Schema class now. - Some others tests have been fixed and use new Schema class now. Change-Id: Icf92f2d275a86a13c656b0e74b725a442db3e532 Closes-Bug: #1307319
Diffstat (limited to 'heat/tests/test_attributes.py')
-rw-r--r--heat/tests/test_attributes.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/heat/tests/test_attributes.py b/heat/tests/test_attributes.py
index 451ae8c99..db0d56590 100644
--- a/heat/tests/test_attributes.py
+++ b/heat/tests/test_attributes.py
@@ -58,10 +58,10 @@ class AttributeSchemaTest(testtools.TestCase):
self.assertEqual('Do not use this ever',
attrs._attributes['bar_dep'].support_status().message)
- def test_from_attribute_old_schema_format(self):
+ def test_old_attribute_schema_format(self):
s = 'Test description.'
- self.assertEqual(type(attributes.Schema(s)),
- type(attributes.Schema.from_attribute(s)))
+ self.assertIsInstance(attributes.Schema.from_attribute(s),
+ attributes.Schema)
self.assertEqual('Test description.',
attributes.Schema.from_attribute(s).description)
@@ -75,7 +75,8 @@ class AttributeTest(common.HeatTestCase):
"Value": '{"Fn::GetAtt": ["test_resource", "test1"]}',
"Description": "The first test attribute"
}
- attr = attributes.Attribute("test1", "The first test attribute")
+ attr = attributes.Attribute(
+ "test1", attributes.Schema("The first test attribute"))
self.assertEqual(expected, attr.as_output("test_resource"))
@@ -83,9 +84,9 @@ class AttributesTest(common.HeatTestCase):
"""Test the Attributes class."""
attributes_schema = {
- "test1": "Test attrib 1",
- "test2": "Test attrib 2",
- "test3": "Test attrib 3"
+ "test1": attributes.Schema("Test attrib 1"),
+ "test2": attributes.Schema("Test attrib 2"),
+ "test3": attributes.Schema("Test attrib 3"),
}
def setUp(self):
@@ -137,9 +138,9 @@ class AttributesTest(common.HeatTestCase):
}
MyTestResourceClass = self.m.CreateMockAnything()
MyTestResourceClass.attributes_schema = {
- "test1": "Test attrib 1",
- "test2": "Test attrib 2",
- "test3": "Test attrib 3"
+ "test1": attributes.Schema("Test attrib 1"),
+ "test2": attributes.Schema("Test attrib 2"),
+ "test3": attributes.Schema("Test attrib 3"),
}
self.m.ReplayAll()
self.assertEqual(