fix tests
This commit is contained in:
parent
f873934473
commit
04f6ba886e
28 changed files with 404 additions and 458 deletions
|
|
@ -184,17 +184,13 @@ class CliTestCase(unittest.TestCase):
|
|||
with session_patch as session:
|
||||
with stdout_patch as stdout:
|
||||
with stderr_patch as stderr:
|
||||
with self.assertRaises(SystemExit) as cm:
|
||||
with self.assertRaises(SystemExit) as ex:
|
||||
callableObj(*test_args, **test_kwargs)
|
||||
self.assertExitCode(ex, exit_code)
|
||||
session.assert_called_once()
|
||||
self.assert_console_message(stdout, **message['stdout'])
|
||||
self.assert_console_message(stderr, **message['stderr'])
|
||||
assert_function()
|
||||
if isinstance(cm.exception, int):
|
||||
# python 2.6.6
|
||||
self.assertEqual(cm.exception, exit_code)
|
||||
else:
|
||||
self.assertEqual(cm.exception.code, exit_code)
|
||||
|
||||
@mock.patch('koji_cli.commands.activate_session')
|
||||
def assert_help(self, callableObj, message, activate_session_mock):
|
||||
|
|
@ -212,6 +208,12 @@ class CliTestCase(unittest.TestCase):
|
|||
exit_code=0)
|
||||
activate_session_mock.assert_not_called()
|
||||
|
||||
def assertExitCode(self, ex, code):
|
||||
if isinstance(ex.exception, int):
|
||||
self.assertEqual(ex.exception, code)
|
||||
else:
|
||||
self.assertEqual(ex.exception.code, code)
|
||||
|
||||
|
||||
def get_builtin_open():
|
||||
if six.PY2:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue