Support implied rules
Using keystone API[0] to get all role inference rules and makes it
possible to extend the used list of roles with implied roles.
[0] https://developer.openstack.org/api-ref/identity/v3/#list-all-role-inference-rules
Change-Id: Ia57351f3b21a82f4556ec61323abd295b427fc1e
diff --git a/patrole_tempest_plugin/tests/unit/base.py b/patrole_tempest_plugin/tests/unit/base.py
index d73ff43..9a801bd 100644
--- a/patrole_tempest_plugin/tests/unit/base.py
+++ b/patrole_tempest_plugin/tests/unit/base.py
@@ -14,9 +14,19 @@
# License for the specific language governing permissions and limitations
# under the License.
-from oslotest import base
+from tempest.tests import base
-class TestCase(base.BaseTestCase):
+class TestCase(base.TestCase):
"""Test case base class for all unit tests."""
+
+ def get_all_needed_roles(self, roles):
+ role_inferences_mapping = {
+ "admin": {"member", "reader"},
+ "member": {"reader"}
+ }
+ res = set(r.lower() for r in roles)
+ for role in res.copy():
+ res.update(role_inferences_mapping.get(role, set()))
+ return list(res)