Merge "Fixes deprecations caused by latest oslo.context"
This commit is contained in:
commit
5958b3b0d2
@ -24,6 +24,12 @@ def _prop(name):
|
||||
class RequestContext(oslo_context.RequestContext):
|
||||
|
||||
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.domain_name = kwargs.pop('domain_name', None)
|
||||
self.username = kwargs.pop('username', None)
|
||||
@ -46,9 +52,3 @@ class RequestContext(oslo_context.RequestContext):
|
||||
def from_environ(cls, environ, **kwargs):
|
||||
kwargs.setdefault('request_id', environ.get('openstack.request_id'))
|
||||
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()
|
||||
self.assertEqual(request_id, req_context.request_id)
|
||||
self.assertEqual(token, req_context.auth_token)
|
||||
self.assertEqual(self.user['id'], req_context.user)
|
||||
self.assertEqual(self.project['id'], req_context.tenant)
|
||||
self.assertIsNone(req_context.domain)
|
||||
self.assertEqual(self.user['domain_id'], req_context.user_domain)
|
||||
self.assertEqual(self.project['domain_id'], req_context.project_domain)
|
||||
self.assertEqual(self.user['id'], req_context.user_id)
|
||||
self.assertEqual(self.project['id'], req_context.project_id)
|
||||
self.assertIsNone(req_context.domain_id)
|
||||
self.assertEqual(self.user['domain_id'], req_context.user_domain_id)
|
||||
self.assertEqual(self.project['domain_id'],
|
||||
req_context.project_domain_id)
|
||||
self.assertFalse(req_context.is_admin)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user