post test
This commit is contained in:
parent
eacb94bfa5
commit
8ea756921d
4 changed files with 49 additions and 3 deletions
|
@ -62,7 +62,7 @@ async function postTester(url) {
|
|||
}
|
||||
if (typeof expData == "object" && expData != null) {
|
||||
if (!shallowEqual(expData, resp.data)) {
|
||||
console.error(`Expected data: '${expData}', but got: '${resp.data}'`);
|
||||
console.error(`Expected data: '${JSON.stringify(expData, null, 2)}', but got: '${JSON.stringify(resp.data, null, 2)}'`);
|
||||
kill();
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { generateSigningKey, sign } from '../../dist/sys/crypto.js';
|
||||
import { PERMISSIONS } from '../../dist/server/permissions.js';
|
||||
|
||||
let name1 = "testUser1";
|
||||
let name2 = "testUser2";
|
||||
|
@ -88,6 +89,51 @@ const list = [
|
|||
sign: await sign(challenge, privateKey)
|
||||
}, "ok", "");
|
||||
|
||||
}], ["account", async (req) => {
|
||||
await req({
|
||||
"authorization": `Digest name=${name1} server=localhost:7224 accountKey=${accountKey}`
|
||||
}, "getMyAccount", {}, "ok", {
|
||||
rights: PERMISSIONS.ALL,
|
||||
name: name1,
|
||||
viewable: true,
|
||||
maxRooms: 3,
|
||||
maxRoomSize: 10,
|
||||
maxUsersPerRoom: 2,
|
||||
});
|
||||
await req({
|
||||
"authorization": `Digest name=${name2} server=localhost:7224 accountKey=${accountKey}`
|
||||
}, "getMyAccount", {}, "ok", {
|
||||
rights: PERMISSIONS.DEFAULT,
|
||||
name: name2,
|
||||
viewable: true,
|
||||
maxRooms: 3,
|
||||
maxRoomSize: 10,
|
||||
maxUsersPerRoom: 2,
|
||||
});
|
||||
}], ["change account", async (req) => {
|
||||
await req({
|
||||
"authorization": `Digest name=${name2} server=localhost:7224 accountKey=${accountKey}`
|
||||
}, "changePassword", {
|
||||
accountKey: accountKey + "lol"
|
||||
}, "ok", "");
|
||||
await req({}, "signin", {
|
||||
name: name2,
|
||||
server: "localhost:7224",
|
||||
accountKey
|
||||
}, "error", "auth");
|
||||
await req({}, "signin", {
|
||||
name: name2,
|
||||
server: "localhost:7224",
|
||||
accountKey: accountKey + "lol"
|
||||
}, "ok", "");
|
||||
await req({
|
||||
"authorization": `Digest name=${name2} server=localhost:7224 accountKey=${accountKey + "lol"}`
|
||||
}, "deleteAccount", {}, "ok", "");
|
||||
await req({}, "signin", {
|
||||
name: name2,
|
||||
server: "localhost:7224",
|
||||
accountKey: accountKey + "lol"
|
||||
}, "error", "auth");
|
||||
}]
|
||||
];
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ const list = [
|
|||
maxRoomSize: 10,
|
||||
maxUsersPerRoom: 2,
|
||||
});
|
||||
}], ["account", async (handler, req, newHandler) => {
|
||||
}], ["change account", async (handler, req, newHandler) => {
|
||||
await req(handler, "signin", {
|
||||
name: name2,
|
||||
server: "localhost:7224",
|
||||
|
|
|
@ -110,7 +110,7 @@ async function wsTester(url) {
|
|||
}
|
||||
if (typeof expData == "object" && expData != null) {
|
||||
if (!shallowEqual(expData, resp.data)) {
|
||||
console.error(`Expected data: '${expData}', but got: '${resp.data}'`);
|
||||
console.error(`Expected data: '${JSON.stringify(expData, null, 2)}', but got: '${JSON.stringify(resp.data, null, 2)}'`);
|
||||
kill();
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue