Actually test interactive password prompt

* keystoneclient/tests/v2_0/test_shell.py
(ShellTests.test_user_create_password_prompt): Remove the password
from the calling environment and fake out the check for an
interactive terminal session so that the code which implements
password prompting will actually be exercised.

Change-Id: I46f45553995316c7d006a83897413d57e127e48c
This commit is contained in:
Jeremy Stanley
2014-10-15 21:28:39 +00:00
parent 8b267842a7
commit e9d0fc3cd5

View File

@@ -104,6 +104,8 @@ class ShellTests(utils.TestCase):
self.stub_url('POST', ['users'], json={'user': {}}) self.stub_url('POST', ['users'], json={'user': {}})
with mock.patch('getpass.getpass') as mock_getpass: with mock.patch('getpass.getpass') as mock_getpass:
del(os.environ['OS_PASSWORD'])
mock_stdin.isatty = lambda: True
mock_getpass.return_value = 'newpass' mock_getpass.return_value = 'newpass'
self.run_command('user-create --name new-user --pass') self.run_command('user-create --name new-user --pass')