Quote the projects key in the wrong-shape message and record the one-message decline
This commit was merged in pull request #66.
This commit is contained in:
+1
-1
@@ -417,7 +417,7 @@ def trust(paths):
|
||||
return
|
||||
projects = data.setdefault("projects", {}) if isinstance(data, dict) else None
|
||||
if not isinstance(projects, dict) or not all(isinstance(record, dict) for record in projects.values()):
|
||||
print(f"could not read {config}: not an object whose projects maps paths to objects", file=sys.stderr)
|
||||
print(f"could not read {config}: not an object whose \"projects\" maps paths to objects", file=sys.stderr)
|
||||
return
|
||||
granted = [path for path in paths if not projects.get(path, {}).get("hasTrustDialogAccepted")]
|
||||
if not granted:
|
||||
|
||||
@@ -227,7 +227,7 @@ class Trust(unittest.TestCase):
|
||||
config.write_text(json.dumps(shape))
|
||||
with contextlib.redirect_stderr(io.StringIO()) as err:
|
||||
loop.trust(["/a"])
|
||||
self.assertEqual(err.getvalue(), f"could not read {config}: not an object whose projects maps paths to objects\n")
|
||||
self.assertEqual(err.getvalue(), f"could not read {config}: not an object whose \"projects\" maps paths to objects\n")
|
||||
self.assertEqual(json.loads(config.read_text()), shape)
|
||||
data = {"other": 1, "projects": {"/a": {"hasTrustDialogAccepted": True, "kept": 2}}}
|
||||
config.write_text(json.dumps(data))
|
||||
|
||||
Reference in New Issue
Block a user