Add role assignments rbac tests to identity v3.
Add role assignments rbac tests to identity v3. These
tests cover the policy actions here [0]:
- identity:list_role_assignments
- identity:list_role_assignments_for_tree
[0] https://github.com/openstack/keystone/blob/master/keystone/common/policies/role_assignment.py
Change-Id: I7bdeedf51f77ba008dbad74c32c668eb0cab8aac
Partially-Implements: blueprint initial-tests-identity
diff --git a/patrole_tempest_plugin/tests/api/identity/v3/rbac_base.py b/patrole_tempest_plugin/tests/api/identity/v3/rbac_base.py
index 5c1acce..b19d00a 100644
--- a/patrole_tempest_plugin/tests/api/identity/v3/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/identity/v3/rbac_base.py
@@ -49,6 +49,7 @@
cls.projects_client = cls.os.projects_client
cls.policies_client = cls.os.policies_client
cls.regions_client = cls.os.regions_client
+ cls.role_assignments_client = cls.os.role_assignments_client
cls.roles_client = cls.os.roles_v3_client
cls.services_client = cls.os.identity_services_v3_client
cls.users_client = cls.os.users_v3_client
diff --git a/patrole_tempest_plugin/tests/api/identity/v3/test_role_assignments_rbac.py b/patrole_tempest_plugin/tests/api/identity/v3/test_role_assignments_rbac.py
new file mode 100644
index 0000000..878edcb
--- /dev/null
+++ b/patrole_tempest_plugin/tests/api/identity/v3/test_role_assignments_rbac.py
@@ -0,0 +1,47 @@
+# Copyright 2017 AT&T Corporation.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.lib import decorators
+
+from patrole_tempest_plugin import rbac_rule_validation
+from patrole_tempest_plugin.tests.api.identity.v3 import rbac_base
+
+
+class IdentityRoleAssignmentsV3AdminRbacTest(
+ rbac_base.BaseIdentityV3RbacAdminTest):
+
+ @classmethod
+ def setup_clients(cls):
+ super(IdentityRoleAssignmentsV3AdminRbacTest, cls).setup_clients()
+ cls.client = cls.role_assignments_client
+
+ @decorators.idempotent_id('afe57adb-1b9c-43d9-84a9-f0cf4c94e416')
+ @rbac_rule_validation.action(service="keystone",
+ rule="identity:list_role_assignments")
+ def test_list_role_assignments(self):
+ self.rbac_utils.switch_role(self, switchToRbacRole=True)
+ self.client.list_role_assignments()['role_assignments']
+
+ @decorators.idempotent_id('36c7a990-857e-415c-8717-38d7200a9894')
+ @rbac_rule_validation.action(
+ service="keystone",
+ rule="identity:list_role_assignments_for_tree")
+ def test_list_role_assignments_for_tree(self):
+ project = self.setup_test_project()
+
+ self.rbac_utils.switch_role(self, switchToRbacRole=True)
+ self.client.list_role_assignments(
+ include_subtree=True, **{'scope.project.id': project['id']})[
+ 'role_assignments']