From 5cbecc130ef2aacd5d9bd265b814e6f8140374f9 Mon Sep 17 00:00:00 2001 From: Guang Yee Date: Thu, 7 Jan 2016 18:56:44 -0800 Subject: Support non-interactive user password update Currently user password update require interactive prompting of user's original password. This is problematic because we can't support non-interactive applications and therefore hinders automation. This patch make it possible by optionally accepting an '--original-password' argument. If specified, we would use it instead of prompting. DocImpact Change-Id: I2d994e8c2be949f7ae616ac1d1594fb94e1a27cd Closes-Bug: 1531360 --- openstackclient/tests/identity/v3/test_user.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'openstackclient/tests') diff --git a/openstackclient/tests/identity/v3/test_user.py b/openstackclient/tests/identity/v3/test_user.py index 76d5f834..41fab60e 100644 --- a/openstackclient/tests/identity/v3/test_user.py +++ b/openstackclient/tests/identity/v3/test_user.py @@ -1095,6 +1095,25 @@ class TestUserSetPassword(TestUser): current_pass, new_pass ) + def test_user_password_change_no_prompt(self): + current_pass = 'old_pass' + new_pass = 'new_pass' + arglist = [ + '--password', new_pass, + '--original-password', current_pass, + ] + verifylist = [ + ('password', new_pass), + ('original_password', current_pass), + ] + parsed_args = self.check_parser(self.cmd, arglist, verifylist) + + self.cmd.take_action(parsed_args) + + self.users_mock.update_password.assert_called_with( + current_pass, new_pass + ) + class TestUserShow(TestUser): -- cgit v1.2.1