Add missing entry_schema field in parameters

Change-Id: I96c85712bbba443b04021d0937f8f69c785b26fe
Related-Bug: #1591907
This commit is contained in:
Miguel Caballer 2016-09-07 12:08:46 +02:00
parent 0667317b8b
commit d5c54375ab
2 changed files with 14 additions and 5 deletions

View File

@ -27,9 +27,10 @@ log = logging.getLogger('tosca')
class Input(object):
INPUTFIELD = (TYPE, DESCRIPTION, DEFAULT, CONSTRAINTS, REQUIRED,
STATUS) = ('type', 'description', 'default',
'constraints', 'required', 'status')
INPUTFIELD = (TYPE, DESCRIPTION, DEFAULT, CONSTRAINTS, REQUIRED, STATUS,
ENTRY_SCHEMA) = ('type', 'description', 'default',
'constraints', 'required', 'status',
'entry_schema')
def __init__(self, name, schema_dict):
self.name = name

View File

@ -142,6 +142,15 @@ class ToscaTemplateValidationTest(TestCase):
required: yes
status: supported
'''
tpl_snippet3 = '''
inputs:
some_list:
type: list
description: List of items
entry_schema:
type: string
default: []
'''
inputs1 = (toscaparser.utils.yamlparser.
simple_parse(tpl_snippet1)['inputs'])
name1, attrs1 = list(inputs1.items())[0]
@ -151,14 +160,13 @@ class ToscaTemplateValidationTest(TestCase):
try:
Input(name1, attrs1)
except Exception as err:
# err=self.assertRaises(exception.UnknownFieldError,
# input1.validate)
self.assertEqual(_('Input "cpus" contains unknown field '
'"constraint". Refer to the definition to '
'verify valid values.'),
err.__str__())
input2 = Input(name2, attrs2)
self.assertTrue(input2.required)
toscaparser.utils.yamlparser.simple_parse(tpl_snippet3)['inputs']
def _imports_content_test(self, tpl_snippet, path, custom_type_def):
imports = (toscaparser.utils.yamlparser.