Make '_create_router' function handle Boolean kwargs correctly

The function allows arbitrary kw arguments to be specificed.
Those kw arguments whose key is specified in the function
parameter 'arg_list' are then passed in the create router REST
API call.

The code line that checks if a kw argument key is included in
'arg_list' does not work with Boolean kw arguments. Nor does it
work with None kw argument values. This is a limitation as
tests in inheriting classes may need such kw arguments.

This patch fixes the faulty 'if' clause so that it simply
checks that the kw argument key is in 'arg_list'. This makes it
support Boolean kw arguments and kw arguments with value None.

Closes-Bug: #1482108
Change-Id: I5618dc4d5c803c7614dd1f579db3c79928007fb6
This commit is contained in:
Bob Melander 2015-06-27 19:14:19 +02:00
parent 42e9585494
commit e28aa97617
1 changed files with 1 additions and 1 deletions

View File

@ -326,7 +326,7 @@ class L3NatTestCaseMixin(object):
data['router']['admin_state_up'] = admin_state_up
for arg in (('admin_state_up', 'tenant_id') + (arg_list or ())):
# Arg must be present and not empty
if kwargs.get(arg):
if arg in kwargs:
data['router'][arg] = kwargs[arg]
router_req = self.new_create_request('routers', data, fmt)
if set_context and tenant_id: