1 /* tslint:disable:no-unused-expression */
11 setAccessTokensToServers,
13 } from '../../../../shared/utils'
14 import { makeGetRequest } from '../../../../shared/utils/requests/requests'
16 describe('Test debug API validators', function () {
17 const path = '/api/v1/server/debug'
18 let server: ServerInfo
19 let userAccessToken = ''
21 // ---------------------------------------------------------------
23 before(async function () {
28 server = await runServer(1)
30 await setAccessTokensToServers([ server ])
34 password: 'my super password'
36 await createUser(server.url, server.accessToken, user.username, user.password)
37 userAccessToken = await userLogin(server, user)
40 describe('When getting debug endpoint', function () {
42 it('Should fail with a non authenticated user', async function () {
43 await makeGetRequest({
46 statusCodeExpected: 401
50 it('Should fail with a non admin user', async function () {
51 await makeGetRequest({
54 token: userAccessToken,
55 statusCodeExpected: 403
59 it('Should succeed with the correct params', async function () {
60 await makeGetRequest({
63 token: server.accessToken,
64 query: { startDate: new Date().toISOString() },
65 statusCodeExpected: 200
70 after(async function () {
71 killallServers([ server ])
73 // Keep the logs if the test failed