def test_install_multiple_no_apks_in_xapk_file(self, zipfile, tmpdir): xapk_file = tmpdir.mkdir("xapk").join("test_apk.xapk") xapk_file.write("This is an xapk file") device_id = 123 mock_adb = Mock() mock_adb._ADB__output = 'succes' Adb.adb = mock_adb with pytest.raises(ConfigError): Adb.install(device_id, xapk_file)
def test_install_not_all_permissions(self): mock_adb = Mock() mock_adb._ADB__output = 'succes' Adb.adb = mock_adb device_id = 123 apk = 'test_apk.apk' result = Adb.install(device_id, apk, all_permissions=False) assert result == 'succes' expected_calls = [ call.set_target_by_name(device_id), call.run_cmd('install -r {}'.format(apk)) ] assert mock_adb.mock_calls == expected_calls
def test_install_multiple_default(self, listdir, getcwd): mock_adb = Mock() mock_adb._ADB__output = 'succes' Adb.adb = mock_adb device_id = 123 apk = 'test_apk.xapk' getcwd.return_value = '.' listdir.return_value = [apk] result = Adb.install(device_id, apk) assert result == 'succes' expected_calls = [ call.set_target_by_name(device_id), call.run_cmd('install-multiple -r -g {}'.format(apk)) ] assert mock_adb.mock_calls == expected_calls
def test_install_multiple_default(self, zipfile, tmpdir): xapk_file = tmpdir.mkdir("xapk").join("test_apk.xapk") apk_file = tmpdir.mkdir("xapk/test_apk/").join("test_apk.apk") xapk_file.write("This is an xapk file") apk_file.write("This is an apk file") device_id = 123 mock_adb = Mock() mock_adb._ADB__output = 'succes' Adb.adb = mock_adb result = Adb.install(device_id, xapk_file) assert result == 'succes' expected_calls = [ call.set_target_by_name(device_id), call.run_cmd('install-multiple -r -g {}'.format(apk_file)) ] assert mock_adb.mock_calls == expected_calls