Skip to content

Commit

Permalink
Merge pull request mozilla-services#1238 from selenamarie/test-for-ne…
Browse files Browse the repository at this point in the history
…w-esr-versions

Adding a few tests for new ESR numbering scheme
  • Loading branch information
lonnen committed May 13, 2013
2 parents ab198c2 + b249490 commit 46181ef
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 8 deletions.
15 changes: 14 additions & 1 deletion socorro/unittest/cron/jobs/test_ftpscraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,20 @@ def setUp(self):
'%(sunset_date)s',
't',
'Nightly'
);
)
,(
2,
'Firefox',
'24.5',
'24.5.0esr',
'24.5.0esr',
'024005000x000',
'%(build_date)s',
'%(sunset_date)s',
't',
'ESR'
)
;
""" % {"build_date": build_date, "sunset_date": sunset_date})

cursor.execute("""
Expand Down
48 changes: 43 additions & 5 deletions socorro/unittest/external/postgresql/test_products_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import logging
logger = logging.getLogger("webapi")

from decimal import Decimal


#==============================================================================
@attr(integration='postgres') # for nosetests
Expand Down Expand Up @@ -57,7 +59,8 @@ def setUp(self):
('Nightly', 1),
('Aurora', 2),
('Beta', 3),
('Release', 4);
('Release', 4),
('ESR', 4);
""")

cursor.execute("""
Expand All @@ -68,6 +71,7 @@ def setUp(self):
('Firefox', 'Aurora', 1),
('Firefox', 'Beta', 1),
('Firefox', 'Release', 1),
('Firefox', 'ESR', 1),
('Thunderbird', 'Nightly', 1),
('Thunderbird', 'Aurora', 1),
('Thunderbird', 'Beta', 1),
Expand Down Expand Up @@ -109,16 +113,32 @@ def _get_builds_for_product(self, product):
""", {"product": product})
return list(result)

#--------------------------------------------------------------------------
def _get_builds_for_version(self, version):
cursor = self.connection.cursor(
cursor_factory=psycopg2.extras.RealDictCursor)
result = db.execute(cursor, """
SELECT product_name as product,
version,
build_id,
build_type,
platform,
repository
FROM releases_raw
WHERE version = %(version)s
""", {"version": version})
return list(result)

#--------------------------------------------------------------------------
def test_create(self):
builds = products_builds.ProductsBuilds(config=self.config)

#......................................................................
# Test 1: a new build
params = {
"product": "Firefox",
"product": "firefox",
"version": "20.0",
"build_id": 20120417012345,
"build_id": Decimal('20120417012345'),
"build_type": "Release",
"platform": "macosx",
"repository": "mozilla-central"
Expand All @@ -143,9 +163,9 @@ def test_create(self):
#......................................................................
# Test 3: optional parameters
params = {
"product": "Thunderbird",
"product": "thunderbird",
"version": "17.0",
"build_id": 20120416012345,
"build_id": Decimal('20120416012345'),
"build_type": "Aurora",
"platform": "win32"
}
Expand Down Expand Up @@ -174,3 +194,21 @@ def test_create(self):
self.assertRaises(products_builds.MissingOrBadArgumentError,
builds.create,
**params)

#......................................................................
# Test 5: ESR releases with Gecko security fixes
params = {
"product": "Firefox",
"version": "24.5.0esr",
"build_id": 20110316000005,
"build_type": "ESR",
"platform": "windows"
}
product, version = builds.create(**params)
self.assertEqual(params["product"], product)
self.assertEqual(params["version"], version)

# Verify that build has been created in the DB
res = self._get_builds_for_version(params["version"])

self.assertEqual(1, len(res))
19 changes: 17 additions & 2 deletions socorro/unittest/external/postgresql/test_releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,20 @@ def setUp(self):
'%(sunset_date)s',
't',
'Nightly'
);
),
(
7,
'Firefox',
'24.5',
'24.5.0esr',
'24.5.0esr',
'024005000x000',
'%(build_date)s',
'%(sunset_date)s',
'f',
'ESR'
)
;
""" % {"build_date": build_date, "sunset_date": sunset_date})

cursor.execute("""
Expand All @@ -137,7 +150,8 @@ def setUp(self):
('Nightly', 1),
('Aurora', 2),
('Beta', 3),
('Release', 4);
('Release', 4),
('ESR', 5);
""")

cursor.execute("""
Expand All @@ -148,6 +162,7 @@ def setUp(self):
('Firefox', 'Aurora', 1),
('Firefox', 'Beta', 1),
('Firefox', 'Release', 1),
('Firefox', 'ESR', 1),
('Thunderbird', 'Nightly', 1),
('Thunderbird', 'Aurora', 1),
('Thunderbird', 'Beta', 1),
Expand Down

0 comments on commit 46181ef

Please sign in to comment.