From df2b010feeb5224551c81628e51d3350ce599814 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sat, 26 Sep 2026 15:13:11 +0200 Subject: [PATCH] Test that a trust file of the wrong shape is reported as unreadable --- bin/test_loop_claude.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/test_loop_claude.py b/bin/test_loop_claude.py index ac03aafc..783b5357 100644 --- a/bin/test_loop_claude.py +++ b/bin/test_loop_claude.py @@ -223,6 +223,12 @@ class Trust(unittest.TestCase): with contextlib.redirect_stderr(io.StringIO()) as err: loop.trust(["/a"]) self.assertIn(f"could not read {config}: ", err.getvalue()) + for shape in ([], {"projects": []}, {"projects": {"/a": 1}}): + 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(json.loads(config.read_text()), shape) data = {"other": 1, "projects": {"/a": {"hasTrustDialogAccepted": True, "kept": 2}}} config.write_text(json.dumps(data)) with contextlib.redirect_stderr(io.StringIO()) as err: