diff --git a/tests/helper.py b/tests/helper.py
index f538779..9d4f9f2 100644
--- a/tests/helper.py
+++ b/tests/helper.py
@@ -1,8 +1,8 @@
import os
-from rdf import RDFParser
-from xpi import XPIManager
-from errorbundler import ErrorBundle
+from validator.rdf import RDFParser
+from validator.xpi import XPIManager
+from validator.errorbundler import ErrorBundle
def _do_test(path, test, failure=True,
require_install=False, set_type=0):
diff --git a/tests/test_chromemanifest.py b/tests/test_chromemanifest.py
index e8c37b0..8a948b1 100644
--- a/tests/test_chromemanifest.py
+++ b/tests/test_chromemanifest.py
@@ -1,7 +1,7 @@
import unittest
import os
-from chromemanifest import ChromeManifest
+from validator.chromemanifest import ChromeManifest
def test_open():
"Open a chrome file and ensure that data can be pulled from it."
diff --git a/tests/test_conduit.py b/tests/test_conduit.py
index dc422b9..ac46758 100644
--- a/tests/test_conduit.py
+++ b/tests/test_conduit.py
@@ -1,19 +1,19 @@
import os
-import decorator
-import testcases
-import testcases.conduit
-from errorbundler import ErrorBundle
-from xpi import XPIManager
-from rdf import RDFParser
+import validator.decorator as decorator
+import validator.testcases as testcases
+import validator.testcases.conduit as conduit
+from validator.errorbundler import ErrorBundle
+from validator.xpi import XPIManager
+from validator.rdf import RDFParser
from helper import _do_test
-from constants import *
+from validator.constants import *
def test_outright():
"Tests the Conduit detector against an outright toolbar."
_do_test("tests/resources/conduit/basta_bar.xpi",
- testcases.conduit.test_conduittoolbar,
+ conduit.test_conduittoolbar,
failure=True,
require_install=True,
set_type=PACKAGE_EXTENSION)
@@ -22,7 +22,7 @@ def test_white():
"Tests a non-Conduit addon against the library."
_do_test("tests/resources/conduit/pass.xpi",
- testcases.conduit.test_conduittoolbar,
+ conduit.test_conduittoolbar,
failure=False,
require_install=True,
set_type=PACKAGE_EXTENSION)
@@ -32,7 +32,7 @@ def test_params():
the install.rdf file that indiciate Conduit-ion."""
_do_test("tests/resources/conduit/conduit_params.xpi",
- testcases.conduit.test_conduittoolbar,
+ conduit.test_conduittoolbar,
failure=True,
require_install=True,
set_type=PACKAGE_EXTENSION)
@@ -42,7 +42,7 @@ def test_updateurl():
parameter set to that of a Conduit Toolbar's."""
_do_test("tests/resources/conduit/conduit_updateurl.xpi",
- testcases.conduit.test_conduittoolbar,
+ conduit.test_conduittoolbar,
failure=True,
require_install=True,
set_type=PACKAGE_EXTENSION)
@@ -52,7 +52,7 @@ def test_structure():
folders which resemble those of a Conduit toolbar."""
_do_test("tests/resources/conduit/conduit_structure.xpi",
- testcases.conduit.test_conduittoolbar,
+ conduit.test_conduittoolbar,
failure=True,
require_install=True,
set_type=PACKAGE_EXTENSION)
@@ -62,7 +62,7 @@ def test_chrome():
chrome.manifest entries that indicate a Conduit toolbar."""
_do_test("tests/resources/conduit/conduit_chrome.xpi",
- testcases.conduit.test_conduittoolbar,
+ conduit.test_conduittoolbar,
failure=True,
require_install=True,
set_type=PACKAGE_EXTENSION)
diff --git a/tests/test_content.py b/tests/test_content.py
index 44dfae4..95bd1af 100644
--- a/tests/test_content.py
+++ b/tests/test_content.py
@@ -2,11 +2,11 @@ import os
from StringIO import StringIO
-import xpi
-import testcases.content as content
-from errorbundler import ErrorBundle
+import validator.xpi as xpi
+import validator.testcases.content as content
+from validator.errorbundler import ErrorBundle
from helper import _do_test
-from constants import *
+from validator.constants import *
def test_ignore_macstuff():
"Tests that the content manager will ignore Mac-generated files"
diff --git a/tests/test_decorator.py b/tests/test_decorator.py
index 07ae26e..570e2d6 100644
--- a/tests/test_decorator.py
+++ b/tests/test_decorator.py
@@ -1,4 +1,4 @@
-import decorator
+import validator.decorator as decorator
def test_tiers():
"""Tests to make sure that the decorator module is properly
diff --git a/tests/test_errorbundler.py b/tests/test_errorbundler.py
index 89fed91..125c311 100644
--- a/tests/test_errorbundler.py
+++ b/tests/test_errorbundler.py
@@ -2,8 +2,8 @@
import json
from StringIO import StringIO
-import errorbundler
-from errorbundler import ErrorBundle
+import validator.errorbundler as errorbundler
+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}
diff --git a/tests/test_installrdf.py b/tests/test_installrdf.py
index ca7a23e..74da7b8 100644
--- a/tests/test_installrdf.py
+++ b/tests/test_installrdf.py
@@ -1,8 +1,8 @@
-import testcases.installrdf
-from errorbundler import ErrorBundle
-from rdf import RDFParser
+import validator.testcases.installrdf as installrdf
+from validator.errorbundler import ErrorBundle
+from validator.rdf import RDFParser
from helper import _do_test
-from constants import *
+from validator.constants import *
def _test_value(value, test, failure=True):
"Tests a value against a test."
@@ -20,40 +20,40 @@ def test_pass_id():
"Tests that valid IDs will be accepted."
_test_value("{12345678-1234-1234-1234-123456789012}",
- testcases.installrdf._test_id,
+ installrdf._test_id,
False)
_test_value("abc@foo.bar",
- testcases.installrdf._test_id,
+ installrdf._test_id,
False)
_test_value("a+bc@foo.bar",
- testcases.installrdf._test_id,
+ installrdf._test_id,
False)
def test_fail_id():
"Tests that invalid IDs will not be accepted."
_test_value("{1234567-1234-1234-1234-123456789012}",
- testcases.installrdf._test_id)
+ installrdf._test_id)
_test_value("!@foo.bar",
- testcases.installrdf._test_id)
+ installrdf._test_id)
def test_pass_version():
"Tests that valid versions will be accepted."
_test_value("1.2.3.4",
- testcases.installrdf._test_version,
+ installrdf._test_version,
False)
_test_value("1a.2+.3b",
- testcases.installrdf._test_version,
+ installrdf._test_version,
False)
def test_fail_version():
"Tests that invalid versions will not be accepted."
_test_value("2.0 alpha",
- testcases.installrdf._test_version)
+ installrdf._test_version)
_test_value("whatever",
- testcases.installrdf._test_version)
+ installrdf._test_version)
def _run_test(filename, failure=True):
"Runs a test on an install.rdf file"
@@ -65,7 +65,7 @@ def _run_test(filename, failure=True):
file_.close()
parser = RDFParser(data)
- testcases.installrdf._test_rdf(err, parser)
+ installrdf._test_rdf(err, parser)
if failure: # pragma: no cover
assert err.failed()
diff --git a/tests/test_l10n.py b/tests/test_l10n.py
index 9a9bfb4..2c7e119 100644
--- a/tests/test_l10n.py
+++ b/tests/test_l10n.py
@@ -1,7 +1,7 @@
-import testcases.l10ncompleteness as l10n
-from errorbundler import ErrorBundle
+import validator.testcases.l10ncompleteness as l10n
+from validator.errorbundler import ErrorBundle
from helper import _do_test
-from constants import *
+from validator.constants import *
def test_pass():
"Test a package with localization that should pass validation."
diff --git a/tests/test_l10n_dtd.py b/tests/test_l10n_dtd.py
index 1f90db4..a76c28b 100644
--- a/tests/test_l10n_dtd.py
+++ b/tests/test_l10n_dtd.py
@@ -2,7 +2,7 @@ import os
from StringIO import StringIO
-import testcases.l10n.dtd as dtd
+import validator.testcases.l10n.dtd as dtd
def test_passing_file():
"Tests a valid DTD file by passing in a file path."
diff --git a/tests/test_l10n_langpack.py b/tests/test_l10n_langpack.py
index 9643778..a019c6d 100644
--- a/tests/test_l10n_langpack.py
+++ b/tests/test_l10n_langpack.py
@@ -1,10 +1,10 @@
-import testcases.l10ncompleteness as l10n
-from testcases.l10n.dtd import DTDParser
-from testcases.l10n.properties import PropertiesParser
-from xpi import XPIManager
-from errorbundler import ErrorBundle
+import validator.testcases.l10ncompleteness as l10n
+from validator.testcases.l10n.dtd import DTDParser
+from validator.testcases.l10n.properties import PropertiesParser
+from validator.xpi import XPIManager
+from validator.errorbundler import ErrorBundle
from helper import _do_test
-from constants import *
+from validator.constants import *
def test_chromemanifest():
"Make sure it only accepts packs with chrome.manifest files."
diff --git a/tests/test_l10n_properties.py b/tests/test_l10n_properties.py
index 70fac0e..072731e 100644
--- a/tests/test_l10n_properties.py
+++ b/tests/test_l10n_properties.py
@@ -2,7 +2,7 @@ import os
from StringIO import StringIO
-import testcases.l10n.properties as properties
+import validator.testcases.l10n.properties as properties
def test_passing_file():
"Tests a valid properties file by passing in a file path."
diff --git a/tests/test_langpack.py b/tests/test_langpack.py
index ab9c969..a7254ba 100644
--- a/tests/test_langpack.py
+++ b/tests/test_langpack.py
@@ -1,14 +1,14 @@
-import testcases
-import testcases.langpack
-from chromemanifest import ChromeManifest
-from errorbundler import ErrorBundle
+import validator.testcases as testcases
+import validator.testcases.langpack as langpack
+from validator.chromemanifest import ChromeManifest
+from validator.errorbundler import ErrorBundle
from helper import _do_test
def test_langpack_valid():
"Tests that a language pack has a valid chrome manifest file."
_do_test("tests/resources/langpack/pass.xpi",
- testcases.langpack.test_langpack_manifest,
+ langpack.test_langpack_manifest,
False)
def test_langpack_bad_subject():
@@ -16,28 +16,28 @@ def test_langpack_bad_subject():
chrome.manifest file."""
_do_test("tests/resources/langpack/fail.xpi",
- testcases.langpack.test_langpack_manifest)
+ langpack.test_langpack_manifest)
def test_langpack_bad_uri_pred():
"""Tests that a language pack has an invalid URI specified for its
'override' predicates."""
_do_test("tests/resources/langpack/fail_uri_pred.xpi",
- testcases.langpack.test_langpack_manifest)
+ langpack.test_langpack_manifest)
def test_langpack_bad_uri_obj():
"""Tests that a language pack has an invalid URI specified for its
'override' objects."""
_do_test("tests/resources/langpack/fail_uri_obj.xpi",
- testcases.langpack.test_langpack_manifest)
+ langpack.test_langpack_manifest)
def test_unsafe_html():
"Tests for unsafe HTML in obstract files."
err = ErrorBundle(None, True)
- testcases.langpack.test_unsafe_html(err, None, """
+ langpack.test_unsafe_html(err, None, """
This is an innocent file.
Nothing to suspect here.
@@ -45,13 +45,13 @@ def test_unsafe_html():
assert not err.failed()
- testcases.langpack.test_unsafe_html(err, "asdf", """
+ langpack.test_unsafe_html(err, "asdf", """
This is not an file.""")
assert err.failed()
err = ErrorBundle(None, True)
- testcases.langpack.test_unsafe_html(err, "asdf", """
+ langpack.test_unsafe_html(err, "asdf", """
Nothing to suspect here.""")
assert err.failed()
@@ -61,6 +61,6 @@ def test_has_chrome_manifest():
"""Makes sure the module fails when a chrome.manifest file is not
available."""
- assert testcases.langpack.test_langpack_manifest(None,
- {},
- None) is None
+ assert langpack.test_langpack_manifest(None,
+ {},
+ None) is None
diff --git a/tests/test_libraryblacklist.py b/tests/test_libraryblacklist.py
index 05f9c61..3a69598 100644
--- a/tests/test_libraryblacklist.py
+++ b/tests/test_libraryblacklist.py
@@ -1,11 +1,9 @@
import os
-import decorator
-import testcases
-import testcases.library_blacklist
-from errorbundler import ErrorBundle
-from xpi import XPIManager
-from rdf import RDFParser
+import validator.testcases.library_blacklist as libblacklist
+from validator.errorbundler import ErrorBundle
+from validator.xpi import XPIManager
+from validator.rdf import RDFParser
def test_blacklisted_files():
@@ -18,9 +16,9 @@ def test_blacklisted_files():
contents = package.get_file_data()
err = ErrorBundle(None, True)
- testcases.library_blacklist.test_library_blacklist(err,
- contents,
- package)
+ libblacklist.test_library_blacklist(err,
+ contents,
+ package)
err.print_summary()
diff --git a/tests/test_markup_csstester.py b/tests/test_markup_csstester.py
index 5d75f4d..9b45089 100644
--- a/tests/test_markup_csstester.py
+++ b/tests/test_markup_csstester.py
@@ -1,7 +1,5 @@
-import testcases
-import testcases.markup
-import testcases.markup.csstester
-from errorbundler import ErrorBundle
+import validator.testcases.markup.csstester as csstester
+from validator.errorbundler import ErrorBundle
def _do_test(path, should_fail=False):
@@ -11,7 +9,7 @@ def _do_test(path, should_fail=False):
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()
diff --git a/tests/test_markup_markuptester.py b/tests/test_markup_markuptester.py
index 1da8753..d5d6246 100644
--- a/tests/test_markup_markuptester.py
+++ b/tests/test_markup_markuptester.py
@@ -1,6 +1,6 @@
-import testcases.markup.markuptester
-from errorbundler import ErrorBundle
-from constants import *
+import validator.testcases.markup.markuptester as markuptester
+from validator.errorbundler import ErrorBundle
+from validator.constants import *
def _do_test(path, should_fail=False, type_=None):
@@ -15,7 +15,7 @@ def _do_test(path, should_fail=False, type_=None):
if type_:
err.set_type(type_)
- parser = testcases.markup.markuptester.MarkupParser(err, True)
+ parser = markuptester.MarkupParser(err, True)
parser.process(filename, data, extension)
err.print_summary(True)
@@ -32,7 +32,7 @@ def test_local_url_detector():
"Tests that local URLs can be detected."
err = ErrorBundle(None, True)
- mp = testcases.markup.markuptester.MarkupParser(err)
+ mp = markuptester.MarkupParser(err)
tester = mp._is_url_local
assert tester("chrome://xyz/content/abc")
@@ -60,91 +60,73 @@ def test_xul_file():
def test_xml_bad_nesting():
"Tests an XML file that has badly nested elements."
- _do_test("tests/resources/markup/markuptester/bad_nesting.xml",
- True)
+ _do_test("tests/resources/markup/markuptester/bad_nesting.xml", True)
def test_xml_overclosing():
"Tests an XML file that has overclosed elements"
- _do_test("tests/resources/markup/markuptester/overclose.xml",
- True)
+ _do_test("tests/resources/markup/markuptester/overclose.xml", True)
def test_xml_extraclosing():
"Tests an XML file that has extraclosed elements"
- _do_test("tests/resources/markup/markuptester/extraclose.xml",
- True)
+ _do_test("tests/resources/markup/markuptester/extraclose.xml", True)
def test_html_ignore_comment():
"Tests that HTML comment values are ignored"
- _do_test(
- "tests/resources/markup/markuptester/ignore_comments.html")
+ _do_test("tests/resources/markup/markuptester/ignore_comments.html")
def test_html_css_style():
"Tests that CSS within an element is passed to the CSS tester"
- _do_test("tests/resources/markup/markuptester/css_style.html",
- True)
+ _do_test("tests/resources/markup/markuptester/css_style.html", True)
def test_html_css_inline():
"Tests that inline CSS is passed to the CSS tester"
- _do_test("tests/resources/markup/markuptester/css_inline.html",
- True)
+ _do_test("tests/resources/markup/markuptester/css_inline.html", True)
def test_xul_evil():
"Tests for evil kinds of scripts and iframes in XUL."
- _do_test(
- "tests/resources/markup/markuptester/remote_src.xul", True)
+ _do_test("tests/resources/markup/markuptester/remote_src.xul", True)
- _do_test(
- "tests/resources/markup/markuptester/bad_iframe_remote.xul",
- True)
- _do_test(
- "tests/resources/markup/markuptester/bad_iframe_chrome.xul",
- True)
- _do_test(
- "tests/resources/markup/markuptester/"
- "bad_iframe_remote_missing.xul",
- True)
+ _do_test("tests/resources/markup/markuptester/bad_iframe_remote.xul", True)
+ _do_test("tests/resources/markup/markuptester/bad_iframe_chrome.xul", True)
+ _do_test("tests/resources/markup/markuptester/"
+ "bad_iframe_remote_missing.xul",
+ True)
def test_lp_passing():
"Tests a valid language pack file."
- _do_test(
- "tests/resources/markup/markuptester/_langpack/lp_safe.html",
- False,
- PACKAGE_LANGPACK)
+ _do_test("tests/resources/markup/markuptester/_langpack/lp_safe.html",
+ False,
+ PACKAGE_LANGPACK)
def test_lp_unsafe():
"Tests a language pack file that contains unsafe elements."
- _do_test(
- "tests/resources/markup/markuptester/_langpack/lp_unsafe.html",
- True,
- PACKAGE_LANGPACK)
+ _do_test("tests/resources/markup/markuptester/_langpack/lp_unsafe.html",
+ True,
+ PACKAGE_LANGPACK)
def test_lp_remote():
"Tests a language pack file that contains remote references."
- _do_test(
- "tests/resources/markup/markuptester/_langpack/lp_remote.html",
- True,
- PACKAGE_LANGPACK)
+ _do_test("tests/resources/markup/markuptester/_langpack/lp_remote.html",
+ True,
+ PACKAGE_LANGPACK)
def test_invalid_markup():
"Tests an markup file that is simply broken."
# Test for the banned test element
- _do_test("tests/resources/markup/markuptester/bad_banned.xml",
- True)
+ _do_test("tests/resources/markup/markuptester/bad_banned.xml", True)
- result = _do_test("tests/resources/markup/markuptester/bad.xml",
- True)
+ result = _do_test("tests/resources/markup/markuptester/bad.xml", True)
assert result.warnings
- result = _do_test("tests/resources/markup/markuptester/"
- "bad_script.xml",
- False)
+ result = _do_test("tests/resources/markup/markuptester/bad_script.xml",
+ False)
assert result.infos
diff --git a/tests/test_opensearch.py b/tests/test_opensearch.py
index c8b5cc5..4a9f7b6 100644
--- a/tests/test_opensearch.py
+++ b/tests/test_opensearch.py
@@ -1,6 +1,6 @@
import os
-import typedetection
+import validator.typedetection as typedetection
from StringIO import StringIO
def _do_test(url, failure=True):
diff --git a/tests/test_packagelayout.py b/tests/test_packagelayout.py
index 5684da0..21539d5 100644
--- a/tests/test_packagelayout.py
+++ b/tests/test_packagelayout.py
@@ -1,6 +1,5 @@
-import testcases
-import testcases.packagelayout as packagelayout
-from errorbundler import ErrorBundle
+import validator.testcases.packagelayout as packagelayout
+from validator.errorbundler import ErrorBundle
from helper import _do_test
def test_blacklisted_files():
@@ -9,7 +8,7 @@ def test_blacklisted_files():
safe."""
_do_test("tests/resources/packagelayout/ext_blacklist.xpi",
- testcases.packagelayout.test_blacklisted_files,
+ packagelayout.test_blacklisted_files,
True)
diff --git a/tests/test_rdf.py b/tests/test_rdf.py
index 8feb960..7d36d9f 100644
--- a/tests/test_rdf.py
+++ b/tests/test_rdf.py
@@ -2,8 +2,8 @@ import os
from StringIO import StringIO
-import rdf
-from rdf import RDFParser
+import validator.rdf as rdf
+from validator.rdf import RDFParser
def _load_rdf(file_):
"Loads an RDF file into a string."
diff --git a/tests/test_targetapplication.py b/tests/test_targetapplication.py
index df848e9..54a84f5 100644
--- a/tests/test_targetapplication.py
+++ b/tests/test_targetapplication.py
@@ -1,7 +1,6 @@
-import testcases
-import testcases.targetapplication as targetapp
-from constants import *
-from errorbundler import ErrorBundle
+import validator.testcases.targetapplication as targetapp
+from validator.constants import *
+from validator.errorbundler import ErrorBundle
from helper import _do_test
def test_valid_targetapps():
@@ -88,5 +87,3 @@ def test_is_ff4():
True)
assert results.get_resource("ff4")
-
-
diff --git a/tests/test_themes.py b/tests/test_themes.py
index fb86ca1..cd0360a 100644
--- a/tests/test_themes.py
+++ b/tests/test_themes.py
@@ -1,22 +1,21 @@
-import testcases
-import testcases.themes
-from chromemanifest import ChromeManifest
+import validator.testcases.themes as themes
+from validator.chromemanifest import ChromeManifest
from helper import _do_test
def test_theme_chrome_manifest():
"Tests that a theme has a valid chrome manifest file."
_do_test("tests/resources/themes/pass.jar",
- testcases.themes.test_theme_manifest,
+ themes.test_theme_manifest,
False)
def test_theme_bad_chrome_manifest():
"Tests that a theme has an invalid chrome manifest file."
_do_test("tests/resources/themes/fail.jar",
- testcases.themes.test_theme_manifest)
+ themes.test_theme_manifest)
def test_no_chrome_manifest():
"Tests that validation is skipped if there is no chrome manifest."
- assert testcases.themes.test_theme_manifest(None, {}, None) is None
\ No newline at end of file
+ assert themes.test_theme_manifest(None, {}, None) is None
\ No newline at end of file
diff --git a/tests/test_typedetection.py b/tests/test_typedetection.py
index 297e08b..0fb458a 100644
--- a/tests/test_typedetection.py
+++ b/tests/test_typedetection.py
@@ -1,10 +1,10 @@
import os
-from errorbundler import ErrorBundle
-from rdf import RDFParser
-from xpi import XPIManager
-from constants import *
-import typedetection
+from validator.errorbundler import ErrorBundle
+from validator.rdf import RDFParser
+from validator.xpi import XPIManager
+from validator.constants import *
+import validator.typedetection as typedetection
def _test_type(file_, expectation, failure=False):
"Tests a file against the expectations"
diff --git a/tests/test_xpimanager.py b/tests/test_xpimanager.py
index c22873c..fbcf544 100644
--- a/tests/test_xpimanager.py
+++ b/tests/test_xpimanager.py
@@ -1,7 +1,7 @@
import zipfile
from zipfile import ZipFile
-from xpi import XPIManager
+from validator.xpi import XPIManager
def test_open():
"Test that the manager will open the package"