mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
test: since admin pwd changes in test, login with new pwd
This commit is contained in:
@@ -23,7 +23,7 @@ put:
|
|||||||
example: '123456'
|
example: '123456'
|
||||||
newPassword:
|
newPassword:
|
||||||
type: string
|
type: string
|
||||||
example: '123456'
|
example: '654321'
|
||||||
required:
|
required:
|
||||||
- newPassword
|
- newPassword
|
||||||
responses:
|
responses:
|
||||||
|
|||||||
11
test/api.js
11
test/api.js
@@ -562,8 +562,15 @@ describe('API', async () => {
|
|||||||
const reloginPaths = ['GET /api/user/{userslug}/edit/email', 'PUT /users/{uid}/password', 'DELETE /users/{uid}/sessions/{uuid}'];
|
const reloginPaths = ['GET /api/user/{userslug}/edit/email', 'PUT /users/{uid}/password', 'DELETE /users/{uid}/sessions/{uuid}'];
|
||||||
if (reloginPaths.includes(`${method.toUpperCase()} ${path}`)) {
|
if (reloginPaths.includes(`${method.toUpperCase()} ${path}`)) {
|
||||||
({ jar } = await helpers.loginUser('admin', '123456'));
|
({ jar } = await helpers.loginUser('admin', '123456'));
|
||||||
const sessionIds = await db.getSortedSetRange('uid:1:sessions', 0, -1);
|
let sessionIds = await db.getSortedSetRange('uid:1:sessions', 0, -1);
|
||||||
const sessObj = await db.sessionStoreGet(sessionIds[0]);
|
let sessObj = await db.sessionStoreGet(sessionIds[0]);
|
||||||
|
if (!sessObj) {
|
||||||
|
// password changed so login with new pwd
|
||||||
|
({ jar } = await helpers.loginUser('admin', '654321'));
|
||||||
|
sessionIds = await db.getSortedSetRange('uid:1:sessions', 0, -1);
|
||||||
|
sessObj = await db.sessionStoreGet(sessionIds[0]);
|
||||||
|
}
|
||||||
|
|
||||||
const { uuid } = sessObj.meta;
|
const { uuid } = sessObj.meta;
|
||||||
mocks.delete['/users/{uid}/sessions/{uuid}'][1].example = uuid;
|
mocks.delete['/users/{uid}/sessions/{uuid}'][1].example = uuid;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user