summaryrefslogtreecommitdiff
path: root/tests/unit/test_shell.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/test_shell.py')
-rw-r--r--tests/unit/test_shell.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/unit/test_shell.py b/tests/unit/test_shell.py
index cac4da2..4dec22c 100644
--- a/tests/unit/test_shell.py
+++ b/tests/unit/test_shell.py
@@ -16,6 +16,7 @@ from __future__ import unicode_literals
from genericpath import getmtime
import hashlib
+import logging
import mock
import os
import tempfile
@@ -1040,6 +1041,20 @@ class TestSubcommandHelp(testtools.TestCase):
self.assertEqual(out.strip('\n'), expected)
+@mock.patch.dict(os.environ, mocked_os_environ)
+class TestOptionAfterPosArg(testtools.TestCase):
+ @mock.patch('logging.basicConfig')
+ @mock.patch('swiftclient.service.Connection')
+ def test_option_after_posarg(self, connection, mock_logging):
+ argv = ["", "stat", "--info"]
+ swiftclient.shell.main(argv)
+ mock_logging.assert_called_with(level=logging.INFO)
+
+ argv = ["", "stat", "--debug"]
+ swiftclient.shell.main(argv)
+ mock_logging.assert_called_with(level=logging.DEBUG)
+
+
class TestBase(testtools.TestCase):
"""
Provide some common methods to subclasses