From 58b6d74de5ced743ff2672430da121323d7e65f2 Mon Sep 17 00:00:00 2001 From: Paul McLanahan Date: Wed, 22 May 2019 12:22:41 -0400 Subject: [PATCH] Fix bug 1553396: Update Fennec Nightly direct download links to bouncer --- bedrock/firefox/firefox_details.py | 16 +------- bedrock/firefox/tests/test_firefox_details.py | 40 +++++-------------- 2 files changed, 12 insertions(+), 44 deletions(-) diff --git a/bedrock/firefox/firefox_details.py b/bedrock/firefox/firefox_details.py index c348375af2a..b3f4127551d 100644 --- a/bedrock/firefox/firefox_details.py +++ b/bedrock/firefox/firefox_details.py @@ -329,6 +329,7 @@ class FirefoxAndroid(_ProductDetails): # Product names defined in bouncer product_map = { + 'nightly': 'fennec-nightly-latest', 'beta': 'fennec-beta-latest', 'release': 'fennec-latest', } @@ -465,20 +466,7 @@ def get_download_url(self, channel='release', arch='arm', locale='multi', :return: string url """ if force_direct: - # Use a direct archive link for Nightly - if channel == 'nightly': - if arch == 'x86': - api_version = 'x86' - elif self.latest_major_version(channel) < 56: - api_version = 'api-15' - else: - api_version = 'api-16' - - return self.archive_urls[arch] % (self.archive_repo[channel], - api_version, - self.latest_version(channel)) - - # Use a bouncer link for Beta/Release + # Use a bouncer link return '?'.join([self.bouncer_url, urlencode([ ('product', self.product_map.get(channel, 'fennec-latest')), ('os', self.platform_map[arch]), diff --git a/bedrock/firefox/tests/test_firefox_details.py b/bedrock/firefox/tests/test_firefox_details.py index 854c013a87e..6a89b834512 100644 --- a/bedrock/firefox/tests/test_firefox_details.py +++ b/bedrock/firefox/tests/test_firefox_details.py @@ -573,7 +573,6 @@ def test_stub_installer_win_only(self): class TestFirefoxAndroid(TestCase): - archive_url_base = 'https://archive.mozilla.org/pub/mobile/nightly/' google_play_url_base = ('https://play.google.com/store/apps/details' '?id=org.mozilla.') @@ -602,38 +601,19 @@ def test_get_download_url_nightly(self): firefox_android.get_download_url('nightly', 'x86') .startswith(self.google_play_url_base + 'fennec_aurora')) - @patch.object(firefox_android._storage, 'data', - Mock(return_value=dict(nightly_version='55.0a1'))) - def test_get_download_url_nightly_direct_legacy(self): - """ - get_download_url should return a mozilla-central archive link depending - on the architecture type, if the force_direct option is True. The ARM - build URL should have api-15 instead of api-16. - """ - assert ( - firefox_android.get_download_url('nightly', 'arm', 'multi', True) == - self.archive_url_base + 'latest-mozilla-central-android-api-15/' - 'fennec-55.0a1.multi.android-arm.apk') - assert ( - firefox_android.get_download_url('nightly', 'x86', 'multi', True) == - self.archive_url_base + 'latest-mozilla-central-android-x86/' - 'fennec-55.0a1.multi.android-i386.apk') - - @patch.object(firefox_android._storage, 'data', - Mock(return_value=dict(nightly_version='56.0a1'))) def test_get_download_url_nightly_direct(self): """ - get_download_url should return a mozilla-central archive link depending - on the architecture type, if the force_direct option is True. + get_download_url should return a bouncer link depending on the + architecture type, if the force_direct option is True. """ - assert ( - firefox_android.get_download_url('nightly', 'arm', 'multi', True) == - self.archive_url_base + 'latest-mozilla-central-android-api-16/' - 'fennec-56.0a1.multi.android-arm.apk') - assert ( - firefox_android.get_download_url('nightly', 'x86', 'multi', True) == - self.archive_url_base + 'latest-mozilla-central-android-x86/' - 'fennec-56.0a1.multi.android-i386.apk') + url = firefox_android.get_download_url('nightly', 'arm', 'multi', True) + self.assertListEqual(parse_qsl(urlparse(url).query), + [('product', 'fennec-nightly-latest'), + ('os', 'android'), ('lang', 'multi')]) + url = firefox_android.get_download_url('nightly', 'x86', 'multi', True) + self.assertListEqual(parse_qsl(urlparse(url).query), + [('product', 'fennec-nightly-latest'), + ('os', 'android-x86'), ('lang', 'multi')]) def test_get_download_url_beta(self): """