Support empty list as api-def default
A number of core and 3rd party plugins define their API definition attribute maps with an empty list as a default value [1]. In these existing definitions [1], some use a converter and others don't. The current implementation of the base API definition test case doesn't account for the case when the definition does not specify a converter. This patch updates the base API definition test case to support an empty list as a default without an explicit converter (for example [2]). [1] http://codesearch.openstack.org/?q=%27default%27%3A%20%5C%5B%5C%5D&i=nope&files=&repos= [2] https://review.openstack.org/394244/ Change-Id: I98514b6068d040e84f95c3b7249a96f5f36ddd64
This commit is contained in:
parent
87b8d4ada3
commit
cf72bd10e6
@ -31,7 +31,8 @@ def assert_converter(tester, attribute, attribute_dict, keyword, value):
|
||||
try:
|
||||
attribute_dict['convert_list_to'](attribute_dict['default'])
|
||||
except KeyError:
|
||||
if validators.is_attr_set(value) and not isinstance(value, str):
|
||||
if validators.is_attr_set(value) and not isinstance(
|
||||
value, (str, list)):
|
||||
tester.fail("Default value '%s' cannot be converted for "
|
||||
"attribute %s." % (value, attribute))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user