diff options
Diffstat (limited to 'server/tests/api/check-params/custom-pages.ts')
-rw-r--r-- | server/tests/api/check-params/custom-pages.ts | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/server/tests/api/check-params/custom-pages.ts b/server/tests/api/check-params/custom-pages.ts index 74ca3384c..9fbbea315 100644 --- a/server/tests/api/check-params/custom-pages.ts +++ b/server/tests/api/check-params/custom-pages.ts | |||
@@ -1,21 +1,20 @@ | |||
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 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
5 | import { | 4 | import { |
6 | cleanupTests, | 5 | cleanupTests, |
7 | createUser, | 6 | createSingleServer, |
8 | flushAndRunServer, | 7 | makeGetRequest, |
9 | ServerInfo, | 8 | makePutBodyRequest, |
10 | setAccessTokensToServers, | 9 | PeerTubeServer, |
11 | userLogin | 10 | setAccessTokensToServers |
12 | } from '../../../../shared/extra-utils' | 11 | } from '@shared/extra-utils' |
13 | import { makeGetRequest, makePutBodyRequest } from '../../../../shared/extra-utils/requests/requests' | 12 | import { HttpStatusCode } from '@shared/models' |
14 | 13 | ||
15 | describe('Test custom pages validators', function () { | 14 | describe('Test custom pages validators', function () { |
16 | const path = '/api/v1/custom-pages/homepage/instance' | 15 | const path = '/api/v1/custom-pages/homepage/instance' |
17 | 16 | ||
18 | let server: ServerInfo | 17 | let server: PeerTubeServer |
19 | let userAccessToken: string | 18 | let userAccessToken: string |
20 | 19 | ||
21 | // --------------------------------------------------------------- | 20 | // --------------------------------------------------------------- |
@@ -23,13 +22,13 @@ describe('Test custom pages validators', function () { | |||
23 | before(async function () { | 22 | before(async function () { |
24 | this.timeout(120000) | 23 | this.timeout(120000) |
25 | 24 | ||
26 | server = await flushAndRunServer(1) | 25 | server = await createSingleServer(1) |
27 | await setAccessTokensToServers([ server ]) | 26 | await setAccessTokensToServers([ server ]) |
28 | 27 | ||
29 | const user = { username: 'user1', password: 'password' } | 28 | const user = { username: 'user1', password: 'password' } |
30 | await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) | 29 | await server.users.create({ username: user.username, password: user.password }) |
31 | 30 | ||
32 | userAccessToken = await userLogin(server, user) | 31 | userAccessToken = await server.login.getAccessToken(user) |
33 | }) | 32 | }) |
34 | 33 | ||
35 | describe('When updating instance homepage', function () { | 34 | describe('When updating instance homepage', function () { |
@@ -39,7 +38,7 @@ describe('Test custom pages validators', function () { | |||
39 | url: server.url, | 38 | url: server.url, |
40 | path, | 39 | path, |
41 | fields: { content: 'super content' }, | 40 | fields: { content: 'super content' }, |
42 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 | 41 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
43 | }) | 42 | }) |
44 | }) | 43 | }) |
45 | 44 | ||
@@ -49,7 +48,7 @@ describe('Test custom pages validators', function () { | |||
49 | path, | 48 | path, |
50 | token: userAccessToken, | 49 | token: userAccessToken, |
51 | fields: { content: 'super content' }, | 50 | fields: { content: 'super content' }, |
52 | statusCodeExpected: HttpStatusCode.FORBIDDEN_403 | 51 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
53 | }) | 52 | }) |
54 | }) | 53 | }) |
55 | 54 | ||
@@ -59,7 +58,7 @@ describe('Test custom pages validators', function () { | |||
59 | path, | 58 | path, |
60 | token: server.accessToken, | 59 | token: server.accessToken, |
61 | fields: { content: 'super content' }, | 60 | fields: { content: 'super content' }, |
62 | statusCodeExpected: HttpStatusCode.NO_CONTENT_204 | 61 | expectedStatus: HttpStatusCode.NO_CONTENT_204 |
63 | }) | 62 | }) |
64 | }) | 63 | }) |
65 | }) | 64 | }) |
@@ -70,7 +69,7 @@ describe('Test custom pages validators', function () { | |||
70 | await makeGetRequest({ | 69 | await makeGetRequest({ |
71 | url: server.url, | 70 | url: server.url, |
72 | path, | 71 | path, |
73 | statusCodeExpected: HttpStatusCode.OK_200 | 72 | expectedStatus: HttpStatusCode.OK_200 |
74 | }) | 73 | }) |
75 | }) | 74 | }) |
76 | }) | 75 | }) |