identity: Add missing user argument
Change-Id: Ifd2b32e97d1f5fd426f333da13852a8bb6821f1b Signed-off-by: Stephen Finucane <stephenfin@redhat.com> Closes-bug: #2110765
This commit is contained in:
openstackclient
@ -659,6 +659,8 @@ class SetPasswordUser(command.Command):
|
|||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
identity_client = self.app.client_manager.sdk_connection.identity
|
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:
|
# FIXME(gyee): there are two scenarios:
|
||||||
#
|
#
|
||||||
@ -701,7 +703,9 @@ class SetPasswordUser(command.Command):
|
|||||||
)
|
)
|
||||||
|
|
||||||
identity_client.update_user(
|
identity_client.update_user(
|
||||||
current_password=current_password, password=password
|
user=user_id,
|
||||||
|
current_password=current_password,
|
||||||
|
password=password,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1686,11 +1686,14 @@ class TestUserSetPassword(identity_fakes.TestIdentityv3):
|
|||||||
# Mock getting user current password.
|
# Mock getting user current password.
|
||||||
with self._mock_get_password(current_pass):
|
with self._mock_get_password(current_pass):
|
||||||
result = self.cmd.take_action(parsed_args)
|
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(
|
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):
|
def test_user_create_password_prompt(self):
|
||||||
current_pass = 'old_pass'
|
current_pass = 'old_pass'
|
||||||
@ -1700,11 +1703,14 @@ class TestUserSetPassword(identity_fakes.TestIdentityv3):
|
|||||||
# Mock getting user current and new password.
|
# Mock getting user current and new password.
|
||||||
with self._mock_get_password(current_pass, new_pass):
|
with self._mock_get_password(current_pass, new_pass):
|
||||||
result = self.cmd.take_action(parsed_args)
|
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(
|
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):
|
def test_user_password_change_no_prompt(self):
|
||||||
current_pass = 'old_pass'
|
current_pass = 'old_pass'
|
||||||
@ -1722,11 +1728,14 @@ class TestUserSetPassword(identity_fakes.TestIdentityv3):
|
|||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
result = self.cmd.take_action(parsed_args)
|
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(
|
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):
|
class TestUserShow(identity_fakes.TestIdentityv3):
|
||||||
|
Reference in New Issue
Block a user