Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Put permissions in the validator output

  • Loading branch information...
commit 77044230e7f2d6ea823330eaacc9b94434cb088a 1 parent 3b10fc1
@mattbasta authored
View
3  appvalidator/errorbundle/manifestmixin.py
@@ -8,5 +8,6 @@ class ManifestMixin(object):
def _extend_json(self):
"""Output the manifest as part of the main JSON blob."""
extension = super(ManifestMixin, self)._extend_json() or {}
- extension.update(manifest=self.get_resource("manifest"))
+ extension.update(manifest=self.get_resource("manifest"),
+ permissions=self.get_resource("permissions"))
return extension
View
5 appvalidator/specs/webapps.py
@@ -476,6 +476,7 @@ def process_orientation(self, node):
self.MORE_INFO])
def process_permissions(self, node):
+ requested_permissions = set()
for permission, per_node in node.items():
if permission not in self.PERMISSIONS_ACCESS:
continue
@@ -506,6 +507,10 @@ def process_permissions(self, node):
"Found value: %s" % access_value,
self.MORE_INFO])
+ requested_permissions.add(permission)
+
+ self.err.save_resource("permissions", list(requested_permissions))
+
def parse(self, data):
if isinstance(data, types.StringTypes):
return json.loads(data, strict=True)
View
8 tests/test_errorbundle_manifestmixin.py
@@ -19,3 +19,11 @@ def test_manifest_unicode(self):
results = self.get_json_results()
assert "manifest" in results, results.keys()
eq_(results["manifest"]["foo"], u"bär")
+
+ def test_permissions(self):
+ perms = ["alarms", "systemXHR"]
+ self.err.save_resource("permissions", perms)
+
+ results = self.get_json_results()
+ assert "permissions" in results, results.keys()
+ eq_(results["permissions"], perms)
Please sign in to comment.
Something went wrong with that request. Please try again.