add auth check

This commit is contained in:
2026-08-03 11:16:49 +08:00
parent 6330b99860
commit 92780cedef
18 changed files with 381 additions and 242 deletions
+3 -1
View File
@@ -121,6 +121,7 @@ test("existing two-step client flow uploads, lists, and downloads a file", async
});
const downloaded = await fetch(download.url);
assert.equal(await downloaded.text(), "time,pressure\n0,10\n");
assert.equal((await fetch(download.url)).status, 403);
});
test("admin lists, downloads, and deletes only the selected device control data", async () => {
@@ -159,8 +160,9 @@ test("admin lists, downloads, and deletes only the selected device control data"
});
assert.equal(download.success, true);
assert.equal(download.size, Buffer.byteLength('{"parts":1}'));
assert.match(download.url, /expires=.*token=/);
assert.match(download.url, /\/downloads\//);
assert.equal(await (await fetch(download.url)).text(), '{"parts":1}');
assert.equal((await fetch(download.url)).status, 403);
const forbiddenDelete = await post({
type: "deleteControlFile", fileID: "model://control-co/line-1/controller.bin", adminToken: "test-token"