]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/api/check-params/debug.ts
Add transcoding module comments
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / debug.ts
CommitLineData
a1587156 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
5d79474c
C
2
3import 'mocha'
4
5import {
a1587156 6 cleanupTests,
5d79474c 7 createUser,
210feb6c 8 flushAndRunServer,
5d79474c
C
9 ServerInfo,
10 setAccessTokensToServers,
a1587156 11 userLogin
94565d52
C
12} from '../../../../shared/extra-utils'
13import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests'
5d79474c
C
14
15describe('Test debug API validators', function () {
16 const path = '/api/v1/server/debug'
17 let server: ServerInfo
18 let userAccessToken = ''
19
20 // ---------------------------------------------------------------
21
22 before(async function () {
23 this.timeout(120000)
24
210feb6c 25 server = await flushAndRunServer(1)
5d79474c
C
26
27 await setAccessTokensToServers([ server ])
28
29 const user = {
30 username: 'user1',
31 password: 'my super password'
32 }
1eddc9a7 33 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
5d79474c
C
34 userAccessToken = await userLogin(server, user)
35 })
36
37 describe('When getting debug endpoint', function () {
38
39 it('Should fail with a non authenticated user', async function () {
40 await makeGetRequest({
41 url: server.url,
42 path,
43 statusCodeExpected: 401
44 })
45 })
46
47 it('Should fail with a non admin user', async function () {
48 await makeGetRequest({
49 url: server.url,
50 path,
51 token: userAccessToken,
52 statusCodeExpected: 403
53 })
54 })
55
56 it('Should succeed with the correct params', async function () {
57 await makeGetRequest({
58 url: server.url,
59 path,
60 token: server.accessToken,
61 query: { startDate: new Date().toISOString() },
62 statusCodeExpected: 200
63 })
64 })
65 })
66
7c3b7976
C
67 after(async function () {
68 await cleanupTests([ server ])
5d79474c
C
69 })
70})