mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 14:30:30 +03:00
install: download from GitHub Releases
This commit is contained in:
parent
1eb6516f16
commit
560472e4e5
3 changed files with 49 additions and 7 deletions
|
|
@ -177,56 +177,65 @@ class InstallTest(unittest.TestCase):
|
|||
|
||||
@patch('fdroidserver.install.download_apk')
|
||||
@patch('fdroidserver.install.download_fdroid_apk')
|
||||
@patch('fdroidserver.install.download_fdroid_apk_from_github')
|
||||
@patch('fdroidserver.install.download_fdroid_apk_from_ipns')
|
||||
@patch('fdroidserver.install.download_fdroid_apk_from_maven')
|
||||
def test_install_fdroid_apk_privacy_mode_true(
|
||||
self, maven, ipns, download_fdroid_apk, download_apk
|
||||
self, maven, ipns, github, download_fdroid_apk, download_apk
|
||||
):
|
||||
download_apk.side_effect = self._download_raise
|
||||
download_fdroid_apk.side_effect = self._download_raise
|
||||
github.side_effect = self._download_raise
|
||||
ipns.side_effect = self._download_raise
|
||||
maven.side_effect = self._download_raise
|
||||
fdroidserver.common.config = {'jarsigner': 'fakepath'}
|
||||
install.install_fdroid_apk(privacy_mode=True)
|
||||
download_apk.assert_not_called()
|
||||
download_fdroid_apk.assert_not_called()
|
||||
github.assert_called_once()
|
||||
ipns.assert_called_once()
|
||||
maven.assert_called_once()
|
||||
|
||||
@patch('fdroidserver.install.download_apk')
|
||||
@patch('fdroidserver.install.download_fdroid_apk')
|
||||
@patch('fdroidserver.install.download_fdroid_apk_from_github')
|
||||
@patch('fdroidserver.install.download_fdroid_apk_from_ipns')
|
||||
@patch('fdroidserver.install.download_fdroid_apk_from_maven')
|
||||
def test_install_fdroid_apk_privacy_mode_false(
|
||||
self, maven, ipns, download_fdroid_apk, download_apk
|
||||
self, maven, ipns, github, download_fdroid_apk, download_apk
|
||||
):
|
||||
download_apk.side_effect = self._download_raise
|
||||
download_fdroid_apk.side_effect = self._download_raise
|
||||
github.side_effect = self._download_raise
|
||||
ipns.side_effect = self._download_raise
|
||||
maven.side_effect = self._download_raise
|
||||
fdroidserver.common.config = {'jarsigner': 'fakepath'}
|
||||
install.install_fdroid_apk(privacy_mode=False)
|
||||
download_apk.assert_called_once()
|
||||
download_fdroid_apk.assert_called_once()
|
||||
github.assert_called_once()
|
||||
ipns.assert_called_once()
|
||||
maven.assert_called_once()
|
||||
|
||||
@patch('fdroidserver.install.download_apk')
|
||||
@patch('fdroidserver.install.download_fdroid_apk')
|
||||
@patch('fdroidserver.install.download_fdroid_apk_from_github')
|
||||
@patch('fdroidserver.install.download_fdroid_apk_from_ipns')
|
||||
@patch('fdroidserver.install.download_fdroid_apk_from_maven')
|
||||
@patch('locale.getlocale', lambda: ('zh_CN', 'UTF-8'))
|
||||
def test_install_fdroid_apk_privacy_mode_locale_auto(
|
||||
self, maven, ipns, download_fdroid_apk, download_apk
|
||||
self, maven, ipns, github, download_fdroid_apk, download_apk
|
||||
):
|
||||
download_apk.side_effect = self._download_raise
|
||||
download_fdroid_apk.side_effect = self._download_raise
|
||||
github.side_effect = self._download_raise
|
||||
ipns.side_effect = self._download_raise
|
||||
maven.side_effect = self._download_raise
|
||||
fdroidserver.common.config = {'jarsigner': 'fakepath'}
|
||||
install.install_fdroid_apk(privacy_mode=None)
|
||||
download_apk.assert_not_called()
|
||||
download_fdroid_apk.assert_not_called()
|
||||
github.assert_called_once()
|
||||
ipns.assert_called_once()
|
||||
maven.assert_called_once()
|
||||
|
||||
|
|
@ -249,6 +258,11 @@ class InstallTest(unittest.TestCase):
|
|||
f = install.download_fdroid_apk_from_ipns()
|
||||
self.assertTrue(Path(f).exists())
|
||||
|
||||
@unittest.skipUnless(os.getenv('test_download_fdroid_apk'), 'requires net access')
|
||||
def test_download_fdroid_apk_from_github(self):
|
||||
f = install.download_fdroid_apk_from_github()
|
||||
self.assertTrue(Path(f).exists())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.chdir(os.path.dirname(__file__))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue