summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick J. Wippler <thrawn01@gmail.com>2015-08-19 11:36:33 -0500
committerDerrick J. Wippler <thrawn01@gmail.com>2015-08-27 09:39:58 -0500
commit50758ba475e7a8d7783d511b9b161899c41641b5 (patch)
tree0358c3db6bded1b44c86af5b90bb690d498f7189
parent1d71a6d138b8b45eef8c14ffa954077e2dfd8584 (diff)
downloadpython-cinderclient-50758ba475e7a8d7783d511b9b161899c41641b5.tar.gz
Fixed test_password_prompted
test_password_prompted no longer makes DNS lookups on the network. Change-Id: If310f52e829b09b01c76d02deae4aec74f00870d Closes-Bug: 1486647
-rw-r--r--cinderclient/tests/unit/test_shell.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/cinderclient/tests/unit/test_shell.py b/cinderclient/tests/unit/test_shell.py
index 62a68c1..3407a26 100644
--- a/cinderclient/tests/unit/test_shell.py
+++ b/cinderclient/tests/unit/test_shell.py
@@ -122,13 +122,17 @@ class ShellTest(utils.TestCase):
self.assertEqual(v3_url, os_auth_url, "Expected v3 url")
self.assertIsNone(v2_url, "Expected no v2 url")
+ @mock.patch('keystoneclient.adapter.Adapter.get_token',
+ side_effect=ks_exc.ConnectionRefused())
+ @mock.patch('keystoneclient.discover.Discover',
+ side_effect=ks_exc.ConnectionRefused())
@mock.patch('sys.stdin', side_effect=mock.MagicMock)
@mock.patch('getpass.getpass', return_value='password')
- def test_password_prompted(self, mock_getpass, mock_stdin):
+ def test_password_prompted(self, mock_getpass, mock_stdin, mock_discover,
+ mock_token):
self.make_env(exclude='OS_PASSWORD')
- # We should get a Connection Refused because there is no keystone.
- self.assertRaises(ks_exc.ConnectionRefused, self.shell, 'list')
- # Make sure we are actually prompted.
+ _shell = shell.OpenStackCinderShell()
+ self.assertRaises(ks_exc.ConnectionRefused, _shell.main, ['list'])
mock_getpass.assert_called_with('OS Password: ')
@mock.patch.object(requests, "request")