Explicitly check policy name in policy warning tests
This commit makes keystone tests for oslo policy warning to check policy name explicitly. oslo policy 3.10 modified the warning text to include the policy name as well as the check-str so new warning message verified in keystone test will not work on old oslo policy (<3.10), so bumping the oslo.policy in requirements.txt Change-Id: I14132dfced48ddc93c29ce2b4c20ed2cabc1dbd6
This commit is contained in:
parent
fc9efc45b2
commit
6f87111a92
@ -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):
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user