summaryrefslogtreecommitdiff
path: root/cinderclient/tests/unit
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-07-15 20:58:36 +0000
committerGerrit Code Review <review@openstack.org>2016-07-15 20:58:36 +0000
commitb36ff1fc15cb27096f0fcee3263f28b1a086ab69 (patch)
treed3f8d2f0f7e004b205c54eb376718d99ad8bca33 /cinderclient/tests/unit
parentd96cc9fc08caa51a2f7bdab47d0546fdbc00f495 (diff)
parent24deab10906670a50129d7cb4974a8dff6aca687 (diff)
downloadpython-cinderclient-b36ff1fc15cb27096f0fcee3263f28b1a086ab69.tar.gz
Merge "Fix authentication issue"
Diffstat (limited to 'cinderclient/tests/unit')
-rw-r--r--cinderclient/tests/unit/test_shell.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/cinderclient/tests/unit/test_shell.py b/cinderclient/tests/unit/test_shell.py
index 377bec2..f5566c0 100644
--- a/cinderclient/tests/unit/test_shell.py
+++ b/cinderclient/tests/unit/test_shell.py
@@ -142,6 +142,7 @@ class ShellTest(utils.TestCase):
for count in range(1, 4):
self.list_volumes_on_service(count)
+ @mock.patch('keystoneclient.auth.identity.v2.Password')
@mock.patch('keystoneclient.adapter.Adapter.get_token',
side_effect=ks_exc.ConnectionRefused())
@mock.patch('keystoneclient.discover.Discover',
@@ -149,11 +150,19 @@ class ShellTest(utils.TestCase):
@mock.patch('sys.stdin', side_effect=mock.MagicMock)
@mock.patch('getpass.getpass', return_value='password')
def test_password_prompted(self, mock_getpass, mock_stdin, mock_discover,
- mock_token):
+ mock_token, mock_password):
self.make_env(exclude='OS_PASSWORD')
_shell = shell.OpenStackCinderShell()
self.assertRaises(ks_exc.ConnectionRefused, _shell.main, ['list'])
mock_getpass.assert_called_with('OS Password: ')
+ # Verify that Password() is called with value of param 'password'
+ # equal to mock_getpass.return_value.
+ mock_password.assert_called_with(
+ self.FAKE_ENV['OS_AUTH_URL'],
+ password=mock_getpass.return_value,
+ tenant_id='',
+ tenant_name=self.FAKE_ENV['OS_TENANT_NAME'],
+ username=self.FAKE_ENV['OS_USERNAME'])
@mock.patch.object(requests, "request")
@mock.patch.object(pkg_resources, "iter_entry_points")