update tests for new oslo.context release
context.user has been deprecated for years and renamed to user_id the deprecated field has now been removed so this change updates our test cases to reflect that. Change-Id: I120441fb9392c370c57dc63d8c115d8993d25f62
This commit is contained in:
@@ -55,7 +55,7 @@ class MyObj(base.WatcherPersistentObject, base.WatcherObject,
|
|||||||
|
|
||||||
@object_base.remotable
|
@object_base.remotable
|
||||||
def update_test(self, context=None):
|
def update_test(self, context=None):
|
||||||
if context and context.user == 'alternate':
|
if context and context.user_id == 'alternate':
|
||||||
self.bar = 'alternate-context'
|
self.bar = 'alternate-context'
|
||||||
else:
|
else:
|
||||||
self.bar = 'updated'
|
self.bar = 'updated'
|
||||||
@@ -209,7 +209,7 @@ class _TestObject(object):
|
|||||||
|
|
||||||
def test_with_alternate_context(self):
|
def test_with_alternate_context(self):
|
||||||
ctxt1 = context.RequestContext('foo', 'foo')
|
ctxt1 = context.RequestContext('foo', 'foo')
|
||||||
ctxt2 = context.RequestContext(user='alternate')
|
ctxt2 = context.RequestContext(user_id='alternate')
|
||||||
obj = MyObj.query(ctxt1)
|
obj = MyObj.query(ctxt1)
|
||||||
obj.update_test(ctxt2)
|
obj.update_test(ctxt2)
|
||||||
self.assertEqual('alternate-context', obj.bar)
|
self.assertEqual('alternate-context', obj.bar)
|
||||||
|
Reference in New Issue
Block a user