Skip to content

Commit

Permalink
Merge "Return parsed list value in CommaDelimitedList"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Sep 27, 2013
2 parents be21622 + 7f81f29 commit dcbd7b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions heat/engine/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ def parse(self, value):
raise ValueError(message % str(err))
return value

def value(self):
return self.parsed

def __len__(self):
'''Return the length of the list.'''
return len(self.parsed)
Expand Down
8 changes: 7 additions & 1 deletion heat/tests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,13 @@ def test_list_value_list_good(self):
schema = {'Type': 'CommaDelimitedList',
'AllowedValues': ['foo', 'bar', 'baz']}
p = self.new_parameter('p', schema, 'baz,foo,bar')
self.assertEqual(p.value(), 'baz,foo,bar')
self.assertEqual(p.value(), 'baz,foo,bar'.split(','))
schema['Default'] = []
p = self.new_parameter('p', schema)
self.assertEqual(p.value(), [])
schema['Default'] = 'baz,foo,bar'
p = self.new_parameter('p', schema)
self.assertEqual(p.value(), 'baz,foo,bar'.split(','))

def test_list_value_list_bad(self):
schema = {'Type': 'CommaDelimitedList',
Expand Down

0 comments on commit dcbd7b6

Please sign in to comment.