All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 50s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
19 lines
547 B
TypeScript
19 lines
547 B
TypeScript
import { createUser, get, test } from "../helpers.ts";
|
|
import { assertEquals } from "@std/assert";
|
|
|
|
test("required auth: missing, malformed and forged tokens are 401", async () => {
|
|
assertEquals((await get("/api/users/me")).status, 401);
|
|
assertEquals(
|
|
(await get("/api/users/me", { headers: { Authorization: "Token x" } }))
|
|
.status,
|
|
401,
|
|
);
|
|
const media = (await createUser()).mediaToken;
|
|
assertEquals(
|
|
(await get("/api/users/me", {
|
|
headers: { Authorization: `Bearer ${media}` },
|
|
})).status,
|
|
401,
|
|
);
|
|
});
|