diff --git a/fuelclient/cli/actions/user.py b/fuelclient/cli/actions/user.py index 3b8ee9a..0e9bc7d 100644 --- a/fuelclient/cli/actions/user.py +++ b/fuelclient/cli/actions/user.py @@ -14,6 +14,7 @@ from fuelclient.cli.actions.base import Action import fuelclient.cli.arguments as Args +from fuelclient.cli.error import ArgumentException from fuelclient.client import APIClient @@ -37,4 +38,8 @@ class UserAction(Action): """To change user password: fuel user change-password """ - APIClient.update_own_password(params.newpass) + if params.newpass: + APIClient.update_own_password(params.newpass) + else: + raise ArgumentException( + "Expect password [--newpass NEWPASS]") diff --git a/tests/test_client.py b/tests/test_client.py index 305acfd..26dd7ff 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -128,6 +128,15 @@ class TestHandlers(BaseTestCase): ) +class TestUserActions(BaseTestCase): + + def test_change_password_params(self): + cmd = "user --change-password" + msg = "Expect password [--newpass NEWPASS]" + result = self.run_cli_command(cmd, check_errors=True) + self.assertTrue(msg, result) + + class TestCharset(BaseTestCase): def test_charset_problem(self):