diff options
Diffstat (limited to 'server/tests/api/check-params/debug.ts')
-rw-r--r-- | server/tests/api/check-params/debug.ts | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/server/tests/api/check-params/debug.ts b/server/tests/api/check-params/debug.ts index 37bf0f99b..a55786359 100644 --- a/server/tests/api/check-params/debug.ts +++ b/server/tests/api/check-params/debug.ts | |||
@@ -1,21 +1,12 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | 4 | import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' | |
5 | import { | 5 | import { HttpStatusCode } from '@shared/models' |
6 | cleanupTests, | ||
7 | createUser, | ||
8 | flushAndRunServer, | ||
9 | ServerInfo, | ||
10 | setAccessTokensToServers, | ||
11 | userLogin | ||
12 | } from '../../../../shared/extra-utils' | ||
13 | import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' | ||
14 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
15 | 6 | ||
16 | describe('Test debug API validators', function () { | 7 | describe('Test debug API validators', function () { |
17 | const path = '/api/v1/server/debug' | 8 | const path = '/api/v1/server/debug' |
18 | let server: ServerInfo | 9 | let server: PeerTubeServer |
19 | let userAccessToken = '' | 10 | let userAccessToken = '' |
20 | 11 | ||
21 | // --------------------------------------------------------------- | 12 | // --------------------------------------------------------------- |
@@ -23,7 +14,7 @@ describe('Test debug API validators', function () { | |||
23 | before(async function () { | 14 | before(async function () { |
24 | this.timeout(120000) | 15 | this.timeout(120000) |
25 | 16 | ||
26 | server = await flushAndRunServer(1) | 17 | server = await createSingleServer(1) |
27 | 18 | ||
28 | await setAccessTokensToServers([ server ]) | 19 | await setAccessTokensToServers([ server ]) |
29 | 20 | ||
@@ -31,8 +22,8 @@ describe('Test debug API validators', function () { | |||
31 | username: 'user1', | 22 | username: 'user1', |
32 | password: 'my super password' | 23 | password: 'my super password' |
33 | } | 24 | } |
34 | await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) | 25 | await server.users.create({ username: user.username, password: user.password }) |
35 | userAccessToken = await userLogin(server, user) | 26 | userAccessToken = await server.login.getAccessToken(user) |
36 | }) | 27 | }) |
37 | 28 | ||
38 | describe('When getting debug endpoint', function () { | 29 | describe('When getting debug endpoint', function () { |
@@ -41,7 +32,7 @@ describe('Test debug API validators', function () { | |||
41 | await makeGetRequest({ | 32 | await makeGetRequest({ |
42 | url: server.url, | 33 | url: server.url, |
43 | path, | 34 | path, |
44 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 | 35 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
45 | }) | 36 | }) |
46 | }) | 37 | }) |
47 | 38 | ||
@@ -50,7 +41,7 @@ describe('Test debug API validators', function () { | |||
50 | url: server.url, | 41 | url: server.url, |
51 | path, | 42 | path, |
52 | token: userAccessToken, | 43 | token: userAccessToken, |
53 | statusCodeExpected: HttpStatusCode.FORBIDDEN_403 | 44 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
54 | }) | 45 | }) |
55 | }) | 46 | }) |
56 | 47 | ||
@@ -60,7 +51,7 @@ describe('Test debug API validators', function () { | |||
60 | path, | 51 | path, |
61 | token: server.accessToken, | 52 | token: server.accessToken, |
62 | query: { startDate: new Date().toISOString() }, | 53 | query: { startDate: new Date().toISOString() }, |
63 | statusCodeExpected: HttpStatusCode.OK_200 | 54 | expectedStatus: HttpStatusCode.OK_200 |
64 | }) | 55 | }) |
65 | }) | 56 | }) |
66 | }) | 57 | }) |