Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make sure that we require the right type for apps of status (bug 830662)

  • Loading branch information...
commit a95da3bcf034151a6c1407100ece183762f26d7a 1 parent 0920b5e
@mattbasta authored
Showing with 38 additions and 1 deletion.
  1. +9 −0 appvalidator/specs/webapps.py
  2. +29 −1 tests/test_webapp.py
View
9 appvalidator/specs/webapps.py
@@ -371,6 +371,15 @@ def process_type(self, node):
"the Firefox Marketplace.",
self.MORE_INFO])
+ if not self.err.get_resource("packaged") and node != "web":
+ self.err.error(
+ err_id=("spec", "webapp", "type_denied_web"),
+ error="Web apps may not be privileged.",
+ description=["Web apps may not have a `type` of `privileged` "
+ "or `certified`.",
+ "Detected type: %s" % node,
+ self.MORE_INFO])
+
def process_act_href(self, node):
if not self._path_valid(node, can_be_absolute=True,
can_be_relative=True):
View
30 tests/test_webapp.py
@@ -94,13 +94,19 @@ def setUp(self):
],
"orientation": "landscape",
"fullscreen": "true",
- "type": "privileged",
+ "type": "web",
}
+ self.resources = []
+
def analyze(self):
"""Run the webapp tests on the file."""
self.detected_type = appvalidator.constants.PACKAGE_WEBAPP
self.setup_err()
+
+ for resource, value in self.resources:
+ self.err.save_resource(resource, value)
+
with tempfile.NamedTemporaryFile(delete=False) as t:
if isinstance(self.data, types.StringTypes):
t.write(self.data)
@@ -535,6 +541,7 @@ def test_type_valid(self):
def wrap(self, value):
self.setUp()
+ self.resources.append(("packaged", value != "web"))
self.data["type"] = value
self.analyze()
self.assert_silent()
@@ -549,6 +556,27 @@ def test_type_not_certified(self):
self.analyze()
self.assert_failed(with_errors=True)
+ def test_type_web_priv_fail(self):
+ """Test that web apps cannot be privileged or certified."""
+ self.data["type"] = "privileged"
+ self.resources.append(("packaged", False))
+ self.analyze()
+ self.assert_failed(with_errors=True)
+
+ def test_type_web_priv_fail(self):
+ """Test that web apps cannot be privileged or certified."""
+ self.data["type"] = "web"
+ self.resources.append(("packaged", False))
+ self.analyze()
+ self.assert_silent()
+
+ def test_type_packaged_priv_fail(self):
+ """Test that web apps cannot be privileged or certified."""
+ self.data["type"] = "privileged"
+ self.resources.append(("packaged", True))
+ self.analyze()
+ self.assert_silent()
+
def test_act_base(self):
"""Test that the most basic web activity passes."""
Please sign in to comment.
Something went wrong with that request. Please try again.