Skip to content

Commit

Permalink
Merge pull request mozilla#160 from mattbasta/webapps
Browse files Browse the repository at this point in the history
Webapps update
  • Loading branch information
mattbasta committed Jun 29, 2012
2 parents 944c8a5 + 937de4d commit 99891a8
Show file tree
Hide file tree
Showing 9 changed files with 1,035 additions and 833 deletions.
7 changes: 5 additions & 2 deletions tests/helper.py
Expand Up @@ -47,6 +47,7 @@ def setUp(self):
self.is_jetpack = False
self.is_bootstrapped = False
self.detected_type = None
self.listed = True

def reset(self):
"""
Expand All @@ -65,7 +66,8 @@ def setup_err(self, for_appversions=None):
the state that the test case was setup with.
"""
self.err = ErrorBundle(instant=True,
for_appversions=for_appversions or {})
for_appversions=for_appversions or {},
listed=self.listed)
self.err.handler = OutputHandler(sys.stdout, True)

if self.is_jetpack:
Expand All @@ -90,7 +92,8 @@ def assert_failed(self, with_errors=False, with_warnings=None):
if with_errors:
assert self.err.errors, "Errors were expected."
elif self.err.errors:
raise "Tests found unexpected errors: %s" % self.err.print_summary()
raise AssertionError("Tests found unexpected errors: %s" %
self.err.print_summary(verbose=True))

if with_warnings is not None:
if with_warnings:
Expand Down
22 changes: 19 additions & 3 deletions tests/test_validate.py
@@ -1,7 +1,7 @@
import json
from validator.validate import validate as validate
from validator.errorbundler import ErrorBundle
import validator.constants
import validator.constants as constants


def test_validate():
Expand Down Expand Up @@ -45,6 +45,22 @@ def test_app_versions():
"Tests that the validate function properly loads app_versions.json"
validate(path="tests/resources/junk.xpi",
approved_applications="tests/resources/test_app_versions.json")
print validator.constants.APPROVED_APPLICATIONS
assert validator.constants.APPROVED_APPLICATIONS["1"]["name"] == "Foo App"
print constants.APPROVED_APPLICATIONS
assert constants.APPROVED_APPLICATIONS["1"]["name"] == "Foo App"


def test_mrkt_urls():
"""
Tests that Marketplace URLs are correctly added to the MRKT_URLS constant.
"""
# Keep a copy so we don't permanently overwrite.
MRKT_URLS = constants.DEFAULT_WEBAPP_MRKT_URLS[:]

validate(path="tests/resources/junk.xpi",
market_urls=["foobar"])
print constants.DEFAULT_WEBAPP_MRKT_URLS
assert "foobar" in constants.DEFAULT_WEBAPP_MRKT_URLS

# Clean up!
constants.DEFAULT_WEBAPP_MRKT_URLS = MRKT_URLS

0 comments on commit 99891a8

Please sign in to comment.