Esempio n. 1
0
def ADB(mocker):
    mocker.patch('andriller.adb_conn.ADBConn.kill')
    with mock.patch('andriller.adb_conn.ADBConn.cmd_shell',
                    return_value=fake_adb.name):
        adb = adb_conn.ADBConn()
    adb_cmd = adb.adb.__func__
    setattr(adb, 'adb', lambda *args, **kwargs: adb_cmd(adb, *args, **kwargs))
    return adb
Esempio n. 2
0
def ADB_alt(mocker):
    mocker.patch('andriller.adb_conn.ADBConn.kill')
    mocker.patch('andriller.adb_conn.ADBConn._opt_use_capture', return_value=False)
    with mock.patch('andriller.adb_conn.ADBConn._get_adb_bin', return_value=fake_adb.name):
        with mock.patch('andriller.adb_conn.ADBConn._adb_has_exec', return_value=False):
            adb = adb_conn.ADBConn()
    adb_cmd = adb.adb.__func__
    setattr(adb, 'adb', lambda *args, **kwargs: adb_cmd(adb, *args, **kwargs))
    return adb
Esempio n. 3
0
def ADB_win(mocker):
    mock_sub = mocker.patch('andriller.adb_conn.subprocess', autospec=True)
    mock_sub.STARTUPINFO = mock.MagicMock()
    mock_sub.STARTF_USESHOWWINDOW = mock.MagicMock()
    mocker.patch('andriller.adb_conn.ADBConn.kill')
    mocker.patch('andriller.adb_conn.ADBConn._opt_use_capture', return_value=True)
    with mock.patch('sys.platform', return_value='win32'):
        with mock.patch('andriller.adb_conn.ADBConn._get_adb_bin', return_value=fake_adb.name):
            with mock.patch('andriller.adb_conn.ADBConn._adb_has_exec', return_value=True):
                adb = adb_conn.ADBConn()
    return adb
Esempio n. 4
0
def ADB_win(mocker):
    mocker.patch('andriller.adb_conn.ADBConn.kill')
    with mock.patch('sys.platform', return_value='win32'):
        adb = adb_conn.ADBConn()
    return adb
Esempio n. 5
0
def ADB_win():
    with mock.patch('sys.platform', return_value='win32'):
        adb = adb_conn.ADBConn()
    return adb
Esempio n. 6
0
def ADB():
    with mock.patch('andriller.adb_conn.ADBConn.cmd_shell', return_value=fake_adb.name):
        adb = adb_conn.ADBConn()
    return adb