Update nova api.auth tests to work with newer oslo.context

Due to https://review.openstack.org/#/c/357537/ being
deprecated and removed certain tests in nova are now failing.

To make them pass again use the non-deprecated headers
instead.

Change-Id: I4e26c4517235f4320437904801c374d710655670
This commit is contained in:
Joshua Harlow
2016-11-08 15:58:06 -08:00
parent a6053dd608
commit a672176111

View File

@@ -52,21 +52,8 @@ class TestNovaKeystoneContextMiddleware(test.NoDBTestCase):
self.assertEqual(response.status, '200 OK')
self.assertEqual(self.context.user_id, 'testuserid')
def test_user_only(self):
self.request.headers['X_USER'] = 'testuser'
response = self.request.get_response(self.middleware)
self.assertEqual(response.status, '200 OK')
self.assertEqual(self.context.user_id, 'testuser')
def test_user_id_trumps_user(self):
self.request.headers['X_USER_ID'] = 'testuserid'
self.request.headers['X_USER'] = 'testuser'
response = self.request.get_response(self.middleware)
self.assertEqual(response.status, '200 OK')
self.assertEqual(self.context.user_id, 'testuserid')
def test_invalid_service_catalog(self):
self.request.headers['X_USER'] = 'testuser'
self.request.headers['X_USER_ID'] = 'testuser'
self.request.headers['X_SERVICE_CATALOG'] = "bad json"
response = self.request.get_response(self.middleware)
self.assertEqual(response.status, '500 Internal Server Error')
@@ -98,7 +85,7 @@ class TestKeystoneMiddlewareRoles(test.NoDBTestCase):
self.middleware = nova.api.auth.NovaKeystoneContext(role_check_app)
self.request = webob.Request.blank('/')
self.request.headers['X_USER'] = 'testuser'
self.request.headers['X_USER_ID'] = 'testuser'
self.request.headers['X_TENANT_ID'] = 'testtenantid'
self.request.headers['X_AUTH_TOKEN'] = 'testauthtoken'
self.request.headers['X_SERVICE_CATALOG'] = jsonutils.dumps({})