Add test for --debug taking precedence over --info
Change-Id: Ibf0903817852edb36389028383a35e0d65f88a26
This commit is contained in:
parent
109e8f519f
commit
28558c7e0a
@ -1042,7 +1042,7 @@ class TestSubcommandHelp(testtools.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
@mock.patch.dict(os.environ, mocked_os_environ)
|
@mock.patch.dict(os.environ, mocked_os_environ)
|
||||||
class TestOptionAfterPosArg(testtools.TestCase):
|
class TestDebugAndInfoOptions(testtools.TestCase):
|
||||||
@mock.patch('logging.basicConfig')
|
@mock.patch('logging.basicConfig')
|
||||||
@mock.patch('swiftclient.service.Connection')
|
@mock.patch('swiftclient.service.Connection')
|
||||||
def test_option_after_posarg(self, connection, mock_logging):
|
def test_option_after_posarg(self, connection, mock_logging):
|
||||||
@ -1054,6 +1054,24 @@ class TestOptionAfterPosArg(testtools.TestCase):
|
|||||||
swiftclient.shell.main(argv)
|
swiftclient.shell.main(argv)
|
||||||
mock_logging.assert_called_with(level=logging.DEBUG)
|
mock_logging.assert_called_with(level=logging.DEBUG)
|
||||||
|
|
||||||
|
@mock.patch('logging.basicConfig')
|
||||||
|
@mock.patch('swiftclient.service.Connection')
|
||||||
|
def test_debug_trumps_info(self, connection, mock_logging):
|
||||||
|
argv_scenarios = (["", "stat", "--info", "--debug"],
|
||||||
|
["", "stat", "--debug", "--info"],
|
||||||
|
["", "--info", "stat", "--debug"],
|
||||||
|
["", "--debug", "stat", "--info"],
|
||||||
|
["", "--info", "--debug", "stat"],
|
||||||
|
["", "--debug", "--info", "stat"])
|
||||||
|
for argv in argv_scenarios:
|
||||||
|
mock_logging.reset_mock()
|
||||||
|
swiftclient.shell.main(argv)
|
||||||
|
try:
|
||||||
|
mock_logging.assert_called_once_with(level=logging.DEBUG)
|
||||||
|
except AssertionError:
|
||||||
|
self.fail('Unexpected call(s) %r for args %r'
|
||||||
|
% (mock_logging.call_args_list, argv))
|
||||||
|
|
||||||
|
|
||||||
class TestBase(testtools.TestCase):
|
class TestBase(testtools.TestCase):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user