Fixed the unit tests that jbalogh's commit broke.
This commit is contained in:
Родитель
224b2e18e0
Коммит
ebc3c136e8
|
@ -1,8 +1,8 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from rdf import RDFParser
|
from validator.rdf import RDFParser
|
||||||
from xpi import XPIManager
|
from validator.xpi import XPIManager
|
||||||
from errorbundler import ErrorBundle
|
from validator.errorbundler import ErrorBundle
|
||||||
|
|
||||||
def _do_test(path, test, failure=True,
|
def _do_test(path, test, failure=True,
|
||||||
require_install=False, set_type=0):
|
require_install=False, set_type=0):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import unittest
|
import unittest
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from chromemanifest import ChromeManifest
|
from validator.chromemanifest import ChromeManifest
|
||||||
|
|
||||||
def test_open():
|
def test_open():
|
||||||
"Open a chrome file and ensure that data can be pulled from it."
|
"Open a chrome file and ensure that data can be pulled from it."
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import decorator
|
import validator.decorator as decorator
|
||||||
import testcases
|
import validator.testcases as testcases
|
||||||
import testcases.conduit
|
import validator.testcases.conduit as conduit
|
||||||
from errorbundler import ErrorBundle
|
from validator.errorbundler import ErrorBundle
|
||||||
from xpi import XPIManager
|
from validator.xpi import XPIManager
|
||||||
from rdf import RDFParser
|
from validator.rdf import RDFParser
|
||||||
from helper import _do_test
|
from helper import _do_test
|
||||||
from constants import *
|
from validator.constants import *
|
||||||
|
|
||||||
def test_outright():
|
def test_outright():
|
||||||
"Tests the Conduit detector against an outright toolbar."
|
"Tests the Conduit detector against an outright toolbar."
|
||||||
|
|
||||||
_do_test("tests/resources/conduit/basta_bar.xpi",
|
_do_test("tests/resources/conduit/basta_bar.xpi",
|
||||||
testcases.conduit.test_conduittoolbar,
|
conduit.test_conduittoolbar,
|
||||||
failure=True,
|
failure=True,
|
||||||
require_install=True,
|
require_install=True,
|
||||||
set_type=PACKAGE_EXTENSION)
|
set_type=PACKAGE_EXTENSION)
|
||||||
|
@ -22,7 +22,7 @@ def test_white():
|
||||||
"Tests a non-Conduit addon against the library."
|
"Tests a non-Conduit addon against the library."
|
||||||
|
|
||||||
_do_test("tests/resources/conduit/pass.xpi",
|
_do_test("tests/resources/conduit/pass.xpi",
|
||||||
testcases.conduit.test_conduittoolbar,
|
conduit.test_conduittoolbar,
|
||||||
failure=False,
|
failure=False,
|
||||||
require_install=True,
|
require_install=True,
|
||||||
set_type=PACKAGE_EXTENSION)
|
set_type=PACKAGE_EXTENSION)
|
||||||
|
@ -32,7 +32,7 @@ def test_params():
|
||||||
the install.rdf file that indiciate Conduit-ion."""
|
the install.rdf file that indiciate Conduit-ion."""
|
||||||
|
|
||||||
_do_test("tests/resources/conduit/conduit_params.xpi",
|
_do_test("tests/resources/conduit/conduit_params.xpi",
|
||||||
testcases.conduit.test_conduittoolbar,
|
conduit.test_conduittoolbar,
|
||||||
failure=True,
|
failure=True,
|
||||||
require_install=True,
|
require_install=True,
|
||||||
set_type=PACKAGE_EXTENSION)
|
set_type=PACKAGE_EXTENSION)
|
||||||
|
@ -42,7 +42,7 @@ def test_updateurl():
|
||||||
parameter set to that of a Conduit Toolbar's."""
|
parameter set to that of a Conduit Toolbar's."""
|
||||||
|
|
||||||
_do_test("tests/resources/conduit/conduit_updateurl.xpi",
|
_do_test("tests/resources/conduit/conduit_updateurl.xpi",
|
||||||
testcases.conduit.test_conduittoolbar,
|
conduit.test_conduittoolbar,
|
||||||
failure=True,
|
failure=True,
|
||||||
require_install=True,
|
require_install=True,
|
||||||
set_type=PACKAGE_EXTENSION)
|
set_type=PACKAGE_EXTENSION)
|
||||||
|
@ -52,7 +52,7 @@ def test_structure():
|
||||||
folders which resemble those of a Conduit toolbar."""
|
folders which resemble those of a Conduit toolbar."""
|
||||||
|
|
||||||
_do_test("tests/resources/conduit/conduit_structure.xpi",
|
_do_test("tests/resources/conduit/conduit_structure.xpi",
|
||||||
testcases.conduit.test_conduittoolbar,
|
conduit.test_conduittoolbar,
|
||||||
failure=True,
|
failure=True,
|
||||||
require_install=True,
|
require_install=True,
|
||||||
set_type=PACKAGE_EXTENSION)
|
set_type=PACKAGE_EXTENSION)
|
||||||
|
@ -62,7 +62,7 @@ def test_chrome():
|
||||||
chrome.manifest entries that indicate a Conduit toolbar."""
|
chrome.manifest entries that indicate a Conduit toolbar."""
|
||||||
|
|
||||||
_do_test("tests/resources/conduit/conduit_chrome.xpi",
|
_do_test("tests/resources/conduit/conduit_chrome.xpi",
|
||||||
testcases.conduit.test_conduittoolbar,
|
conduit.test_conduittoolbar,
|
||||||
failure=True,
|
failure=True,
|
||||||
require_install=True,
|
require_install=True,
|
||||||
set_type=PACKAGE_EXTENSION)
|
set_type=PACKAGE_EXTENSION)
|
||||||
|
|
|
@ -2,11 +2,11 @@ import os
|
||||||
|
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
import xpi
|
import validator.xpi as xpi
|
||||||
import testcases.content as content
|
import validator.testcases.content as content
|
||||||
from errorbundler import ErrorBundle
|
from validator.errorbundler import ErrorBundle
|
||||||
from helper import _do_test
|
from helper import _do_test
|
||||||
from constants import *
|
from validator.constants import *
|
||||||
|
|
||||||
def test_ignore_macstuff():
|
def test_ignore_macstuff():
|
||||||
"Tests that the content manager will ignore Mac-generated files"
|
"Tests that the content manager will ignore Mac-generated files"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import decorator
|
import validator.decorator as decorator
|
||||||
|
|
||||||
def test_tiers():
|
def test_tiers():
|
||||||
"""Tests to make sure that the decorator module is properly
|
"""Tests to make sure that the decorator module is properly
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
import json
|
import json
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
import errorbundler
|
import validator.errorbundler as errorbundler
|
||||||
from errorbundler import ErrorBundle
|
from validator.errorbundler import ErrorBundle
|
||||||
|
|
||||||
#{"messages": [{"message": "Invalid chrome.manifest object/predicate.", "type": "error", "description": "'override' entry does not match chrome://*/locale/*"}], "detected_type": 4, "success": false}
|
#{"messages": [{"message": "Invalid chrome.manifest object/predicate.", "type": "error", "description": "'override' entry does not match chrome://*/locale/*"}], "detected_type": 4, "success": false}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import testcases.installrdf
|
import validator.testcases.installrdf as installrdf
|
||||||
from errorbundler import ErrorBundle
|
from validator.errorbundler import ErrorBundle
|
||||||
from rdf import RDFParser
|
from validator.rdf import RDFParser
|
||||||
from helper import _do_test
|
from helper import _do_test
|
||||||
from constants import *
|
from validator.constants import *
|
||||||
|
|
||||||
def _test_value(value, test, failure=True):
|
def _test_value(value, test, failure=True):
|
||||||
"Tests a value against a test."
|
"Tests a value against a test."
|
||||||
|
@ -20,40 +20,40 @@ def test_pass_id():
|
||||||
"Tests that valid IDs will be accepted."
|
"Tests that valid IDs will be accepted."
|
||||||
|
|
||||||
_test_value("{12345678-1234-1234-1234-123456789012}",
|
_test_value("{12345678-1234-1234-1234-123456789012}",
|
||||||
testcases.installrdf._test_id,
|
installrdf._test_id,
|
||||||
False)
|
False)
|
||||||
_test_value("abc@foo.bar",
|
_test_value("abc@foo.bar",
|
||||||
testcases.installrdf._test_id,
|
installrdf._test_id,
|
||||||
False)
|
False)
|
||||||
_test_value("a+bc@foo.bar",
|
_test_value("a+bc@foo.bar",
|
||||||
testcases.installrdf._test_id,
|
installrdf._test_id,
|
||||||
False)
|
False)
|
||||||
|
|
||||||
def test_fail_id():
|
def test_fail_id():
|
||||||
"Tests that invalid IDs will not be accepted."
|
"Tests that invalid IDs will not be accepted."
|
||||||
|
|
||||||
_test_value("{1234567-1234-1234-1234-123456789012}",
|
_test_value("{1234567-1234-1234-1234-123456789012}",
|
||||||
testcases.installrdf._test_id)
|
installrdf._test_id)
|
||||||
_test_value("!@foo.bar",
|
_test_value("!@foo.bar",
|
||||||
testcases.installrdf._test_id)
|
installrdf._test_id)
|
||||||
|
|
||||||
def test_pass_version():
|
def test_pass_version():
|
||||||
"Tests that valid versions will be accepted."
|
"Tests that valid versions will be accepted."
|
||||||
|
|
||||||
_test_value("1.2.3.4",
|
_test_value("1.2.3.4",
|
||||||
testcases.installrdf._test_version,
|
installrdf._test_version,
|
||||||
False)
|
False)
|
||||||
_test_value("1a.2+.3b",
|
_test_value("1a.2+.3b",
|
||||||
testcases.installrdf._test_version,
|
installrdf._test_version,
|
||||||
False)
|
False)
|
||||||
|
|
||||||
def test_fail_version():
|
def test_fail_version():
|
||||||
"Tests that invalid versions will not be accepted."
|
"Tests that invalid versions will not be accepted."
|
||||||
|
|
||||||
_test_value("2.0 alpha",
|
_test_value("2.0 alpha",
|
||||||
testcases.installrdf._test_version)
|
installrdf._test_version)
|
||||||
_test_value("whatever",
|
_test_value("whatever",
|
||||||
testcases.installrdf._test_version)
|
installrdf._test_version)
|
||||||
|
|
||||||
def _run_test(filename, failure=True):
|
def _run_test(filename, failure=True):
|
||||||
"Runs a test on an install.rdf file"
|
"Runs a test on an install.rdf file"
|
||||||
|
@ -65,7 +65,7 @@ def _run_test(filename, failure=True):
|
||||||
file_.close()
|
file_.close()
|
||||||
|
|
||||||
parser = RDFParser(data)
|
parser = RDFParser(data)
|
||||||
testcases.installrdf._test_rdf(err, parser)
|
installrdf._test_rdf(err, parser)
|
||||||
|
|
||||||
if failure: # pragma: no cover
|
if failure: # pragma: no cover
|
||||||
assert err.failed()
|
assert err.failed()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import testcases.l10ncompleteness as l10n
|
import validator.testcases.l10ncompleteness as l10n
|
||||||
from errorbundler import ErrorBundle
|
from validator.errorbundler import ErrorBundle
|
||||||
from helper import _do_test
|
from helper import _do_test
|
||||||
from constants import *
|
from validator.constants import *
|
||||||
|
|
||||||
def test_pass():
|
def test_pass():
|
||||||
"Test a package with localization that should pass validation."
|
"Test a package with localization that should pass validation."
|
||||||
|
|
|
@ -2,7 +2,7 @@ import os
|
||||||
|
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
import testcases.l10n.dtd as dtd
|
import validator.testcases.l10n.dtd as dtd
|
||||||
|
|
||||||
def test_passing_file():
|
def test_passing_file():
|
||||||
"Tests a valid DTD file by passing in a file path."
|
"Tests a valid DTD file by passing in a file path."
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import testcases.l10ncompleteness as l10n
|
import validator.testcases.l10ncompleteness as l10n
|
||||||
from testcases.l10n.dtd import DTDParser
|
from validator.testcases.l10n.dtd import DTDParser
|
||||||
from testcases.l10n.properties import PropertiesParser
|
from validator.testcases.l10n.properties import PropertiesParser
|
||||||
from xpi import XPIManager
|
from validator.xpi import XPIManager
|
||||||
from errorbundler import ErrorBundle
|
from validator.errorbundler import ErrorBundle
|
||||||
from helper import _do_test
|
from helper import _do_test
|
||||||
from constants import *
|
from validator.constants import *
|
||||||
|
|
||||||
def test_chromemanifest():
|
def test_chromemanifest():
|
||||||
"Make sure it only accepts packs with chrome.manifest files."
|
"Make sure it only accepts packs with chrome.manifest files."
|
||||||
|
|
|
@ -2,7 +2,7 @@ import os
|
||||||
|
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
import testcases.l10n.properties as properties
|
import validator.testcases.l10n.properties as properties
|
||||||
|
|
||||||
def test_passing_file():
|
def test_passing_file():
|
||||||
"Tests a valid properties file by passing in a file path."
|
"Tests a valid properties file by passing in a file path."
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import testcases
|
import validator.testcases as testcases
|
||||||
import testcases.langpack
|
import validator.testcases.langpack as langpack
|
||||||
from chromemanifest import ChromeManifest
|
from validator.chromemanifest import ChromeManifest
|
||||||
from errorbundler import ErrorBundle
|
from validator.errorbundler import ErrorBundle
|
||||||
from helper import _do_test
|
from helper import _do_test
|
||||||
|
|
||||||
def test_langpack_valid():
|
def test_langpack_valid():
|
||||||
"Tests that a language pack has a valid chrome manifest file."
|
"Tests that a language pack has a valid chrome manifest file."
|
||||||
|
|
||||||
_do_test("tests/resources/langpack/pass.xpi",
|
_do_test("tests/resources/langpack/pass.xpi",
|
||||||
testcases.langpack.test_langpack_manifest,
|
langpack.test_langpack_manifest,
|
||||||
False)
|
False)
|
||||||
|
|
||||||
def test_langpack_bad_subject():
|
def test_langpack_bad_subject():
|
||||||
|
@ -16,28 +16,28 @@ def test_langpack_bad_subject():
|
||||||
chrome.manifest file."""
|
chrome.manifest file."""
|
||||||
|
|
||||||
_do_test("tests/resources/langpack/fail.xpi",
|
_do_test("tests/resources/langpack/fail.xpi",
|
||||||
testcases.langpack.test_langpack_manifest)
|
langpack.test_langpack_manifest)
|
||||||
|
|
||||||
def test_langpack_bad_uri_pred():
|
def test_langpack_bad_uri_pred():
|
||||||
"""Tests that a language pack has an invalid URI specified for its
|
"""Tests that a language pack has an invalid URI specified for its
|
||||||
'override' predicates."""
|
'override' predicates."""
|
||||||
|
|
||||||
_do_test("tests/resources/langpack/fail_uri_pred.xpi",
|
_do_test("tests/resources/langpack/fail_uri_pred.xpi",
|
||||||
testcases.langpack.test_langpack_manifest)
|
langpack.test_langpack_manifest)
|
||||||
|
|
||||||
def test_langpack_bad_uri_obj():
|
def test_langpack_bad_uri_obj():
|
||||||
"""Tests that a language pack has an invalid URI specified for its
|
"""Tests that a language pack has an invalid URI specified for its
|
||||||
'override' objects."""
|
'override' objects."""
|
||||||
|
|
||||||
_do_test("tests/resources/langpack/fail_uri_obj.xpi",
|
_do_test("tests/resources/langpack/fail_uri_obj.xpi",
|
||||||
testcases.langpack.test_langpack_manifest)
|
langpack.test_langpack_manifest)
|
||||||
|
|
||||||
def test_unsafe_html():
|
def test_unsafe_html():
|
||||||
"Tests for unsafe HTML in obstract files."
|
"Tests for unsafe HTML in obstract files."
|
||||||
|
|
||||||
err = ErrorBundle(None, True)
|
err = ErrorBundle(None, True)
|
||||||
|
|
||||||
testcases.langpack.test_unsafe_html(err, None, """
|
langpack.test_unsafe_html(err, None, """
|
||||||
This is an <b>innocent</b> file.
|
This is an <b>innocent</b> file.
|
||||||
Nothing to <a href="#anchor">suspect</a> here.
|
Nothing to <a href="#anchor">suspect</a> here.
|
||||||
<img src="chrome://asdf/locale/asdf" />
|
<img src="chrome://asdf/locale/asdf" />
|
||||||
|
@ -45,13 +45,13 @@ def test_unsafe_html():
|
||||||
|
|
||||||
assert not err.failed()
|
assert not err.failed()
|
||||||
|
|
||||||
testcases.langpack.test_unsafe_html(err, "asdf", """
|
langpack.test_unsafe_html(err, "asdf", """
|
||||||
This is not an <script>innocent</script> file.""")
|
This is not an <script>innocent</script> file.""")
|
||||||
|
|
||||||
assert err.failed()
|
assert err.failed()
|
||||||
|
|
||||||
err = ErrorBundle(None, True)
|
err = ErrorBundle(None, True)
|
||||||
testcases.langpack.test_unsafe_html(err, "asdf", """
|
langpack.test_unsafe_html(err, "asdf", """
|
||||||
Nothing to <a href="http://foo.bar/">suspect</a> here.""")
|
Nothing to <a href="http://foo.bar/">suspect</a> here.""")
|
||||||
|
|
||||||
assert err.failed()
|
assert err.failed()
|
||||||
|
@ -61,6 +61,6 @@ def test_has_chrome_manifest():
|
||||||
"""Makes sure the module fails when a chrome.manifest file is not
|
"""Makes sure the module fails when a chrome.manifest file is not
|
||||||
available."""
|
available."""
|
||||||
|
|
||||||
assert testcases.langpack.test_langpack_manifest(None,
|
assert langpack.test_langpack_manifest(None,
|
||||||
{},
|
{},
|
||||||
None) is None
|
None) is None
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import decorator
|
import validator.testcases.library_blacklist as libblacklist
|
||||||
import testcases
|
from validator.errorbundler import ErrorBundle
|
||||||
import testcases.library_blacklist
|
from validator.xpi import XPIManager
|
||||||
from errorbundler import ErrorBundle
|
from validator.rdf import RDFParser
|
||||||
from xpi import XPIManager
|
|
||||||
from rdf import RDFParser
|
|
||||||
|
|
||||||
|
|
||||||
def test_blacklisted_files():
|
def test_blacklisted_files():
|
||||||
|
@ -18,7 +16,7 @@ def test_blacklisted_files():
|
||||||
contents = package.get_file_data()
|
contents = package.get_file_data()
|
||||||
err = ErrorBundle(None, True)
|
err = ErrorBundle(None, True)
|
||||||
|
|
||||||
testcases.library_blacklist.test_library_blacklist(err,
|
libblacklist.test_library_blacklist(err,
|
||||||
contents,
|
contents,
|
||||||
package)
|
package)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import testcases
|
import validator.testcases.markup.csstester as csstester
|
||||||
import testcases.markup
|
from validator.errorbundler import ErrorBundle
|
||||||
import testcases.markup.csstester
|
|
||||||
from errorbundler import ErrorBundle
|
|
||||||
|
|
||||||
def _do_test(path, should_fail=False):
|
def _do_test(path, should_fail=False):
|
||||||
|
|
||||||
|
@ -11,7 +9,7 @@ def _do_test(path, should_fail=False):
|
||||||
|
|
||||||
err = ErrorBundle(None, True)
|
err = ErrorBundle(None, True)
|
||||||
|
|
||||||
testcases.markup.csstester.test_css_file(err, "css.css", data)
|
csstester.test_css_file(err, "css.css", data)
|
||||||
|
|
||||||
err.print_summary()
|
err.print_summary()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import testcases.markup.markuptester
|
import validator.testcases.markup.markuptester as markuptester
|
||||||
from errorbundler import ErrorBundle
|
from validator.errorbundler import ErrorBundle
|
||||||
from constants import *
|
from validator.constants import *
|
||||||
|
|
||||||
def _do_test(path, should_fail=False, type_=None):
|
def _do_test(path, should_fail=False, type_=None):
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ def _do_test(path, should_fail=False, type_=None):
|
||||||
if type_:
|
if type_:
|
||||||
err.set_type(type_)
|
err.set_type(type_)
|
||||||
|
|
||||||
parser = testcases.markup.markuptester.MarkupParser(err, True)
|
parser = markuptester.MarkupParser(err, True)
|
||||||
parser.process(filename, data, extension)
|
parser.process(filename, data, extension)
|
||||||
|
|
||||||
err.print_summary(True)
|
err.print_summary(True)
|
||||||
|
@ -32,7 +32,7 @@ def test_local_url_detector():
|
||||||
"Tests that local URLs can be detected."
|
"Tests that local URLs can be detected."
|
||||||
|
|
||||||
err = ErrorBundle(None, True)
|
err = ErrorBundle(None, True)
|
||||||
mp = testcases.markup.markuptester.MarkupParser(err)
|
mp = markuptester.MarkupParser(err)
|
||||||
tester = mp._is_url_local
|
tester = mp._is_url_local
|
||||||
|
|
||||||
assert tester("chrome://xyz/content/abc")
|
assert tester("chrome://xyz/content/abc")
|
||||||
|
@ -60,77 +60,62 @@ def test_xul_file():
|
||||||
def test_xml_bad_nesting():
|
def test_xml_bad_nesting():
|
||||||
"Tests an XML file that has badly nested elements."
|
"Tests an XML file that has badly nested elements."
|
||||||
|
|
||||||
_do_test("tests/resources/markup/markuptester/bad_nesting.xml",
|
_do_test("tests/resources/markup/markuptester/bad_nesting.xml", True)
|
||||||
True)
|
|
||||||
|
|
||||||
def test_xml_overclosing():
|
def test_xml_overclosing():
|
||||||
"Tests an XML file that has overclosed elements"
|
"Tests an XML file that has overclosed elements"
|
||||||
|
|
||||||
_do_test("tests/resources/markup/markuptester/overclose.xml",
|
_do_test("tests/resources/markup/markuptester/overclose.xml", True)
|
||||||
True)
|
|
||||||
|
|
||||||
def test_xml_extraclosing():
|
def test_xml_extraclosing():
|
||||||
"Tests an XML file that has extraclosed elements"
|
"Tests an XML file that has extraclosed elements"
|
||||||
|
|
||||||
_do_test("tests/resources/markup/markuptester/extraclose.xml",
|
_do_test("tests/resources/markup/markuptester/extraclose.xml", True)
|
||||||
True)
|
|
||||||
|
|
||||||
def test_html_ignore_comment():
|
def test_html_ignore_comment():
|
||||||
"Tests that HTML comment values are ignored"
|
"Tests that HTML comment values are ignored"
|
||||||
|
|
||||||
_do_test(
|
_do_test("tests/resources/markup/markuptester/ignore_comments.html")
|
||||||
"tests/resources/markup/markuptester/ignore_comments.html")
|
|
||||||
|
|
||||||
def test_html_css_style():
|
def test_html_css_style():
|
||||||
"Tests that CSS within an element is passed to the CSS tester"
|
"Tests that CSS within an element is passed to the CSS tester"
|
||||||
|
|
||||||
_do_test("tests/resources/markup/markuptester/css_style.html",
|
_do_test("tests/resources/markup/markuptester/css_style.html", True)
|
||||||
True)
|
|
||||||
|
|
||||||
def test_html_css_inline():
|
def test_html_css_inline():
|
||||||
"Tests that inline CSS is passed to the CSS tester"
|
"Tests that inline CSS is passed to the CSS tester"
|
||||||
|
|
||||||
_do_test("tests/resources/markup/markuptester/css_inline.html",
|
_do_test("tests/resources/markup/markuptester/css_inline.html", True)
|
||||||
True)
|
|
||||||
|
|
||||||
def test_xul_evil():
|
def test_xul_evil():
|
||||||
"Tests for evil kinds of scripts and iframes in XUL."
|
"Tests for evil kinds of scripts and iframes in XUL."
|
||||||
|
|
||||||
_do_test(
|
_do_test("tests/resources/markup/markuptester/remote_src.xul", True)
|
||||||
"tests/resources/markup/markuptester/remote_src.xul", True)
|
|
||||||
|
|
||||||
_do_test(
|
_do_test("tests/resources/markup/markuptester/bad_iframe_remote.xul", True)
|
||||||
"tests/resources/markup/markuptester/bad_iframe_remote.xul",
|
_do_test("tests/resources/markup/markuptester/bad_iframe_chrome.xul", True)
|
||||||
True)
|
_do_test("tests/resources/markup/markuptester/"
|
||||||
_do_test(
|
|
||||||
"tests/resources/markup/markuptester/bad_iframe_chrome.xul",
|
|
||||||
True)
|
|
||||||
_do_test(
|
|
||||||
"tests/resources/markup/markuptester/"
|
|
||||||
"bad_iframe_remote_missing.xul",
|
"bad_iframe_remote_missing.xul",
|
||||||
True)
|
True)
|
||||||
|
|
||||||
def test_lp_passing():
|
def test_lp_passing():
|
||||||
"Tests a valid language pack file."
|
"Tests a valid language pack file."
|
||||||
|
|
||||||
_do_test(
|
_do_test("tests/resources/markup/markuptester/_langpack/lp_safe.html",
|
||||||
"tests/resources/markup/markuptester/_langpack/lp_safe.html",
|
|
||||||
False,
|
False,
|
||||||
PACKAGE_LANGPACK)
|
PACKAGE_LANGPACK)
|
||||||
|
|
||||||
def test_lp_unsafe():
|
def test_lp_unsafe():
|
||||||
"Tests a language pack file that contains unsafe elements."
|
"Tests a language pack file that contains unsafe elements."
|
||||||
|
|
||||||
_do_test(
|
_do_test("tests/resources/markup/markuptester/_langpack/lp_unsafe.html",
|
||||||
"tests/resources/markup/markuptester/_langpack/lp_unsafe.html",
|
|
||||||
True,
|
True,
|
||||||
PACKAGE_LANGPACK)
|
PACKAGE_LANGPACK)
|
||||||
|
|
||||||
def test_lp_remote():
|
def test_lp_remote():
|
||||||
"Tests a language pack file that contains remote references."
|
"Tests a language pack file that contains remote references."
|
||||||
|
|
||||||
_do_test(
|
_do_test("tests/resources/markup/markuptester/_langpack/lp_remote.html",
|
||||||
"tests/resources/markup/markuptester/_langpack/lp_remote.html",
|
|
||||||
True,
|
True,
|
||||||
PACKAGE_LANGPACK)
|
PACKAGE_LANGPACK)
|
||||||
|
|
||||||
|
@ -138,13 +123,10 @@ def test_invalid_markup():
|
||||||
"Tests an markup file that is simply broken."
|
"Tests an markup file that is simply broken."
|
||||||
|
|
||||||
# Test for the banned test element
|
# Test for the banned test element
|
||||||
_do_test("tests/resources/markup/markuptester/bad_banned.xml",
|
_do_test("tests/resources/markup/markuptester/bad_banned.xml", True)
|
||||||
True)
|
|
||||||
|
|
||||||
result = _do_test("tests/resources/markup/markuptester/bad.xml",
|
result = _do_test("tests/resources/markup/markuptester/bad.xml", True)
|
||||||
True)
|
|
||||||
assert result.warnings
|
assert result.warnings
|
||||||
result = _do_test("tests/resources/markup/markuptester/"
|
result = _do_test("tests/resources/markup/markuptester/bad_script.xml",
|
||||||
"bad_script.xml",
|
|
||||||
False)
|
False)
|
||||||
assert result.infos
|
assert result.infos
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import typedetection
|
import validator.typedetection as typedetection
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
def _do_test(url, failure=True):
|
def _do_test(url, failure=True):
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import testcases
|
import validator.testcases.packagelayout as packagelayout
|
||||||
import testcases.packagelayout as packagelayout
|
from validator.errorbundler import ErrorBundle
|
||||||
from errorbundler import ErrorBundle
|
|
||||||
from helper import _do_test
|
from helper import _do_test
|
||||||
|
|
||||||
def test_blacklisted_files():
|
def test_blacklisted_files():
|
||||||
|
@ -9,7 +8,7 @@ def test_blacklisted_files():
|
||||||
safe."""
|
safe."""
|
||||||
|
|
||||||
_do_test("tests/resources/packagelayout/ext_blacklist.xpi",
|
_do_test("tests/resources/packagelayout/ext_blacklist.xpi",
|
||||||
testcases.packagelayout.test_blacklisted_files,
|
packagelayout.test_blacklisted_files,
|
||||||
True)
|
True)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ import os
|
||||||
|
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
import rdf
|
import validator.rdf as rdf
|
||||||
from rdf import RDFParser
|
from validator.rdf import RDFParser
|
||||||
|
|
||||||
def _load_rdf(file_):
|
def _load_rdf(file_):
|
||||||
"Loads an RDF file into a string."
|
"Loads an RDF file into a string."
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import testcases
|
import validator.testcases.targetapplication as targetapp
|
||||||
import testcases.targetapplication as targetapp
|
from validator.constants import *
|
||||||
from constants import *
|
from validator.errorbundler import ErrorBundle
|
||||||
from errorbundler import ErrorBundle
|
|
||||||
from helper import _do_test
|
from helper import _do_test
|
||||||
|
|
||||||
def test_valid_targetapps():
|
def test_valid_targetapps():
|
||||||
|
@ -88,5 +87,3 @@ def test_is_ff4():
|
||||||
True)
|
True)
|
||||||
|
|
||||||
assert results.get_resource("ff4")
|
assert results.get_resource("ff4")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,21 @@
|
||||||
import testcases
|
import validator.testcases.themes as themes
|
||||||
import testcases.themes
|
from validator.chromemanifest import ChromeManifest
|
||||||
from chromemanifest import ChromeManifest
|
|
||||||
from helper import _do_test
|
from helper import _do_test
|
||||||
|
|
||||||
def test_theme_chrome_manifest():
|
def test_theme_chrome_manifest():
|
||||||
"Tests that a theme has a valid chrome manifest file."
|
"Tests that a theme has a valid chrome manifest file."
|
||||||
|
|
||||||
_do_test("tests/resources/themes/pass.jar",
|
_do_test("tests/resources/themes/pass.jar",
|
||||||
testcases.themes.test_theme_manifest,
|
themes.test_theme_manifest,
|
||||||
False)
|
False)
|
||||||
|
|
||||||
def test_theme_bad_chrome_manifest():
|
def test_theme_bad_chrome_manifest():
|
||||||
"Tests that a theme has an invalid chrome manifest file."
|
"Tests that a theme has an invalid chrome manifest file."
|
||||||
|
|
||||||
_do_test("tests/resources/themes/fail.jar",
|
_do_test("tests/resources/themes/fail.jar",
|
||||||
testcases.themes.test_theme_manifest)
|
themes.test_theme_manifest)
|
||||||
|
|
||||||
def test_no_chrome_manifest():
|
def test_no_chrome_manifest():
|
||||||
"Tests that validation is skipped if there is no chrome manifest."
|
"Tests that validation is skipped if there is no chrome manifest."
|
||||||
|
|
||||||
assert testcases.themes.test_theme_manifest(None, {}, None) is None
|
assert themes.test_theme_manifest(None, {}, None) is None
|
|
@ -1,10 +1,10 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from errorbundler import ErrorBundle
|
from validator.errorbundler import ErrorBundle
|
||||||
from rdf import RDFParser
|
from validator.rdf import RDFParser
|
||||||
from xpi import XPIManager
|
from validator.xpi import XPIManager
|
||||||
from constants import *
|
from validator.constants import *
|
||||||
import typedetection
|
import validator.typedetection as typedetection
|
||||||
|
|
||||||
def _test_type(file_, expectation, failure=False):
|
def _test_type(file_, expectation, failure=False):
|
||||||
"Tests a file against the expectations"
|
"Tests a file against the expectations"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import zipfile
|
import zipfile
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
|
||||||
from xpi import XPIManager
|
from validator.xpi import XPIManager
|
||||||
|
|
||||||
def test_open():
|
def test_open():
|
||||||
"Test that the manager will open the package"
|
"Test that the manager will open the package"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче