summaryrefslogtreecommitdiffstats
path: root/tosca2heat/tosca-parser/toscaparser/tests/test_toscatplvalidation.py
diff options
context:
space:
mode:
authorLianhao Lu <lianhao.lu@intel.com>2018-11-19 16:28:05 +0800
committerLianhao Lu <lianhao.lu@intel.com>2018-11-28 12:36:45 +0800
commitfa91717ecc519f5ca5b26456a7f7ab3c77c253ce (patch)
treee9fdc1be9566b30df1c07f78ec84a2922db1111c /tosca2heat/tosca-parser/toscaparser/tests/test_toscatplvalidation.py
parent26fc7a76a06c83eae2a75a262953b3d8d9bb00b3 (diff)
toscaparser: Avoid exception when creating our own
Fixed the bug that new exception is thrown when we're creating our own exceptions. JIRA: PARSER-187 Change-Id: If4c445eb9b5c6ff26d40cf6b3fa7f19cd31fd425 Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Diffstat (limited to 'tosca2heat/tosca-parser/toscaparser/tests/test_toscatplvalidation.py')
-rw-r--r--tosca2heat/tosca-parser/toscaparser/tests/test_toscatplvalidation.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/tests/test_toscatplvalidation.py b/tosca2heat/tosca-parser/toscaparser/tests/test_toscatplvalidation.py
index a8b1590..ea27bcb 100644
--- a/tosca2heat/tosca-parser/toscaparser/tests/test_toscatplvalidation.py
+++ b/tosca2heat/tosca-parser/toscaparser/tests/test_toscatplvalidation.py
@@ -1442,6 +1442,17 @@ heat-translator/master/translator/tests/data/custom_types/wordpress.yaml
(_('The template version "tosca_xyz" is invalid. Valid versions '
'are "%s".') % valid_versions))
+ def test_import_invalid_type(self):
+ tosca_tpl = os.path.join(
+ os.path.dirname(os.path.abspath(__file__)),
+ "data/test_import_invalid_type.yaml")
+ self.assertRaises(exception.ValidationError, ToscaTemplate, tosca_tpl)
+ exception.ExceptionCollector.assertExceptionMessage(
+ exception.UnknownFieldError,
+ (_("Template {'invalid': 'custom_types/invalid_type.yaml'} "
+ 'contains unknown field "annotation_types". Refer to the '
+ 'definition to verify valid values.')))
+
def test_node_template_capabilities_properties(self):
# validating capability property values
tpl_snippet = '''