def invokeCli(argv, username='', password='', useApiUrl=False):
    """
    Invoke the Girder Python client CLI with a set of arguments.
    """
    if useApiUrl:
        apiUrl = os.environ['GIRDER_PORT'] % 'http://localhost:%s/api/v1'
        argsList = ['girder-client', '--api-url', apiUrl, '--username',
                    username, '--password', password] + list(argv)
    else:
        argsList = ['girder-client', '--port', os.environ['GIRDER_PORT'],
                    '--username', username, '--password', password] + list(argv)
    exitVal = 0
    with mock.patch.object(sys, 'argv', argsList),\
            mock.patch('sys.exit', side_effect=SysExitException) as exit,\
            captureOutput() as output:
        try:
            girder_client.cli.main()
        except SysExitException:
            args = exit.mock_calls[0][1]
            exitVal = args[0] if len(args) else 0
    return {
        'exitVal': exitVal,
        'stdout': output[0],
        'stderr': output[1]
    }
dataset/ETHPy150Open girder/girder/tests/cases/py_client/cli_test.py/invokeCli/swapped operands of `%`