Fixes deprecations caused by latest oslo.context
In oslo.context 2.12.0 a number of things used by keystone were deprecated. This causes the keystone tests to fail since we treat deprecation as errors. Change-Id: I885431ba957909e709648e03a05bc280441ffbf5
This commit is contained in:
parent
4eab1c1855
commit
dce8a2c11e
@ -24,6 +24,12 @@ def _prop(name):
|
|||||||
class RequestContext(oslo_context.RequestContext):
|
class RequestContext(oslo_context.RequestContext):
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
self.user_id = kwargs.pop('user_id ', None)
|
||||||
|
self.project_id = kwargs.pop('project_id ', None)
|
||||||
|
self.domain_id = kwargs.pop('domain_id ', None)
|
||||||
|
self.user_domain_id = kwargs.pop('user_domain_id ', None)
|
||||||
|
self.project_domain_id = kwargs.pop('project_domain_id ', None)
|
||||||
|
|
||||||
self.project_name = kwargs.pop('project_name', None)
|
self.project_name = kwargs.pop('project_name', None)
|
||||||
self.domain_name = kwargs.pop('domain_name', None)
|
self.domain_name = kwargs.pop('domain_name', None)
|
||||||
self.username = kwargs.pop('username', None)
|
self.username = kwargs.pop('username', None)
|
||||||
@ -46,9 +52,3 @@ class RequestContext(oslo_context.RequestContext):
|
|||||||
def from_environ(cls, environ, **kwargs):
|
def from_environ(cls, environ, **kwargs):
|
||||||
kwargs.setdefault('request_id', environ.get('openstack.request_id'))
|
kwargs.setdefault('request_id', environ.get('openstack.request_id'))
|
||||||
return super(RequestContext, cls).from_environ(environ, **kwargs)
|
return super(RequestContext, cls).from_environ(environ, **kwargs)
|
||||||
|
|
||||||
user_id = _prop('user')
|
|
||||||
project_id = _prop('tenant')
|
|
||||||
domain_id = _prop('domain')
|
|
||||||
user_domain_id = _prop('user_domain')
|
|
||||||
project_domain_id = _prop('project_domain')
|
|
||||||
|
@ -1424,11 +1424,12 @@ class AuthContextMiddlewareTestCase(RestfulTestCase):
|
|||||||
req_context = oslo_context.context.get_current()
|
req_context = oslo_context.context.get_current()
|
||||||
self.assertEqual(request_id, req_context.request_id)
|
self.assertEqual(request_id, req_context.request_id)
|
||||||
self.assertEqual(token, req_context.auth_token)
|
self.assertEqual(token, req_context.auth_token)
|
||||||
self.assertEqual(self.user['id'], req_context.user)
|
self.assertEqual(self.user['id'], req_context.user_id)
|
||||||
self.assertEqual(self.project['id'], req_context.tenant)
|
self.assertEqual(self.project['id'], req_context.project_id)
|
||||||
self.assertIsNone(req_context.domain)
|
self.assertIsNone(req_context.domain_id)
|
||||||
self.assertEqual(self.user['domain_id'], req_context.user_domain)
|
self.assertEqual(self.user['domain_id'], req_context.user_domain_id)
|
||||||
self.assertEqual(self.project['domain_id'], req_context.project_domain)
|
self.assertEqual(self.project['domain_id'],
|
||||||
|
req_context.project_domain_id)
|
||||||
self.assertFalse(req_context.is_admin)
|
self.assertFalse(req_context.is_admin)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user