Fix unit test for oslo.context 4.1.0

oslo.context 4.1.0 has removed the deprecated field
'tenant' and nova unit test fail as it still expect
the 'tenant' field.

Failure happening in requirements patch while updating the
u-c
- https://review.opendev.org/c/openstack/requirements/+/829599
- http://lists.openstack.org/pipermail/openstack-discuss/2022-February/027455.html

Closes-Bug: #1964737

Change-Id: I899f3b442217d09f98c1fbdb3a72c623a9d2ffaf
This commit is contained in:
zhangbailin 2022-03-14 10:15:16 +08:00 committed by Brin Zhang
parent 99404c804e
commit 52e3bc8a0d

View File

@ -192,8 +192,8 @@ def authorize_wsgi(api_name, act=None, need_target=True):
else:
# for create method, before resource exsites, we can check the
# the credentials with itself.
target = {'project_id': context.tenant,
'user_id': context.user}
target = {'project_id': context.project_id,
'user_id': context.user_id}
try:
authorize(action, target, credentials, do_raise=True)