This is the one.

This commit is contained in:
zkldi
2021-04-18 03:08:05 +01:00
parent 870aa5840a
commit fc62580696
7 changed files with 49 additions and 6 deletions
+28
View File
@@ -0,0 +1,28 @@
import mockApi from "./mock-api";
import assert from "assert";
import db from "../db/db";
import ResetDBState from "./reset-db-state";
import CreateLogCtx from "../logger";
const logger = CreateLogCtx("fake-session.ts");
export async function CreateFakeAuthCookie() {
await ResetDBState();
// possible security issue, ask hazel
let res = await mockApi.post("/internal-api/auth/login").send({
username: "test_zkldi",
password: "password",
captcha: "asdf",
});
if (res.status !== 200) {
logger.crit("Failed to login. Cannot generate auth cookie.");
throw res.body;
}
return res.headers["set-cookie"] as string[];
}
export async function DestroyFakeAuthToken(cookie: string) {
// stub
}
+3 -3
View File
@@ -1,8 +1,8 @@
[
{
"username": "zkldi",
"usernameLowercase": "zkldi",
"password": "$2y$12$u2FK6QJAv/WDF/ExGUWI9OoIks8Q0ExT1qjPMBu6zCZ5z72swQ01K",
"username": "test_zkldi",
"usernameLowercase": "test_zkldi",
"password": "$2b$12$QRFCAxvFoNI2spszFPgt/e.qLy55GvYWlSHioa0AujRbFpChLwHmu",
"email": "thepasswordis@password.com",
"id": 1,
"settings": {