summaryrefslogtreecommitdiff
path: root/openstackclient/tests
diff options
context:
space:
mode:
authorSamuel Pilla <sp516w@att.com>2017-01-25 10:40:49 -0600
committerSteve Martinelli <s.martinelli@gmail.com>2017-01-25 22:16:22 +0000
commit4cb56269ad30d0bd59f7685040ab0585f38c3b0f (patch)
tree50c8d3b27fe32e36a2f85c8079442178b6fd190c /openstackclient/tests
parentb69b539a422860bfb402093ff9d93a1b6e338b26 (diff)
downloadpython-openstackclient-4cb56269ad30d0bd59f7685040ab0585f38c3b0f.tar.gz
Adds domain specification for SetUser
This patch adds the ability to specify the domain context for making changes to a user with `--domain` flag. Example: $ openstack user set test_user --domain test_domain --enable Change-Id: I2b3241785c22e72e19181394acff650422299b0e Closes-Bug: #1658147
Diffstat (limited to 'openstackclient/tests')
-rw-r--r--openstackclient/tests/unit/identity/v3/test_user.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/identity/v3/test_user.py b/openstackclient/tests/unit/identity/v3/test_user.py
index 3c1f49a6..2ce66e94 100644
--- a/openstackclient/tests/unit/identity/v3/test_user.py
+++ b/openstackclient/tests/unit/identity/v3/test_user.py
@@ -684,9 +684,14 @@ class TestUserList(TestUser):
class TestUserSet(TestUser):
project = identity_fakes.FakeProject.create_one_project()
+ domain = identity_fakes.FakeDomain.create_one_domain()
user = identity_fakes.FakeUser.create_one_user(
attrs={'default_project_id': project.id}
)
+ user2 = identity_fakes.FakeUser.create_one_user(
+ attrs={'default_project_id': project.id,
+ 'domain_id': domain.id}
+ )
def setUp(self):
super(TestUserSet, self).setUp()
@@ -748,6 +753,37 @@ class TestUserSet(TestUser):
)
self.assertIsNone(result)
+ def test_user_set_specify_domain(self):
+ arglist = [
+ '--name', 'qwerty',
+ '--domain', self.domain.id,
+ self.user2.name
+ ]
+ verifylist = [
+ ('name', 'qwerty'),
+ ('password', None),
+ ('domain', self.domain.id),
+ ('email', None),
+ ('project', None),
+ ('enable', False),
+ ('disable', False),
+ ('user', self.user2.name),
+ ]
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ result = self.cmd.take_action(parsed_args)
+
+ kwargs = {
+ 'enabled': True,
+ 'name': 'qwerty'
+ }
+
+ self.users_mock.update.assert_called_with(
+ self.user.id,
+ **kwargs
+ )
+ self.assertIsNone(result)
+
def test_user_set_password(self):
arglist = [
'--password', 'secret',