summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/identity/v3/fakes.py
diff options
context:
space:
mode:
authorHarry Rybacki <hrybacki@redhat.com>2017-07-19 13:07:34 +0000
committerHarry Rybacki <hrybacki@redhat.com>2017-08-22 17:08:30 +0000
commit8cd3e258c5029a8efedab40019d6cfd3eac379f5 (patch)
tree0f79cbccc7d42a101ca6fff68161cf7b94c723b2 /openstackclient/tests/unit/identity/v3/fakes.py
parent5cc4d5b5307c44b71f00d44985b98e54366f8397 (diff)
downloadpython-openstackclient-8cd3e258c5029a8efedab40019d6cfd3eac379f5.tar.gz
Implied Roles
Allow the user to create an inference rule between two roles. The first, called the prior role is the role explicitly assigned to an individual. The second, called the implied role, is one that the user gets implicitly. For example: Role B implies Role A. User X is assigned Role B. Therefore User X also assigned Role A. The management and maintenance of the rules is performed in the Keystone server. Change-Id: If547c2f16e812bc7fffd742ec37e6a26011f3185
Diffstat (limited to 'openstackclient/tests/unit/identity/v3/fakes.py')
-rw-r--r--openstackclient/tests/unit/identity/v3/fakes.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/identity/v3/fakes.py b/openstackclient/tests/unit/identity/v3/fakes.py
index 997bcf63..7de25152 100644
--- a/openstackclient/tests/unit/identity/v3/fakes.py
+++ b/openstackclient/tests/unit/identity/v3/fakes.py
@@ -184,6 +184,8 @@ ROLE_2 = {
'links': base_url + 'roles/' + 'r2',
}
+ROLES = [ROLE, ROLE_2]
+
service_id = 's-123'
service_name = 'Texaco'
service_type = 'gas'
@@ -968,3 +970,25 @@ class FakeRoleAssignment(object):
info=copy.deepcopy(role_assignment_info), loaded=True)
return role_assignment
+
+
+class FakeImpliedRoleResponse(object):
+ """Fake one or more role assignment."""
+ def __init__(self, prior_role, implied_roles):
+ self.prior_role = prior_role
+ self.implies = [role for role in implied_roles]
+
+ @staticmethod
+ def create_list():
+ """Create a fake implied role list response.
+
+ :return:
+ A list of FakeImpliedRoleResponse objects
+ """
+
+ # set default attributes.
+ implied_roles = [
+ FakeImpliedRoleResponse(ROLES[0], [ROLES[1]])
+ ]
+
+ return implied_roles