2011-01-29 04:31:44 +03:00
|
|
|
import json
|
2012-07-13 22:02:56 +04:00
|
|
|
|
2013-01-08 01:32:59 +04:00
|
|
|
from mock import patch
|
|
|
|
|
2012-09-12 04:44:10 +04:00
|
|
|
from appvalidator import validate_app, validate_packaged_app
|
|
|
|
from helper import safe
|
2012-07-13 04:17:56 +04:00
|
|
|
|
|
|
|
|
2012-09-12 04:44:10 +04:00
|
|
|
@safe
|
2012-07-13 04:17:56 +04:00
|
|
|
def test_webapp_new():
|
|
|
|
"""Test that webapps can be validated with the new api."""
|
|
|
|
with open("tests/resources/testwebapp.webapp") as file_:
|
|
|
|
out = validate_app(file_.read())
|
|
|
|
j = json.loads(out)
|
2013-07-11 05:03:01 +04:00
|
|
|
assert j["success"], "Expected not to fail: %s" % j
|
2012-09-12 04:44:10 +04:00
|
|
|
|
|
|
|
|
|
|
|
@safe
|
|
|
|
def test_packaged_app_new():
|
|
|
|
"""Test that packaged apps can be validated with the new api."""
|
|
|
|
out = validate_packaged_app("tests/resources/packaged_app.zip",
|
|
|
|
listed=False)
|
|
|
|
j = json.loads(out)
|
2013-07-11 05:03:01 +04:00
|
|
|
assert j["success"], "Expected not to fail: %s" % j
|
2012-09-12 04:44:10 +04:00
|
|
|
|
|
|
|
|
|
|
|
@safe
|
|
|
|
def test_packaged_app_bundle():
|
|
|
|
"""Test that packaged apps can be validated with the new api."""
|
|
|
|
out = validate_packaged_app("tests/resources/packaged_app.zip",
|
|
|
|
listed=False, format=None)
|
|
|
|
assert out.get_resource("packaged")
|
2013-07-11 23:39:25 +04:00
|
|
|
|
|
|
|
|
|
|
|
@safe
|
|
|
|
def test_server_name_indication():
|
|
|
|
# Make sure this doesn't raise an ImportError.
|
|
|
|
# This is a sanity check to make sure all requirements are installed
|
|
|
|
# to handle SSL Server Name Indication.
|
|
|
|
# See https://bugzilla.mozilla.org/show_bug.cgi?id=875142
|
|
|
|
from requests.packages.urllib3.contrib import pyopenssl
|