Skip to content

Commit

Permalink
Merge 5b9e21b into cb58af8
Browse files Browse the repository at this point in the history
  • Loading branch information
pmac committed Jun 15, 2015
2 parents cb58af8 + 5b9e21b commit 02274ff
Show file tree
Hide file tree
Showing 22 changed files with 482 additions and 100 deletions.
7 changes: 2 additions & 5 deletions bedrock/firefox/firefox_details.py
Expand Up @@ -27,8 +27,8 @@ class FirefoxDesktop(ProductDetails):
'release': 'LATEST_FIREFOX_VERSION',
}

def __init__(self):
super(FirefoxDesktop, self).__init__()
def __init__(self, **kwargs):
super(FirefoxDesktop, self).__init__(**kwargs)

def latest_version(self, channel='release'):
version = self.channel_map.get(channel, 'LATEST_FIREFOX_VERSION')
Expand Down Expand Up @@ -241,9 +241,6 @@ class FirefoxAndroid(ProductDetails):
'x86': aurora_url_base + '-x86/fennec-%s.multi.android-i386.apk',
}

def __init__(self):
super(FirefoxAndroid, self).__init__()

def latest_version(self, channel):
version = self.channel_map.get(channel, 'version')
return self.mobile_details[version]
Expand Down
9 changes: 2 additions & 7 deletions bedrock/firefox/tests/test_base.py
Expand Up @@ -20,20 +20,15 @@
from bedrock.firefox import views as fx_views
from bedrock.firefox.firefox_details import FirefoxDesktop, FirefoxAndroid
from bedrock.firefox.utils import product_details
from bedrock.thunderbird.details import ThunderbirdDesktop
from bedrock.mozorg.tests import TestCase


TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), 'test_data')
PROD_DETAILS_DIR = os.path.join(TEST_DATA_DIR, 'product_details_json')
GOOD_PLATS = {'Windows': {}, 'OS X': {}, 'Linux': {}}

with patch.object(settings, 'PROD_DETAILS_DIR', PROD_DETAILS_DIR):
firefox_desktop = FirefoxDesktop()
firefox_android = FirefoxAndroid()
# We don't use Thunerbird data here but require this to prevent product data
# from being overridden unexpectedly
thunderbird_desktop = ThunderbirdDesktop()
firefox_desktop = FirefoxDesktop(json_dir=PROD_DETAILS_DIR)
firefox_android = FirefoxAndroid(json_dir=PROD_DETAILS_DIR)


class TestInstallerHelp(TestCase):
Expand Down
48 changes: 18 additions & 30 deletions bedrock/firefox/tests/test_firefox_details.py
Expand Up @@ -8,24 +8,19 @@
from django.conf import settings
from django.test.utils import override_settings

from mock import patch
from mock import patch, Mock
from nose.tools import eq_, ok_

from bedrock.firefox.firefox_details import FirefoxDesktop, FirefoxAndroid
from bedrock.thunderbird.details import ThunderbirdDesktop
from bedrock.mozorg.tests import TestCase


TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), 'test_data')
PROD_DETAILS_DIR = os.path.join(TEST_DATA_DIR, 'product_details_json')


with patch.object(settings, 'PROD_DETAILS_DIR', PROD_DETAILS_DIR):
firefox_desktop = FirefoxDesktop()
firefox_android = FirefoxAndroid()
# We don't use Thunerbird data here but require this to prevent product data
# from being overridden unexpectedly
thunderbird_desktop = ThunderbirdDesktop()
firefox_desktop = FirefoxDesktop(json_dir=PROD_DETAILS_DIR)
firefox_android = FirefoxAndroid(json_dir=PROD_DETAILS_DIR)


GOOD_PLATS = {'Windows': {}, 'OS X': {}, 'Linux': {}}
Expand All @@ -52,7 +47,7 @@

@patch.object(firefox_desktop, 'firefox_primary_builds', GOOD_BUILDS)
@patch.object(firefox_desktop, 'firefox_beta_builds', {})
@patch.dict(firefox_desktop.firefox_versions, GOOD_VERSIONS)
@patch.object(firefox_desktop, 'firefox_versions', GOOD_VERSIONS)
class TestLatestBuilds(TestCase):
def test_latest_builds(self):
"""Should return platforms if localized build does exist."""
Expand All @@ -77,7 +72,6 @@ def test_latest_builds_channels(self):


class TestFirefoxDesktop(TestCase):

def test_get_download_url(self):
url = firefox_desktop.get_download_url('release', '17.0.1', 'osx', 'pt-BR', True)
self.assertListEqual(parse_qsl(urlparse(url).query),
Expand All @@ -97,8 +91,6 @@ def test_get_download_url(self):
('os', 'linux64'),
('lang', 'en-US')])

@patch.dict(firefox_desktop.firefox_versions,
FIREFOX_AURORA='28.0a2')
def test_get_download_url_aurora(self):
"""
The Aurora version should give us a bouncer url. For Windows, a stub url
Expand Down Expand Up @@ -130,8 +122,6 @@ def test_get_download_url_aurora(self):
('os', 'linux64'),
('lang', 'en-US')])

@patch.dict(firefox_desktop.firefox_versions,
FIREFOX_AURORA='28.0a2')
def test_get_download_url_aurora_l10n(self):
"""Aurora non en-US should have a slightly different product name."""
url = firefox_desktop.get_download_url('alpha', '28.0a2', 'win', 'pt-BR', True)
Expand Down Expand Up @@ -233,34 +223,34 @@ def test_linux64_build(self):
url = builds[0]['platforms']['linux64']['download_url']
eq_(parse_qsl(urlparse(url).query)[1], ('os', 'linux64'))

@patch.dict(firefox_desktop.firefox_versions,
FIREFOX_ESR='24.2')
@patch.object(firefox_desktop, '_get_json_data',
Mock(return_value=dict(FIREFOX_ESR='24.2')))
def test_esr_major_versions(self):
"""ESR versions should be dynamic based on data."""
eq_(firefox_desktop.esr_major_versions, [24])

@patch.dict(firefox_desktop.firefox_versions,
FIREFOX_ESR='24.6.0',
FIREFOX_ESR_NEXT='31.0.0')
@patch.object(firefox_desktop, '_get_json_data',
Mock(return_value=dict(FIREFOX_ESR='24.6.0',
FIREFOX_ESR_NEXT='31.0.0')))
def test_esr_major_versions_prev(self):
"""ESR versions should show previous when available."""
eq_(firefox_desktop.esr_major_versions, [24, 31])

@patch.dict(firefox_desktop.firefox_versions,
LATEST_FIREFOX_VERSION='Phoenix',
FIREFOX_ESR='Albuquerque')
@patch.object(firefox_desktop, '_get_json_data',
Mock(return_value=dict(LATEST_FIREFOX_VERSION='Phoenix',
FIREFOX_ESR='Albuquerque')))
def test_esr_major_versions_no_latest(self):
"""ESR versions should not blow up if current version is broken."""
eq_(firefox_desktop.esr_major_versions, [])

@patch.dict(firefox_desktop.firefox_versions,
LATEST_FIREFOX_VERSION='18.0.1')
@patch.object(firefox_desktop, '_get_json_data',
Mock(return_value=dict(LATEST_FIREFOX_VERSION='18.0.1')))
def test_latest_major_version(self):
"""latest_major_version should return an int of the major version."""
eq_(firefox_desktop.latest_major_version('release'), 18)

@patch.dict(firefox_desktop.firefox_versions,
LATEST_FIREFOX_VERSION='Phoenix')
@patch.object(firefox_desktop, '_get_json_data',
Mock(return_value=dict(LATEST_FIREFOX_VERSION='Phoenix')))
def test_latest_major_version_no_int(self):
"""latest_major_version should return 0 when no int."""
eq_(firefox_desktop.latest_major_version('release'), 0)
Expand Down Expand Up @@ -303,16 +293,14 @@ def test_stub_installer_en_us_win_only(self):
ok_('product=firefox-beta-stub&' not in url)


@patch.object(firefox_android, '_get_json_data',
Mock(return_value=dict(version='22.0.1', beta_version='23.0')))
class TestFirefoxAndroid(TestCase):

@patch.dict(firefox_android.mobile_details,
version='22.0.1')
def test_latest_release_version(self):
"""latest_version should return the latest release version."""
eq_(firefox_android.latest_version('release'), '22.0.1')

@patch.dict(firefox_android.mobile_details,
beta_version='23.0')
def test_latest_beta_version(self):
"""latest_version should return the latest beta version."""
eq_(firefox_android.latest_version('beta'), '23.0')
@@ -0,0 +1,42 @@
{
"1.0": "2004-11-09",
"1.5": "2005-11-29",
"2.0": "2006-10-24",
"3.0": "2008-06-17",
"3.5": "2009-06-30",
"3.6": "2010-01-21",
"4.0": "2011-03-22",
"5.0": "2011-06-21",
"6.0": "2011-08-16",
"7.0": "2011-09-27",
"8.0": "2011-11-08",
"9.0": "2011-12-20",
"10.0": "2012-01-31",
"11.0": "2012-03-13",
"12.0": "2012-04-24",
"13.0": "2012-06-05",
"14.0.1": "2012-07-17",
"15.0": "2012-08-28",
"16.0": "2012-10-09",
"17.0": "2012-11-20",
"18.0": "2013-01-08",
"19.0": "2013-02-19",
"20.0": "2013-04-02",
"21.0": "2013-05-14",
"22.0": "2013-06-25",
"23.0": "2013-08-06",
"24.0": "2013-09-17",
"25.0": "2013-10-29",
"26.0": "2013-12-10",
"27.0": "2014-02-04",
"28.0": "2014-03-18",
"29.0": "2014-04-29",
"30.0": "2014-06-10",
"31.0": "2014-07-22",
"32.0": "2014-09-02",
"33.0": "2014-10-14",
"33.1": "2014-11-10",
"34.0": "2014-12-01",
"35.0": "2015-01-13",
"36.0": "2015-02-24"
}
@@ -0,0 +1,174 @@
{
"1.0.1": "2005-02-24",
"1.0.2": "2005-03-23",
"1.0.3": "2005-04-15",
"1.0.4": "2005-05-11",
"1.0.5": "2005-07-12",
"1.0.6": "2005-07-19",
"1.0.7": "2005-09-20",
"1.0.8": "2006-04-13",
"1.5.0.1": "2006-02-01",
"1.5.0.2": "2006-04-13",
"1.5.0.3": "2006-05-02",
"1.5.0.4": "2006-06-01",
"1.5.0.5": "2006-07-26",
"1.5.0.6": "2006-08-02",
"1.5.0.7": "2006-09-14",
"1.5.0.8": "2006-11-07",
"1.5.0.9": "2006-12-19",
"1.5.0.10": "2007-02-23",
"1.5.0.11": "2007-03-20",
"1.5.0.12": "2007-05-30",
"2.0.0.1": "2006-12-19",
"2.0.0.2": "2007-02-23",
"2.0.0.3": "2007-03-20",
"2.0.0.4": "2007-05-30",
"2.0.0.5": "2007-07-17",
"2.0.0.6": "2007-07-30",
"2.0.0.7": "2007-09-18",
"2.0.0.8": "2007-10-18",
"2.0.0.9": "2007-11-01",
"2.0.0.10": "2007-11-26",
"2.0.0.11": "2007-11-30",
"2.0.0.12": "2008-02-07",
"2.0.0.13": "2008-03-25",
"2.0.0.14": "2008-04-16",
"2.0.0.15": "2008-07-01",
"2.0.0.16": "2008-07-15",
"2.0.0.17": "2008-09-23",
"2.0.0.18": "2008-11-12",
"2.0.0.19": "2008-12-16",
"2.0.0.20": "2008-12-18",
"3.0.1": "2008-07-16",
"3.0.2": "2008-09-23",
"3.0.3": "2008-09-26",
"3.0.4": "2008-11-12",
"3.0.5": "2008-12-16",
"3.0.6": "2009-02-03",
"3.0.7": "2009-03-04",
"3.0.8": "2009-03-27",
"3.0.9": "2009-04-21",
"3.0.10": "2009-04-27",
"3.0.11": "2009-06-11",
"3.0.12": "2009-07-21",
"3.0.13": "2009-08-03",
"3.0.14": "2009-09-09",
"3.0.15": "2009-10-27",
"3.0.16": "2009-12-15",
"3.0.17": "2010-01-05",
"3.0.18": "2010-02-17",
"3.0.19": "2010-03-30",
"3.5.1": "2009-07-17",
"3.5.2": "2009-08-03",
"3.5.3": "2009-09-09",
"3.5.4": "2009-10-27",
"3.5.5": "2009-11-05",
"3.5.6": "2009-12-15",
"3.5.7": "2010-01-05",
"3.5.8": "2010-02-17",
"3.5.9": "2010-03-30",
"3.5.10": "2010-06-22",
"3.5.11": "2010-07-20",
"3.5.12": "2010-09-07",
"3.5.13": "2010-09-15",
"3.5.14": "2010-10-19",
"3.5.15": "2010-10-27",
"3.5.16": "2010-12-09",
"3.5.17": "2011-03-01",
"3.5.18": "2011-03-22",
"3.5.19": "2011-04-28",
"3.6.2": "2010-03-22",
"3.6.3": "2010-04-01",
"3.6.4": "2010-06-22",
"3.6.6": "2010-06-26",
"3.6.7": "2010-07-20",
"3.6.8": "2010-07-23",
"3.6.9": "2010-09-07",
"3.6.10": "2010-09-15",
"3.6.11": "2010-10-19",
"3.6.12": "2010-10-27",
"3.6.13": "2010-12-09",
"3.6.14": "2011-03-01",
"3.6.15": "2011-03-04",
"3.6.16": "2011-03-22",
"3.6.17": "2011-04-28",
"3.6.18": "2011-06-21",
"3.6.19": "2011-07-11",
"3.6.20": "2011-08-16",
"3.6.21": "2011-08-30",
"3.6.22": "2011-09-06",
"3.6.23": "2011-09-27",
"3.6.24": "2011-11-08",
"3.6.25": "2011-12-20",
"4.0.1": "2011-04-28",
"5.0.1": "2011-07-11",
"6.0.1": "2011-08-30",
"6.0.2": "2011-09-06",
"7.0.1": "2011-09-29",
"8.0.1": "2011-11-21",
"9.0.1": "2011-12-21",
"3.6.26": "2012-01-31",
"10.0.1": "2012-02-10",
"10.0.2": "2012-02-16",
"3.6.27": "2012-02-17",
"10.0.3": "2012-03-13",
"3.6.28": "2012-03-13",
"10.0.4": "2012-04-24",
"10.0.5": "2012-06-05",
"13.0.1": "2012-06-15",
"10.0.6": "2012-07-17",
"10.0.7": "2012-08-28",
"15.0.1": "2012-09-06",
"10.0.8": "2012-10-09",
"16.0.1": "2012-10-11",
"10.0.9": "2012-10-12",
"16.0.2": "2012-10-26",
"10.0.10": "2012-10-26",
"10.0.11": "2012-11-20",
"17.0.1": "2012-11-30",
"10.0.12": "2013-01-08",
"17.0.2": "2013-01-08",
"18.0.1": "2013-01-18",
"18.0.2": "2013-02-05",
"17.0.3": "2013-02-19",
"19.0.1": "2013-02-27",
"17.0.4": "2013-03-07",
"19.0.2": "2013-03-07",
"17.0.5": "2013-04-02",
"20.0.1": "2013-04-11",
"17.0.6": "2013-05-14",
"17.0.7": "2013-06-25",
"17.0.8": "2013-08-06",
"23.0.1": "2013-08-16",
"17.0.9": "2013-09-17",
"17.0.10": "2013-10-29",
"24.1.0": "2013-10-29",
"25.0.1": "2013-11-15",
"24.1.1": "2013-11-15",
"17.0.11": "2013-11-15",
"24.2.0": "2013-12-10",
"24.3.0": "2014-02-04",
"27.0.1": "2014-02-14",
"24.4.0": "2014-03-18",
"24.5.0": "2014-04-29",
"29.0.1": "2014-05-09",
"24.6.0": "2014-06-10",
"24.7.0": "2014-07-22",
"24.8.0": "2014-09-02",
"31.1.0": "2014-09-02",
"32.0.1": "2014-09-12",
"32.0.2": "2014-09-18",
"32.0.3": "2014-09-24",
"31.1.1": "2014-09-24",
"24.8.1": "2014-09-24",
"31.2.0": "2014-10-14",
"33.0.1": "2014-10-24",
"33.0.2": "2014-10-28",
"33.0.3": "2014-11-06",
"33.1.1": "2014-11-14",
"34.0.5": "2014-12-01",
"31.3.0": "2014-12-01",
"31.4.0": "2015-01-13",
"35.0.1": "2015-01-26",
"31.5.0": "2015-02-24"
}

0 comments on commit 02274ff

Please sign in to comment.