Merge "Explicitly check policy name in policy warning tests"

This commit is contained in:
Zuul 2022-01-22 00:19:12 +00:00 committed by Gerrit Code Review
commit c05f3ab54e
3 changed files with 4 additions and 6 deletions

View File

@ -151,16 +151,14 @@ class PolicyScopeTypesEnforcementTestCase(unit.TestCase):
def test_warning_message_is_logged_if_enforce_scope_is_false(self):
self.config_fixture.config(group='oslo_policy', enforce_scope=False)
expected_msg = (
'failed scope check. The token used to make the '
'Policy "foo": "" failed scope check. The token used to make the '
'request was project scoped but the policy requires [\'system\'] '
'scope. This behavior may change in the future where using the '
'intended scope is required'
)
with mock.patch('warnings.warn') as mock_warn:
policy.enforce(self.credentials, self.action, self.target)
mock_warn.assert_called_once()
warn_msg = mock_warn.call_args[0][0]
self.assertIn(expected_msg, warn_msg)
mock_warn.assert_called_with(expected_msg)
class PolicyJsonTestCase(unit.TestCase):

View File

@ -32,7 +32,7 @@ oslo.i18n==3.15.3
oslo.log==3.44.0
oslo.messaging==5.29.0
oslo.middleware==3.31.0
oslo.policy==3.7.0
oslo.policy==3.10.0
oslo.serialization==2.18.0
oslo.upgradecheck==1.3.0
oslo.utils==3.33.0

View File

@ -23,7 +23,7 @@ oslo.db>=6.0.0 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0
oslo.log>=3.44.0 # Apache-2.0
oslo.middleware>=3.31.0 # Apache-2.0
oslo.policy>=3.7.0 # Apache-2.0
oslo.policy>=3.10.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
oslo.upgradecheck>=1.3.0 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0