From: Zane Bitter Date: Mon, 26 Aug 2013 10:29:06 +0000 (+0200) Subject: Include Description in conversion from legacy Property schema X-Git-Tag: 2014.1~123^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=8a0c24449e27fe06e3e0fd436336120005ec4103;p=openstack-build%2Fheat-build.git Include Description in conversion from legacy Property schema Change-Id: I042afdc3b5e3d4677c207e53497e3bcceb6739ad --- diff --git a/heat/engine/properties.py b/heat/engine/properties.py index fa5ecaa5..b506ea28 100644 --- a/heat/engine/properties.py +++ b/heat/engine/properties.py @@ -168,6 +168,7 @@ class Schema(collections.Mapping): ss = None return cls(data_type, + description=schema_dict.get(DESCRIPTION), default=schema_dict.get(DEFAULT), schema=ss, required=schema_dict.get(REQUIRED, False), diff --git a/heat/tests/test_properties.py b/heat/tests/test_properties.py index e39cd52b..a228c56c 100644 --- a/heat/tests/test_properties.py +++ b/heat/tests/test_properties.py @@ -236,9 +236,21 @@ class SchemaTest(testtools.TestCase): s = properties.Schema(properties.STRING) self.assertTrue(properties.Schema.from_legacy(s) is s) + def test_from_legacy_minimal_string(self): + s = properties.Schema.from_legacy({ + 'Type': 'String', + }) + self.assertEqual(properties.STRING, s.type) + self.assertEqual(None, s.description) + self.assertEqual(None, s.default) + self.assertFalse(s.required) + self.assertEqual(0, len(s.constraints)) + self.assertTrue(s.implemented) + def test_from_legacy_string(self): s = properties.Schema.from_legacy({ 'Type': 'String', + 'Description': 'a string', 'Default': 'wibble', 'Required': True, 'Implemented': False, @@ -248,7 +260,7 @@ class SchemaTest(testtools.TestCase): 'AllowedPattern': '[a-z]*', }) self.assertEqual(properties.STRING, s.type) - self.assertEqual(None, s.description) + self.assertEqual('a string', s.description) self.assertEqual('wibble', s.default) self.assertTrue(s.required) self.assertEqual(3, len(s.constraints))