mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 11:37:02 -04:00
test: use constant credentials
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
4ade25036e
commit
4271ef740c
2 changed files with 20 additions and 7 deletions
|
@ -9,7 +9,14 @@ import { User } from 'src/users/user.entity';
|
||||||
import request from 'supertest';
|
import request from 'supertest';
|
||||||
|
|
||||||
import { ConsoleLoggerService } from '../../src/logger/console-logger.service';
|
import { ConsoleLoggerService } from '../../src/logger/console-logger.service';
|
||||||
import { TestSetup, TestSetupBuilder } from '../test-setup';
|
import {
|
||||||
|
password1,
|
||||||
|
password2,
|
||||||
|
TestSetup,
|
||||||
|
TestSetupBuilder,
|
||||||
|
username1,
|
||||||
|
username2,
|
||||||
|
} from '../test-setup';
|
||||||
import { ensureDeleted } from '../utils';
|
import { ensureDeleted } from '../utils';
|
||||||
|
|
||||||
describe('Media', () => {
|
describe('Media', () => {
|
||||||
|
@ -44,7 +51,7 @@ describe('Media', () => {
|
||||||
agent = request.agent(testSetup.app.getHttpServer());
|
agent = request.agent(testSetup.app.getHttpServer());
|
||||||
await agent
|
await agent
|
||||||
.post('/api/private/auth/local/login')
|
.post('/api/private/auth/local/login')
|
||||||
.send({ username: 'testuser1', password: 'testuser1' })
|
.send({ username: username1, password: password1 })
|
||||||
.expect(201);
|
.expect(201);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -135,7 +142,7 @@ describe('Media', () => {
|
||||||
const agent2 = request.agent(testSetup.app.getHttpServer());
|
const agent2 = request.agent(testSetup.app.getHttpServer());
|
||||||
await agent2
|
await agent2
|
||||||
.post('/api/private/auth/local/login')
|
.post('/api/private/auth/local/login')
|
||||||
.send({ username: 'testuser2', password: 'testuser2' })
|
.send({ username: username2, password: password2 })
|
||||||
.expect(201);
|
.expect(201);
|
||||||
|
|
||||||
// try to delete upload with second user
|
// try to delete upload with second user
|
||||||
|
|
|
@ -5,8 +5,14 @@
|
||||||
*/
|
*/
|
||||||
import request from 'supertest';
|
import request from 'supertest';
|
||||||
|
|
||||||
import { User } from '../../src/users/user.entity';
|
import {
|
||||||
import { TestSetup, TestSetupBuilder } from '../test-setup';
|
password1,
|
||||||
|
password2,
|
||||||
|
TestSetup,
|
||||||
|
TestSetupBuilder,
|
||||||
|
username1,
|
||||||
|
username2,
|
||||||
|
} from '../test-setup';
|
||||||
|
|
||||||
describe('Tokens', () => {
|
describe('Tokens', () => {
|
||||||
let testSetup: TestSetup;
|
let testSetup: TestSetup;
|
||||||
|
@ -21,7 +27,7 @@ describe('Tokens', () => {
|
||||||
agent = request.agent(testSetup.app.getHttpServer());
|
agent = request.agent(testSetup.app.getHttpServer());
|
||||||
await agent
|
await agent
|
||||||
.post('/api/private/auth/local/login')
|
.post('/api/private/auth/local/login')
|
||||||
.send({ username: 'testuser1', password: 'testuser1' })
|
.send({ username: username1, password: password1 })
|
||||||
.expect(201);
|
.expect(201);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -66,7 +72,7 @@ describe('Tokens', () => {
|
||||||
const agent2 = request.agent(testSetup.app.getHttpServer());
|
const agent2 = request.agent(testSetup.app.getHttpServer());
|
||||||
await agent2
|
await agent2
|
||||||
.post('/api/private/auth/local/login')
|
.post('/api/private/auth/local/login')
|
||||||
.send({ username: 'testuser2', password: 'testuser2' })
|
.send({ username: username2, password: password2 })
|
||||||
.expect(201);
|
.expect(201);
|
||||||
let response = await agent2
|
let response = await agent2
|
||||||
.delete('/api/private/tokens/' + keyId)
|
.delete('/api/private/tokens/' + keyId)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue