Пример #1
0
    def test_change_password(self, mapiclient, settings_mock, print_mock):
        user_action = UserAction()
        params = mock.Mock()
        params.newpass = None
        password = '******'
        conf_file = '/tmp/fuel_client.yaml'
        settings_mock.get_settings.return_value = mock.Mock(
            user_settings=conf_file)

        with mock.patch('fuelclient.cli.actions.user.getpass',
                        return_value=password) as mgetpass:
            user_action.change_password(params)

        calls = [
            mock.call("Changing password for Fuel User.\nNew Password:"******"Retype new Password:"******"\nPassword changed.\nPlease note that configuration " \
            "is not automatically updated.\nYou may want to update " \
            "{0}.".format(conf_file)

        self.assert_print(print_mock, None, msg)
    def test_get_password_from_prompt(self):
        user_action = UserAction()
        passwd = 'secret!'
        with mock.patch('fuelclient.cli.actions.user.getpass',
                        return_value=passwd):
            user_passwd = user_action._get_password_from_prompt()

        self.assertEqual(passwd, user_passwd)
Пример #3
0
    def test_get_password_from_prompt(self):
        user_action = UserAction()
        passwd = 'secret!'
        with mock.patch('fuelclient.cli.actions.user.getpass',
                        return_value=passwd):
            user_passwd = user_action._get_password_from_prompt()

        self.assertEqual(passwd, user_passwd)
    def test_change_password(self, mapiclient):
        user_action = UserAction()
        params = mock.Mock()
        params.newpass = None
        password = '******'

        with mock.patch('fuelclient.cli.actions.user.getpass',
                        return_value=password) as mgetpass:
            user_action.change_password(params)

        calls = [
            mock.call("Changing password for Fuel User.\nNew Password:"******"Retype new Password:"),
        ]

        mgetpass.assert_has_calls(calls)
        mapiclient.update_own_password.assert_called_once_with(password)
Пример #5
0
    def test_change_password(self, mapiclient):
        user_action = UserAction()
        params = mock.Mock()
        params.newpass = None
        password = '******'

        with mock.patch('fuelclient.cli.actions.user.getpass',
                        return_value=password) as mgetpass:
            user_action.change_password(params)

        calls = [
            mock.call("Changing password for Fuel User.\nNew Password:"******"Retype new Password:"),
        ]

        mgetpass.assert_has_calls(calls)
        mapiclient.update_own_password.assert_called_once_with(password)
 def test_change_password_w_newpass(self, mapiclient):
     user_action = UserAction()
     params = mock.Mock()
     params.newpass = '******'
     user_action.change_password(params)
     mapiclient.update_own_password.assert_called_once_with(params.newpass)
 def test_get_password_from_prompt_different_passwords(self, mgetpass):
     user_action = UserAction()
     with self.assertRaisesRegexp(
             ArgumentException, 'Passwords are not the same'):
         user_action._get_password_from_prompt()
Пример #8
0
 def test_change_password_w_newpass(self, mapiclient):
     user_action = UserAction()
     params = mock.Mock()
     params.newpass = '******'
     user_action.change_password(params)
     mapiclient.update_own_password.assert_called_once_with(params.newpass)
Пример #9
0
 def test_get_password_from_prompt_different_passwords(self, mgetpass):
     user_action = UserAction()
     with self.assertRaisesRegexp(ArgumentException,
                                  'Passwords are not the same'):
         user_action._get_password_from_prompt()