summaryrefslogtreecommitdiff
path: root/cinderclient/tests/unit/test_shell.py
diff options
context:
space:
mode:
authorCory Stone <corystone@gmail.com>2016-01-27 15:09:45 -0600
committerCory Stone <corystone@gmail.com>2016-01-27 15:11:41 -0600
commitb670b73e446f9c707392ace6b802dcfdedecf71a (patch)
treebda4d9d8006813516ae0637a1f0b32aadd33e495 /cinderclient/tests/unit/test_shell.py
parentfaf88081626d57c3fdbfef2d2f366f25d10fc4ee (diff)
downloadpython-cinderclient-b670b73e446f9c707392ace6b802dcfdedecf71a.tar.gz
Pass insecure option to HTTPClient
This option was silently being ignored. Closes-Bug: #1538648 Change-Id: I3a1b5268e87cbc9803924be95b374d76b72a3a5d
Diffstat (limited to 'cinderclient/tests/unit/test_shell.py')
-rw-r--r--cinderclient/tests/unit/test_shell.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/cinderclient/tests/unit/test_shell.py b/cinderclient/tests/unit/test_shell.py
index af6d1fa..a2439f2 100644
--- a/cinderclient/tests/unit/test_shell.py
+++ b/cinderclient/tests/unit/test_shell.py
@@ -23,6 +23,7 @@ import requests
from six import moves
from testtools import matchers
+import cinderclient
from cinderclient import exceptions
from cinderclient import auth_plugin
from cinderclient import shell
@@ -198,6 +199,21 @@ class ShellTest(utils.TestCase):
allow_redirects=True,
**self.TEST_REQUEST_BASE)
+ @mock.patch.object(cinderclient.client.HTTPClient, 'authenticate',
+ side_effect=exceptions.Unauthorized('No'))
+ # Easiest way to make cinderclient use httpclient is a None session
+ @mock.patch.object(cinderclient.shell.OpenStackCinderShell,
+ '_get_keystone_session', return_value=None)
+ def test_http_client_insecure(self, mock_authenticate, mock_session):
+ self.make_env(include={'CINDERCLIENT_INSECURE': True})
+
+ _shell = shell.OpenStackCinderShell()
+
+ # This "fails" but instantiates the client.
+ self.assertRaises(exceptions.CommandError, _shell.main, ['list'])
+
+ self.assertEqual(False, _shell.cs.client.verify_cert)
+
class CinderClientArgumentParserTest(utils.TestCase):