Don't enforce scopes in the API policies UT temporary

There is bug in oslo_policy [1] that caused issues with enforcing
scopes properly for rules which inherits from the oslo_policy.BaseCheck
class (many of Neutron rules are done like that).
Now when fix [2] will be merged in oslo_policy we will need to change
expected exception type in some of the policies UT from
PolicyNotAuthorized to InvalidScope.
For now, to make it working with both old and new oslo_policy, let's
disable enforcing scopes in those UT. It will be enabled again when new
oslo_policy will be fixed and we will us it in Neutron.

[1] https://launchpad.net/bugs/1923503
[2] https://review.opendev.org/c/openstack/oslo.policy/+/804980

Related-Bug: #1923503
Change-Id: I5c64eb9315b37379b0899c9d35f2f0d96f9c1579
This commit is contained in:
Slawek Kaplonski 2021-10-28 15:12:15 +02:00
parent cee0653145
commit 0e09bf8ce1

View File

@ -29,8 +29,11 @@ class PolicyBaseTestCase(tests_base.BaseTestCase):
# That tests are testing only new default policies.
cfg.CONF.set_override(
'enforce_new_defaults', True, group='oslo_policy')
# TODO(slaweq): Remove that override once fix
# https://review.opendev.org/c/openstack/oslo.policy/+/804980 will be
# merged and released in oslo_policy
cfg.CONF.set_override(
'enforce_scope', True, group='oslo_policy')
'enforce_scope', False, group='oslo_policy')
super(PolicyBaseTestCase, self).setUp()
self.project_id = uuidutils.generate_uuid()
self.system_user_id = uuidutils.generate_uuid()