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

This commit is contained in:
Matt Basta 2013-01-15 12:19:49 -08:00
Родитель 0920b5eab4
Коммит a95da3bcf0
2 изменённых файлов: 38 добавлений и 1 удалений

Просмотреть файл

@ -371,6 +371,15 @@ class WebappSpec(Spec):
"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):

Просмотреть файл

@ -94,13 +94,19 @@ class TestWebapps(TestCase):
],
"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 @@ class TestWebapps(TestCase):
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 @@ class TestWebapps(TestCase):
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."""