Пример #1
0
 def test_version_newer_avail(self):
     with GetStorage(get_connection_api()) as storage:
         package_downloader = APKWizard(storage.db_wrapper,
                                        storage.storage_manager)
         gplay_latest = (20201001, "0.123.4")
         latest_supported = {
             APKArch.arm64_v8a: {
                 "versionCode": 20201001,
                 "version": "0.123.4"
             }
         }
         autosearch_latest = {"version": "0.123.4", "url": 20201001}
         package_downloader.get_latest_version = MagicMock(
             return_value=latest_supported)
         storage.storage_manager.get_current_version = MagicMock(
             return_value="0.123.3")
         package_downloader.get_latest = MagicMock(
             return_value=autosearch_latest)
         GPlayConnector.get_latest_version = MagicMock(
             return_value=gplay_latest)
         wizard_latest = package_downloader.find_latest_pogo(
             APKArch.arm64_v8a)
         self.assertTrue(wizard_latest is not None)
         self.assertTrue(latest_supported[APKArch.arm64_v8a]["versionCode"]
                         == wizard_latest["version_code"])
         self.assertTrue(latest_supported[APKArch.arm64_v8a]["version"] ==
                         wizard_latest["version"])
Пример #2
0
 def test_valid_version_from_gplay(self, get_apk_info):
     latest_gplay = {"version_code": 20200901, "version": "0.123.4"}
     autosearch_latest = {"version": "0.123.4", "url": 20201001}
     get_apk_info_resp = ("0.123.4", "com.ignored")
     get_apk_info.return_value = get_apk_info_resp
     with GetStorage(get_connection_api()) as storage:
         package_downloader = APKWizard(storage.db_wrapper,
                                        storage.storage_manager)
         package_downloader.find_latest_pogo = MagicMock(
             return_value=latest_gplay)
         storage.storage_manager.get_current_version = MagicMock(
             return_value="0.123.3")
         package_downloader.get_latest = MagicMock(
             return_value=autosearch_latest)
         GPlayConnector.download = MagicMock(
             return_value=TEST_GPLAY_RESPONSE)
         package_downloader.download_pogo(APKArch.arm64_v8a)
Пример #3
0
 def test_invalid_version_from_gplay(self, get_apk_info, supported_pogo_version):
     supported_pogo_version.return_value = True
     get_apk_info.return_value = ("0.123.3", "com.ignored")
     latest_gplay = {
         "version_code": 20200901,
         "version": "0.123.4"
     }
     autosearch_latest = {
         "version": "0.123.4",
         "url": 20201001
     }
     with GetStorage(get_connection_api()) as storage:
         package_downloader = APKWizard(storage.db_wrapper, storage.storage_manager)
         package_downloader.find_latest_pogo = MagicMock(return_value=latest_gplay)
         storage.storage_manager.get_current_version = MagicMock(return_value=None)
         package_downloader.get_latest = MagicMock(return_value=autosearch_latest)
         GPlayConnector.download = MagicMock(return_value=TEST_GPLAY_RESPONSE)
         with self.assertRaises(InvalidDownload):
             package_downloader.download_pogo(APKArch.arm64_v8a)
Пример #4
0
 def test_version_supported_but_not_gplay(self):
     with GetStorage(get_connection_api()) as storage:
         wizard = APKWizard(storage.db_wrapper, storage.storage_manager)
         gplay_latest = (20200901, "0.123.3")
         latest_supported = {
             APKArch.arm64_v8a: {
                 "versionCode": 20201001,
                 "version": "0.123.4"
             }
         }
         autosearch_latest = {"version": "0.123.4", "url": 20201001}
         wizard.get_latest_version = MagicMock(
             return_value=latest_supported)
         storage.storage_manager.get_current_version = MagicMock(
             return_value="0.123.3")
         wizard.get_latest = MagicMock(return_value=autosearch_latest)
         GPlayConnector.get_latest_version = MagicMock(
             return_value=gplay_latest)
         wizard_latest = wizard.find_latest_pogo(APKArch.arm64_v8a)
         self.assertTrue(wizard_latest is None)
Пример #5
0
 def test_gplay_between_current_and_supported(self, supported_pogo_version):
     supported_pogo_version.return_value = True
     with GetStorage(get_connection_api()) as storage:
         package_downloader = APKWizard(storage.db_wrapper, storage.storage_manager)
         gplay_latest = (20200901, "0.123.3")
         latest_supported = {
             APKArch.arm64_v8a: {
                 "versionCode": 20201001,
                 "version": "0.123.4"
             }
         }
         autosearch_latest = {
             "version": "0.123.4",
             "url": 20201001
         }
         package_downloader.get_latest_version = MagicMock(return_value=latest_supported)
         package_downloader.get_version_code = MagicMock(return_value=20200801)
         storage.storage_manager.get_current_version = MagicMock(return_value="0.123.2")
         package_downloader.get_latest = MagicMock(return_value=autosearch_latest)
         GPlayConnector.get_latest_version = MagicMock(return_value=gplay_latest)
         wizard_latest = package_downloader.find_latest_pogo(APKArch.arm64_v8a)
         self.assertTrue(wizard_latest is not None)
         self.assertTrue(gplay_latest[0] == wizard_latest["version_code"])
         self.assertTrue(gplay_latest[1] == wizard_latest["version"])