aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/jobs.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/jobs.ts')
-rw-r--r--server/tests/api/check-params/jobs.ts33
1 files changed, 14 insertions, 19 deletions
diff --git a/server/tests/api/check-params/jobs.ts b/server/tests/api/check-params/jobs.ts
index 3c1d2049b..23d95d8e4 100644
--- a/server/tests/api/check-params/jobs.ts
+++ b/server/tests/api/check-params/jobs.ts
@@ -1,26 +1,21 @@
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
3import 'mocha' 3import 'mocha'
4
5import {
6 cleanupTests,
7 createUser,
8 flushAndRunServer,
9 ServerInfo,
10 setAccessTokensToServers,
11 userLogin
12} from '../../../../shared/extra-utils'
13import { 4import {
14 checkBadCountPagination, 5 checkBadCountPagination,
15 checkBadSortPagination, 6 checkBadSortPagination,
16 checkBadStartPagination 7 checkBadStartPagination,
17} from '../../../../shared/extra-utils/requests/check-api-params' 8 cleanupTests,
18import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' 9 createSingleServer,
19import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 10 makeGetRequest,
11 PeerTubeServer,
12 setAccessTokensToServers
13} from '@shared/extra-utils'
14import { HttpStatusCode } from '@shared/models'
20 15
21describe('Test jobs API validators', function () { 16describe('Test jobs API validators', function () {
22 const path = '/api/v1/jobs/failed' 17 const path = '/api/v1/jobs/failed'
23 let server: ServerInfo 18 let server: PeerTubeServer
24 let userAccessToken = '' 19 let userAccessToken = ''
25 20
26 // --------------------------------------------------------------- 21 // ---------------------------------------------------------------
@@ -28,7 +23,7 @@ describe('Test jobs API validators', function () {
28 before(async function () { 23 before(async function () {
29 this.timeout(120000) 24 this.timeout(120000)
30 25
31 server = await flushAndRunServer(1) 26 server = await createSingleServer(1)
32 27
33 await setAccessTokensToServers([ server ]) 28 await setAccessTokensToServers([ server ])
34 29
@@ -36,8 +31,8 @@ describe('Test jobs API validators', function () {
36 username: 'user1', 31 username: 'user1',
37 password: 'my super password' 32 password: 'my super password'
38 } 33 }
39 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 34 await server.users.create({ username: user.username, password: user.password })
40 userAccessToken = await userLogin(server, user) 35 userAccessToken = await server.login.getAccessToken(user)
41 }) 36 })
42 37
43 describe('When listing jobs', function () { 38 describe('When listing jobs', function () {
@@ -77,7 +72,7 @@ describe('Test jobs API validators', function () {
77 await makeGetRequest({ 72 await makeGetRequest({
78 url: server.url, 73 url: server.url,
79 path, 74 path,
80 statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 75 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
81 }) 76 })
82 }) 77 })
83 78
@@ -86,7 +81,7 @@ describe('Test jobs API validators', function () {
86 url: server.url, 81 url: server.url,
87 path, 82 path,
88 token: userAccessToken, 83 token: userAccessToken,
89 statusCodeExpected: HttpStatusCode.FORBIDDEN_403 84 expectedStatus: HttpStatusCode.FORBIDDEN_403
90 }) 85 })
91 }) 86 })
92 87