def mock_sdk(tmp_path): command = MagicMock() command.home_path = tmp_path command.host_platform = 'unknown' sdk = AndroidSDK(command, root_path=tmp_path) # Mock some existing emulators sdk.emulators = MagicMock(return_value=[ 'runningEmulator', 'idleEmulator', ]) return sdk
def mock_sdk(tmp_path): command = MagicMock() command.home_path = tmp_path # For default test purposes, assume we're on macOS x86_64 command.host_os = "Darwin" command.host_arch = "x86_64" sdk = AndroidSDK(command, jdk=MagicMock(), root_path=tmp_path) # Mock some existing emulators sdk.emulators = MagicMock(return_value=[ "runningEmulator", "idleEmulator", ]) return sdk
def mock_sdk(tmp_path): command = MagicMock() command.logger = Log() command.input = DummyConsole() sdk = AndroidSDK(command, jdk=MagicMock(), root_path=tmp_path) sdk.devices = MagicMock( return_value={ "041234567892009a": { "name": "Unknown device (not authorized for development)", "authorized": False, }, "KABCDABCDA1513": { "name": "Kogan Agora 9", "authorized": True, }, "emulator-5554": { "name": "Android SDK built for x86", "authorized": True, }, }) sdk.emulators = MagicMock(return_value=[ "runningEmulator", "idleEmulator", ]) # Set up an ADB for each device. def mock_adb(device_id): adb = MagicMock() if device_id == "emulator-5554": adb.avd_name.return_value = "runningEmulator" else: adb.avd_name.return_value = None return adb sdk.adb = mock_adb return sdk
def mock_sdk(tmp_path): command = MagicMock() command.host_platform = 'unknown' sdk = AndroidSDK(command, root_path=tmp_path) sdk.sleep = MagicMock() sdk.mock_run = MagicMock() def mock_adb(device): adb = ADB(sdk, device) adb.run = sdk.mock_run return adb sdk.adb = mock_adb # Mock some existing emulators sdk.emulators = MagicMock(return_value=[ 'runningEmulator', 'idleEmulator', ]) return sdk
def mock_sdk(tmp_path): command = MagicMock() command.input = DummyConsole() sdk = AndroidSDK(command, root_path=tmp_path) sdk.devices = MagicMock( return_value={ '041234567892009a': { 'name': 'Unknown device (not authorized for development)', 'authorized': False, }, 'KABCDABCDA1513': { 'name': 'Kogan_Agora_9', 'authorized': True, }, 'emulator-5554': { 'name': 'generic_x86', 'authorized': True, }, }) sdk.emulators = MagicMock(return_value=[ 'runningEmulator', 'idleEmulator', ]) # Set up an ADB for each device. def mock_adb(device_id): adb = MagicMock() if device_id == 'emulator-5554': adb.avd_name.return_value = 'runningEmulator' else: adb.avd_name.return_value = None return adb sdk.adb = mock_adb return sdk