Skip to content

Commit

Permalink
[fix bug 1121209] whatsnew page for ESR24 -> ESR31 updates doesn't sh…
Browse files Browse the repository at this point in the history
…ow Australis tour
  • Loading branch information
alexgibson committed Jan 14, 2015
1 parent ed05921 commit f3bd8c8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
20 changes: 20 additions & 0 deletions bedrock/firefox/tests/test_base.py
Expand Up @@ -641,6 +641,26 @@ def test_fx_35_0_with_wrong_oldversion(self, render_mock):

# end 34.0.5 search tour tests

# ESR31 whatsnew tests

@override_settings(DEV=True)
def test_fx_esr_31_4_0_with_oldversion(self, render_mock):
"""Should use australis tour template for 31.4.0 with old version"""
req = self.rf.get('/en-US/firefox/whatsnew/?oldversion=24.8.0')
self.view(req, version='31.4.0')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/whatsnew-tour.html'])

@override_settings(DEV=True)
def test_fx_esr_31_4_0_with_wrong_oldversion(self, render_mock):
"""Should not show tour for 31.4.0 with wrong old version"""
req = self.rf.get('/en-US/firefox/whatsnew/?oldversion=30.0')
self.view(req, version='31.4.0')
template = render_mock.call_args[0][1]
eq_(template, ['firefox/australis/whatsnew-no-tour.html'])

# end ESR31 whatsnew tests

@override_settings(DEV=True)
def test_rv_prefix(self, render_mock):
"""Prefixed oldversion shouldn't impact version sniffing."""
Expand Down
17 changes: 16 additions & 1 deletion bedrock/firefox/views.py
Expand Up @@ -257,6 +257,15 @@ def show_devbrowser_firstrun(version):
return False


def show_australis_whatsnew_tour(oldversion):
try:
oldversion = Version(oldversion)
except ValueError:
return False

return oldversion < Version('29.0')


def show_whatsnew_tour(oldversion):
try:
oldversion = Version(oldversion)
Expand Down Expand Up @@ -416,7 +425,7 @@ def get_template_names(self):
# old versions of Firefox sent a prefixed version
if oldversion.startswith('rv:'):
oldversion = oldversion[3:]
versions = ('29.', '30.', '31.', '32.')
versions = ('29.', '30.', '32.')

if show_34_0_5_search_template(version):
if locale == 'en-US':
Expand Down Expand Up @@ -447,6 +456,12 @@ def get_template_names(self):
template = 'firefox/privacy_tour/no-tour.html'
else:
template = 'firefox/australis/whatsnew-no-tour.html'
# show australis tour for ESR 31 updates
elif version.startswith('31.'):
if show_australis_whatsnew_tour(oldversion):
template = 'firefox/australis/whatsnew-tour.html'
else:
template = 'firefox/australis/whatsnew-no-tour.html'
elif version.startswith(versions):
template = 'firefox/australis/whatsnew-no-tour.html'
elif locale in self.fxos_locales:
Expand Down

0 comments on commit f3bd8c8

Please sign in to comment.