Comment 0 for bug 999567

Revision history for this message
Rohit Karajgi (rohitk) wrote : Keystone Admin - Deleting a roleRef for a non existent user returns Internal Server Error

Our tempest test calls the delete_role_ref() Admin API and passes an invalid/non-existent value for userId.

Expected result: HTTP 404 NotFound or HTTP 400 BadRequest error.
Actual Result: HTTP 500 Internal Server Error is returned

======================================================================
ERROR: Attempt to delete a role from a non existent user should fail
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/stack/tempest/tests/identity/test_roles.py", line 185, in test_delete_user_role_non_existant_user
    'junk-user-id-123', role['id'])
  File "/usr/lib/pymodules/python2.7/unittest2/case.py", line 475, in assertRaises
    callableObj(*args, **kwargs)
  File "/opt/stack/tempest/services/identity/json/admin_client.py", line 80, in delete_user_role
    resp, body = self.delete('users/%s/roleRefs/%s' % (user_id, role_id))
  File "/opt/stack/tempest/common/rest_client.py", line 163, in delete
    return self.request('DELETE', url)
  File "/opt/stack/tempest/common/rest_client.py", line 229, in request
    message = resp_body['computeFault']['message']
KeyError: '\'computeFault\'\n-------------------- >> begin captured logging << --------------------\ntempest.config: INFO: Using tempest config file /opt/stack/etc/tempest.conf\ntempest.common.rest_client: ERROR: Request URL: http://10.2.3.164:35357/v2.0/users/junk-user-id-123/roleRefs/3d3fb10c2b184204a484bfe0440ac38c\ntempest.common.rest_client: ERROR: Request Body: None\ntempest.common.rest_client: ERROR: Response Headers: {\'date\': \'Tue, 15 May 2012 09:49:37 GMT\', \'content-type\': \'application/json\', \'content-length\': \'182\', \'status\': \'500\', \'vary\': \'X-Auth-Token\'}\ntempest.common.rest_client: ERROR: Response Body: {u\'error\': {u\'message\': u"An unexpected error prevented the server from fulfilling your request. \'NoneType\' object is not subscriptable", u\'code\': 500, u\'title\': u\'Internal Server Error\'}}\n--------------------- >> end captured logging << ---------------------'

----------------------------------------------------------------------