Skip to content

Commit

Permalink
Add checking changePassword None in _action_change_password(v2)
Browse files Browse the repository at this point in the history
Current v2 api can not pass test_change_password_adminpass_none,
if passing body = {'changePassword': None} to _action_change_password
it will case argument of type 'NoneType' is not iterable.

Partially implements blueprint v2-on-v3-api
Change-Id: Ic88e6f600f09282cfb73bd6ccb7a89d34a7b0e59
  • Loading branch information
Eli Qiao committed Jan 21, 2015
1 parent 9f87243 commit 37af081
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 1 addition & 1 deletion nova/api/openstack/compute/servers.py
Expand Up @@ -880,7 +880,7 @@ def _flavor_id_from_req_data(self, data):
@wsgi.action('changePassword')
def _action_change_password(self, req, id, body):
context = req.environ['nova.context']
if ('changePassword' not in body
if (not body.get('changePassword')
or 'adminPass' not in body['changePassword']):
msg = _("No adminPass was specified")
raise exc.HTTPBadRequest(explanation=msg)
Expand Down
Expand Up @@ -144,7 +144,3 @@ def is_loaded(self, ext):

def _check_status(self, expected_status, res, controller_method):
self.assertEqual(expected_status, res.status_int)

def test_change_password_adminpass_none(self):
# TODO(eliqiao): need to handle adminpass is None in v2 api
pass

0 comments on commit 37af081

Please sign in to comment.