Merge "Fix mixin class clients"
This commit is contained in:
commit
9fcfdf8558
@ -96,13 +96,13 @@ class KeystoneRoleAssignmentMixin(object):
|
|||||||
def _add_role_assignments_to_group(self, group_id, role_assignments):
|
def _add_role_assignments_to_group(self, group_id, role_assignments):
|
||||||
for role_assignment in self._normalize_to_id(role_assignments):
|
for role_assignment in self._normalize_to_id(role_assignments):
|
||||||
if role_assignment.get(self.PROJECT) is not None:
|
if role_assignment.get(self.PROJECT) is not None:
|
||||||
self.client().client.roles.grant(
|
self.client().roles.grant(
|
||||||
role=role_assignment.get(self.ROLE),
|
role=role_assignment.get(self.ROLE),
|
||||||
project=role_assignment.get(self.PROJECT),
|
project=role_assignment.get(self.PROJECT),
|
||||||
group=group_id
|
group=group_id
|
||||||
)
|
)
|
||||||
elif role_assignment.get(self.DOMAIN) is not None:
|
elif role_assignment.get(self.DOMAIN) is not None:
|
||||||
self.client().client.roles.grant(
|
self.client().roles.grant(
|
||||||
role=role_assignment.get(self.ROLE),
|
role=role_assignment.get(self.ROLE),
|
||||||
domain=role_assignment.get(self.DOMAIN),
|
domain=role_assignment.get(self.DOMAIN),
|
||||||
group=group_id
|
group=group_id
|
||||||
@ -111,13 +111,13 @@ class KeystoneRoleAssignmentMixin(object):
|
|||||||
def _add_role_assignments_to_user(self, user_id, role_assignments):
|
def _add_role_assignments_to_user(self, user_id, role_assignments):
|
||||||
for role_assignment in self._normalize_to_id(role_assignments):
|
for role_assignment in self._normalize_to_id(role_assignments):
|
||||||
if role_assignment.get(self.PROJECT) is not None:
|
if role_assignment.get(self.PROJECT) is not None:
|
||||||
self.client().client.roles.grant(
|
self.client().roles.grant(
|
||||||
role=role_assignment.get(self.ROLE),
|
role=role_assignment.get(self.ROLE),
|
||||||
project=role_assignment.get(self.PROJECT),
|
project=role_assignment.get(self.PROJECT),
|
||||||
user=user_id
|
user=user_id
|
||||||
)
|
)
|
||||||
elif role_assignment.get(self.DOMAIN) is not None:
|
elif role_assignment.get(self.DOMAIN) is not None:
|
||||||
self.client().client.roles.grant(
|
self.client().roles.grant(
|
||||||
role=role_assignment.get(self.ROLE),
|
role=role_assignment.get(self.ROLE),
|
||||||
domain=role_assignment.get(self.DOMAIN),
|
domain=role_assignment.get(self.DOMAIN),
|
||||||
user=user_id
|
user=user_id
|
||||||
@ -126,13 +126,13 @@ class KeystoneRoleAssignmentMixin(object):
|
|||||||
def _remove_role_assignments_from_group(self, group_id, role_assignments):
|
def _remove_role_assignments_from_group(self, group_id, role_assignments):
|
||||||
for role_assignment in self._normalize_to_id(role_assignments):
|
for role_assignment in self._normalize_to_id(role_assignments):
|
||||||
if role_assignment.get(self.PROJECT) is not None:
|
if role_assignment.get(self.PROJECT) is not None:
|
||||||
self.client().client.roles.revoke(
|
self.client().roles.revoke(
|
||||||
role=role_assignment.get(self.ROLE),
|
role=role_assignment.get(self.ROLE),
|
||||||
project=role_assignment.get(self.PROJECT),
|
project=role_assignment.get(self.PROJECT),
|
||||||
group=group_id
|
group=group_id
|
||||||
)
|
)
|
||||||
elif role_assignment.get(self.DOMAIN) is not None:
|
elif role_assignment.get(self.DOMAIN) is not None:
|
||||||
self.client().client.roles.revoke(
|
self.client().roles.revoke(
|
||||||
role=role_assignment.get(self.ROLE),
|
role=role_assignment.get(self.ROLE),
|
||||||
domain=role_assignment.get(self.DOMAIN),
|
domain=role_assignment.get(self.DOMAIN),
|
||||||
group=group_id
|
group=group_id
|
||||||
@ -141,13 +141,13 @@ class KeystoneRoleAssignmentMixin(object):
|
|||||||
def _remove_role_assignments_from_user(self, user_id, role_assignments):
|
def _remove_role_assignments_from_user(self, user_id, role_assignments):
|
||||||
for role_assignment in self._normalize_to_id(role_assignments):
|
for role_assignment in self._normalize_to_id(role_assignments):
|
||||||
if role_assignment.get(self.PROJECT) is not None:
|
if role_assignment.get(self.PROJECT) is not None:
|
||||||
self.client().client.roles.revoke(
|
self.client().roles.revoke(
|
||||||
role=role_assignment.get(self.ROLE),
|
role=role_assignment.get(self.ROLE),
|
||||||
project=role_assignment.get(self.PROJECT),
|
project=role_assignment.get(self.PROJECT),
|
||||||
user=user_id
|
user=user_id
|
||||||
)
|
)
|
||||||
elif role_assignment.get(self.DOMAIN) is not None:
|
elif role_assignment.get(self.DOMAIN) is not None:
|
||||||
self.client().client.roles.revoke(
|
self.client().roles.revoke(
|
||||||
role=role_assignment.get(self.ROLE),
|
role=role_assignment.get(self.ROLE),
|
||||||
domain=role_assignment.get(self.DOMAIN),
|
domain=role_assignment.get(self.DOMAIN),
|
||||||
user=user_id
|
user=user_id
|
||||||
|
@ -78,7 +78,7 @@ class KeystoneRoleAssignmentMixinTest(common.HeatTestCase):
|
|||||||
self.keystoneclient = mock.MagicMock()
|
self.keystoneclient = mock.MagicMock()
|
||||||
self.test_role_assignment.client = mock.MagicMock()
|
self.test_role_assignment.client = mock.MagicMock()
|
||||||
self.test_role_assignment.client.return_value = self.keystoneclient
|
self.test_role_assignment.client.return_value = self.keystoneclient
|
||||||
self.roles = self.keystoneclient.client.roles
|
self.roles = self.keystoneclient.roles
|
||||||
|
|
||||||
# Mock client plugin
|
# Mock client plugin
|
||||||
def _side_effect(value):
|
def _side_effect(value):
|
||||||
@ -412,7 +412,7 @@ class KeystoneUserRoleAssignmentTest(common.HeatTestCase):
|
|||||||
self.keystoneclient = mock.MagicMock()
|
self.keystoneclient = mock.MagicMock()
|
||||||
self.test_role_assignment.client = mock.MagicMock()
|
self.test_role_assignment.client = mock.MagicMock()
|
||||||
self.test_role_assignment.client.return_value = self.keystoneclient
|
self.test_role_assignment.client.return_value = self.keystoneclient
|
||||||
self.roles = self.keystoneclient.client.roles
|
self.roles = self.keystoneclient.roles
|
||||||
|
|
||||||
# Mock client plugin
|
# Mock client plugin
|
||||||
def _side_effect(value):
|
def _side_effect(value):
|
||||||
@ -550,7 +550,7 @@ class KeystoneGroupRoleAssignmentTest(common.HeatTestCase):
|
|||||||
self.keystoneclient = mock.MagicMock()
|
self.keystoneclient = mock.MagicMock()
|
||||||
self.test_role_assignment.client = mock.MagicMock()
|
self.test_role_assignment.client = mock.MagicMock()
|
||||||
self.test_role_assignment.client.return_value = self.keystoneclient
|
self.test_role_assignment.client.return_value = self.keystoneclient
|
||||||
self.roles = self.keystoneclient.client.roles
|
self.roles = self.keystoneclient.roles
|
||||||
|
|
||||||
# Mock client plugin
|
# Mock client plugin
|
||||||
def _side_effect(value):
|
def _side_effect(value):
|
||||||
|
Loading…
Reference in New Issue
Block a user