Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Flag META-INF directories in packaged apps. (bug 819173)

  • Loading branch information...
commit 05d78453937b2322033cc190b86d49e8db23aa63 1 parent 94b4cfd
@mattbasta authored
View
8 appvalidator/testcases/packagelayout.py
@@ -98,3 +98,11 @@ def test_layout_all(err, package):
description="The package contains multiple entries with the same "
"name. This practice has been banned. Try unzipping "
"and re-zipping your add-on package and try again.")
+
+ if any(name.startswith('META-INF/') for name in package_nameset):
+ err.error(
+ err_id=("testcases_packagelayout", "test_layout_all",
+ "META-INF"),
+ error="Packages must not contain META-INF",
+ description="Packages must not contain a META-INF directory. This "
+ "directory prevents apps from being properly signed.")
View
23 tests/test_packagelayout.py
@@ -4,7 +4,7 @@
import appvalidator.testcases.packagelayout as packagelayout
from appvalidator.errorbundle import ErrorBundle
-from helper import _do_test, MockXPI
+from helper import _do_test, MockXPI, TestCase
def test_blacklisted_files():
@@ -38,6 +38,25 @@ def test_duplicate_files():
package.zf = zf
err = ErrorBundle()
- err.save_resource("has_install_rdf", True)
packagelayout.test_layout_all(err, package)
assert err.failed()
+
+
+class TestMETAINF(TestCase):
+
+ def setUp(self):
+ self.setup_err()
+ self.package = MagicMock()
+ self.package.subpackage = False
+
+ def test_metainf_pass(self):
+ self.package.zf.namelist.return_value = ["META-INF-foo.js"]
+ packagelayout.test_layout_all(self.err, self.package)
+ self.assert_silent()
+
+ def test_metainf_fail(self):
+ """Test that META-INF directories fail validation."""
+
+ self.package.zf.namelist.return_value = ["META-INF/foo.js"]
+ packagelayout.test_layout_all(self.err, self.package)
+ self.assert_failed(with_errors=True)
Please sign in to comment.
Something went wrong with that request. Please try again.