diff --git a/openstackclient/identity/v3/user.py b/openstackclient/identity/v3/user.py index bbf3f1df59..5be69bc652 100644 --- a/openstackclient/identity/v3/user.py +++ b/openstackclient/identity/v3/user.py @@ -659,6 +659,8 @@ class SetPasswordUser(command.Command): def take_action(self, parsed_args): identity_client = self.app.client_manager.sdk_connection.identity + conn = self.app.client_manager.sdk_connection + user_id = conn.config.get_auth().get_user_id(conn.identity) # FIXME(gyee): there are two scenarios: # @@ -701,7 +703,9 @@ class SetPasswordUser(command.Command): ) identity_client.update_user( - current_password=current_password, password=password + user=user_id, + current_password=current_password, + password=password, ) diff --git a/openstackclient/tests/unit/identity/v3/test_user.py b/openstackclient/tests/unit/identity/v3/test_user.py index 91e8b45c3e..d9e16f174d 100644 --- a/openstackclient/tests/unit/identity/v3/test_user.py +++ b/openstackclient/tests/unit/identity/v3/test_user.py @@ -1686,11 +1686,14 @@ class TestUserSetPassword(identity_fakes.TestIdentityv3): # Mock getting user current password. with self._mock_get_password(current_pass): result = self.cmd.take_action(parsed_args) + self.assertIsNone(result) + + conn = self.app.client_manager.sdk_connection + user_id = conn.config.get_auth().get_user_id(conn.identity) self.identity_sdk_client.update_user.assert_called_with( - current_password=current_pass, password=new_pass + user=user_id, current_password=current_pass, password=new_pass ) - self.assertIsNone(result) def test_user_create_password_prompt(self): current_pass = 'old_pass' @@ -1700,11 +1703,14 @@ class TestUserSetPassword(identity_fakes.TestIdentityv3): # Mock getting user current and new password. with self._mock_get_password(current_pass, new_pass): result = self.cmd.take_action(parsed_args) + self.assertIsNone(result) + + conn = self.app.client_manager.sdk_connection + user_id = conn.config.get_auth().get_user_id(conn.identity) self.identity_sdk_client.update_user.assert_called_with( - current_password=current_pass, password=new_pass + user=user_id, current_password=current_pass, password=new_pass ) - self.assertIsNone(result) def test_user_password_change_no_prompt(self): current_pass = 'old_pass' @@ -1722,11 +1728,14 @@ class TestUserSetPassword(identity_fakes.TestIdentityv3): parsed_args = self.check_parser(self.cmd, arglist, verifylist) result = self.cmd.take_action(parsed_args) + self.assertIsNone(result) + + conn = self.app.client_manager.sdk_connection + user_id = conn.config.get_auth().get_user_id(conn.identity) self.identity_sdk_client.update_user.assert_called_with( - current_password=current_pass, password=new_pass + user=user_id, current_password=current_pass, password=new_pass ) - self.assertIsNone(result) class TestUserShow(identity_fakes.TestIdentityv3):