fix(legacy): keep static shell available during migration

This commit is contained in:
leefer
2026-07-30 20:27:57 +08:00
parent 7e1bc48ee0
commit c3598820ef
4 changed files with 32 additions and 5 deletions
+16
View File
@@ -281,6 +281,22 @@ class PublicKnowledgePermissionTests(unittest.TestCase):
self.handler("/api/heaven/sector-phases/%E6%B2%B9%E6%B0%94", "send_json")
)
def test_static_shell_bypasses_the_api_access_registry(self):
handler = RequestHandler.__new__(RequestHandler)
handler.path = "/"
handler.require_auth = lambda: (_ for _ in ()).throw(
AssertionError("static request required authentication")
)
handler.require_access = lambda *_: (_ for _ in ()).throw(
AssertionError("static request entered the API registry")
)
served: list[str] = []
handler.serve_static = served.append
RequestHandler.do_GET(handler)
self.assertEqual(served, ["/"])
if __name__ == "__main__":
unittest.main()