VIM should accept valid boolean values for is_default

In case of create VIM API, is_default_parameter accepts any string
values like "abc" or "1234" and set the value as True. It should
strictly check for valid boolean values.

Fixed this issue by using convert_to_boolean validator. so now, if
you pass any non-boolean value, it will return 400 error to the user.

NOTE:
The below test case fails if we inherit the test class
'..tests.unit.base.TestCase' from '..tests.base.BaseTestCase' with
KeyError:

tacker.tests.unit.nfvo.test_nfvo_plugin.TestNfvoPlugin.
test_create_ns_workflow_no_task_exception

The reason behind the failure is, the raised exception
'..extensions.nfvo.NoTasksException' expects that the 'action' and
'resource' should be passed as arguments to the exception while raising
it to form the exception message. If you don't pass these two arguments
then it fails to form the exception message and raises KeyError.
This happens because the '..tests.base.BaseTestCase' test class uses
exception fixture and sets 'use_fatal_exceptions' to True always which
results into not raising the raised exception again and it tries to
form the exception message and pass it to the base class __init__ for
further processing. It fails and raises KeyError while forming that
exception message because in 'test_create_ns_workflow_no_task_exception'
test case these arguments are not passed to the exception while
raising.

To fix this test case, passed the required 'action' and 'resource'
arguments to the exception while raising it.

DocImpact
Closes-Bug: #1746538
Change-Id: Ib533b38a48d31cb26eecdc546b20b0f99beeaa34
This commit is contained in:
nitesh vanarase
2018-01-23 17:32:26 +05:30
committed by nitesh.vanarase
parent 9b8f40833e
commit b2ac5b6702
10 changed files with 153 additions and 4 deletions

View File

@@ -16,6 +16,7 @@ cmd2==0.8.2
contextlib2==0.5.5
coverage==4.0
cryptography==2.1
ddt===1.0.1
debtcollector==1.19.0
decorator==4.2.1
deprecation==2.0