def test_bist_command_help_prints_help(self): for arg in ('-h', '--help'): stream = six.StringIO() with mock.patch('sys.stdout', new=stream): args = ('bist', arg) cli.main(args=args) self.assertTrue(stream.getvalue().startswith('usage: '))
def test_cli_exits_with_error_code(self, parse_args_mock, exit_mock): def exit_with_exit_code(args): return args.exit_code parse_args_mock.return_value = mock.Mock( verbose=0, func=exit_with_exit_code, exit_code=42, ) cli.main() exit_mock.assert_called_with(42)
def main(): logg.Logger() cli.main()
def test_bist_command_calls_run_bist_with_args(self, mock_run_bist): cli.main(args=['bist']) args, kwargs = mock_run_bist.call_args self.assertIsInstance(args[0], argparse.Namespace)