Skip to content

Commit 79de137

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "identity: Add missing user argument"
2 parents f380d02 + e26b447 commit 79de137

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

openstackclient/identity/v3/user.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,8 @@ def get_parser(self, prog_name):
659659

660660
def take_action(self, parsed_args):
661661
identity_client = self.app.client_manager.sdk_connection.identity
662+
conn = self.app.client_manager.sdk_connection
663+
user_id = conn.config.get_auth().get_user_id(conn.identity)
662664

663665
# FIXME(gyee): there are two scenarios:
664666
#
@@ -701,7 +703,9 @@ def take_action(self, parsed_args):
701703
)
702704

703705
identity_client.update_user(
704-
current_password=current_password, password=password
706+
user=user_id,
707+
current_password=current_password,
708+
password=password,
705709
)
706710

707711

openstackclient/tests/unit/identity/v3/test_user.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,11 +1686,14 @@ def test_user_password_change(self):
16861686
# Mock getting user current password.
16871687
with self._mock_get_password(current_pass):
16881688
result = self.cmd.take_action(parsed_args)
1689+
self.assertIsNone(result)
1690+
1691+
conn = self.app.client_manager.sdk_connection
1692+
user_id = conn.config.get_auth().get_user_id(conn.identity)
16891693

16901694
self.identity_sdk_client.update_user.assert_called_with(
1691-
current_password=current_pass, password=new_pass
1695+
user=user_id, current_password=current_pass, password=new_pass
16921696
)
1693-
self.assertIsNone(result)
16941697

16951698
def test_user_create_password_prompt(self):
16961699
current_pass = 'old_pass'
@@ -1700,11 +1703,14 @@ def test_user_create_password_prompt(self):
17001703
# Mock getting user current and new password.
17011704
with self._mock_get_password(current_pass, new_pass):
17021705
result = self.cmd.take_action(parsed_args)
1706+
self.assertIsNone(result)
1707+
1708+
conn = self.app.client_manager.sdk_connection
1709+
user_id = conn.config.get_auth().get_user_id(conn.identity)
17031710

17041711
self.identity_sdk_client.update_user.assert_called_with(
1705-
current_password=current_pass, password=new_pass
1712+
user=user_id, current_password=current_pass, password=new_pass
17061713
)
1707-
self.assertIsNone(result)
17081714

17091715
def test_user_password_change_no_prompt(self):
17101716
current_pass = 'old_pass'
@@ -1722,11 +1728,14 @@ def test_user_password_change_no_prompt(self):
17221728
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
17231729

17241730
result = self.cmd.take_action(parsed_args)
1731+
self.assertIsNone(result)
1732+
1733+
conn = self.app.client_manager.sdk_connection
1734+
user_id = conn.config.get_auth().get_user_id(conn.identity)
17251735

17261736
self.identity_sdk_client.update_user.assert_called_with(
1727-
current_password=current_pass, password=new_pass
1737+
user=user_id, current_password=current_pass, password=new_pass
17281738
)
1729-
self.assertIsNone(result)
17301739

17311740

17321741
class TestUserShow(identity_fakes.TestIdentityv3):

0 commit comments

Comments
 (0)