Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug 1553396: Update Fennec Nightly direct download links to bouncer #7213

Merged
merged 1 commit into from
May 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions bedrock/firefox/firefox_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
Expand Down Expand Up @@ -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]),
Expand Down
40 changes: 10 additions & 30 deletions bedrock/firefox/tests/test_firefox_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')

Expand Down Expand Up @@ -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):
"""
Expand Down