From 56e903dfb6ca5ede9ba6b4bd4cfcc3415bf7a170 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Thu, 25 Feb 2021 21:09:11 +0000 Subject: Reinstate double deprecation test logic This was lost in a previous change, but in the interest of not holding up the merge of the functional part of it I'm fixing the test in this followup. The new version of the test verifies that the rule isn't overwritten by a second call to load_rules, which is what would happen if we called the deprecation handler again. Change-Id: Idc9dd353463da63a2108782f7b141d1d8014d180 --- oslo_policy/tests/test_policy.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/oslo_policy/tests/test_policy.py b/oslo_policy/tests/test_policy.py index 0a8bab5..d5c86c3 100644 --- a/oslo_policy/tests/test_policy.py +++ b/oslo_policy/tests/test_policy.py @@ -1802,6 +1802,12 @@ class DocumentedRuleDefaultDeprecationTestCase(base.PolicyBaseTestCase): self.assertEqual( str(enforcer.rules['foo:create_bar']), str(expected_check)) self.assertEqual(check, rule.check) + # Hacky way to check whether _handle_deprecated_rule was called again. + # If a second call to load_rules doesn't overwrite our dummy rule then + # we know it didn't call the deprecated rule function again. + enforcer.rules['foo:create_bar'] = 'foo:bar' + enforcer.load_rules() + self.assertEqual('foo:bar', enforcer.rules['foo:create_bar']) class DocumentedRuleDefaultTestCase(base.PolicyBaseTestCase): -- cgit v1.2.1