app-validator/tests/test_validate.py

42 строки
1.3 KiB
Python
Исходник Обычный вид История

2011-01-29 04:31:44 +03:00
import json
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-09-12 04:44:10 +04:00
@safe
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)
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)
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")
@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