Merge "Clean up exception message raised by policy authority module"
diff --git a/patrole_tempest_plugin/policy_authority.py b/patrole_tempest_plugin/policy_authority.py
index 3f4236b..6851942 100644
--- a/patrole_tempest_plugin/policy_authority.py
+++ b/patrole_tempest_plugin/policy_authority.py
@@ -292,8 +292,9 @@
def _try_rule(self, apply_rule, target, access_data, o):
if apply_rule not in self.rules:
- message = "Policy action: {0} not found in policy file: {1}."\
- .format(apply_rule, self.path)
+ message = ("Policy action \"{0}\" not found in policy file: {1} or"
+ " among registered policy in code defaults for service."
+ ).format(apply_rule, self.path)
LOG.debug(message)
raise rbac_exceptions.RbacParsingException(message)
else:
diff --git a/patrole_tempest_plugin/tests/unit/test_policy_authority.py b/patrole_tempest_plugin/tests/unit/test_policy_authority.py
index db651fc..d2074e7 100644
--- a/patrole_tempest_plugin/tests/unit/test_policy_authority.py
+++ b/patrole_tempest_plugin/tests/unit/test_policy_authority.py
@@ -269,8 +269,10 @@
test_tenant_id, test_user_id, "custom_rbac_policy")
fake_rule = 'fake_rule'
- expected_message = "Policy action: {0} not found in policy file: {1}."\
- .format(fake_rule, self.custom_policy_file)
+ expected_message = (
+ "Policy action \"{0}\" not found in policy file: {1} or among "
+ "registered policy in code defaults for service.").format(
+ fake_rule, self.custom_policy_file)
e = self.assertRaises(rbac_exceptions.RbacParsingException,
authority.allowed, fake_rule, None)
@@ -289,9 +291,10 @@
**{'__getitem__.return_value.side_effect': Exception(
mock.sentinel.error)})
- expected_message = "Policy action: {0} not found in "\
- "policy file: {1}.".format(mock.sentinel.rule,
- self.custom_policy_file)
+ expected_message = (
+ "Policy action \"{0}\" not found in policy file: {1} or among "
+ "registered policy in code defaults for service.").format(
+ mock.sentinel.rule, self.custom_policy_file)
e = self.assertRaises(rbac_exceptions.RbacParsingException,
authority.allowed, mock.sentinel.rule, None)