summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/identity/v3/test_group.py
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient/tests/unit/identity/v3/test_group.py')
-rw-r--r--openstackclient/tests/unit/identity/v3/test_group.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/identity/v3/test_group.py b/openstackclient/tests/unit/identity/v3/test_group.py
index 8558de95..00bd217d 100644
--- a/openstackclient/tests/unit/identity/v3/test_group.py
+++ b/openstackclient/tests/unit/identity/v3/test_group.py
@@ -70,6 +70,20 @@ class TestGroupAddUser(TestGroup):
self.user.id, self.group.id)
self.assertIsNone(result)
+ def test_group_add_user_with_error(self):
+ self.users_mock.add_to_group.side_effect = exceptions.CommandError()
+ arglist = [
+ self.group.name,
+ self.user.name,
+ ]
+ verifylist = [
+ ('group', self.group.name),
+ ('user', self.user.name),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+ self.assertRaises(exceptions.CommandError,
+ self.cmd.take_action, parsed_args)
+
class TestGroupCheckUser(TestGroup):
@@ -460,6 +474,21 @@ class TestGroupRemoveUser(TestGroup):
self.user.id, self.group.id)
self.assertIsNone(result)
+ def test_group_remove_user_with_error(self):
+ self.users_mock.remove_from_group.side_effect = (
+ exceptions.CommandError())
+ arglist = [
+ self.group.id,
+ self.user.id,
+ ]
+ verifylist = [
+ ('group', self.group.id),
+ ('user', self.user.id),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+ self.assertRaises(exceptions.CommandError,
+ self.cmd.take_action, parsed_args)
+
class TestGroupSet(TestGroup):