Fix missing import with new test
The error message was created without proper import and test. Add it with new test. Change-Id: Id6b63e9c1831bd2a1210b30946efb4febb1cc8d8 Closes-Bug: #1502937
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
from toscaparser.common.exception import ExceptionCollector
|
||||
from toscaparser.common.exception import InvalidSchemaError
|
||||
from toscaparser.utils.gettextutils import _
|
||||
|
||||
|
||||
class PropertyDef(object):
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
from toscaparser.common import exception
|
||||
from toscaparser.elements.property_definition import PropertyDef
|
||||
from toscaparser.properties import Property
|
||||
from toscaparser.tests.base import TestCase
|
||||
from toscaparser.utils.gettextutils import _
|
||||
@@ -221,3 +222,15 @@ class PropertyTest(TestCase):
|
||||
self.assertIsNone(tpl.validate())
|
||||
self.assertEqual(expected_properties,
|
||||
sorted(tpl.get_properties().keys()))
|
||||
|
||||
def test_missing_property_type(self):
|
||||
tpl_snippet = '''
|
||||
properties:
|
||||
prop:
|
||||
typo: tosca.mytesttype.Test
|
||||
'''
|
||||
schema = yamlparser.simple_parse(tpl_snippet)
|
||||
error = self.assertRaises(exception.InvalidSchemaError, PropertyDef,
|
||||
'prop', None, schema['properties']['prop'])
|
||||
self.assertEqual(_('Property definition of "prop" '
|
||||
'must have a "type" attribute.'), str(error))
|
||||
|
||||
Reference in New Issue
Block a user