aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/logs.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-21 15:51:30 +0200
committerChocobozzz <me@florianbigard.com>2021-07-21 15:51:30 +0200
commita24bd1ed41b43790bab6ba789580bb4e85f07d85 (patch)
treea54b0f6c921ba83a6e909cd0ced325b2d4b8863c /server/tests/api/check-params/logs.ts
parent5f26f13b3c16ac5ae0a3b0a7142d84a9528cf565 (diff)
parentc63830f15403ac4e750829f27d8bbbdc9a59282c (diff)
downloadPeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.tar.gz
PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.tar.zst
PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.zip
Merge branch 'next' into develop
Diffstat (limited to 'server/tests/api/check-params/logs.ts')
-rw-r--r--server/tests/api/check-params/logs.ts35
1 files changed, 13 insertions, 22 deletions
diff --git a/server/tests/api/check-params/logs.ts b/server/tests/api/check-params/logs.ts
index dac1e6b98..05372257a 100644
--- a/server/tests/api/check-params/logs.ts
+++ b/server/tests/api/check-params/logs.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
3import 'mocha' 3import 'mocha'
4 4import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
5import { 5import { HttpStatusCode } from '@shared/models'
6 cleanupTests,
7 createUser,
8 flushAndRunServer,
9 ServerInfo,
10 setAccessTokensToServers,
11 userLogin
12} from '../../../../shared/extra-utils'
13import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests'
14import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
15 6
16describe('Test logs API validators', function () { 7describe('Test logs API validators', function () {
17 const path = '/api/v1/server/logs' 8 const path = '/api/v1/server/logs'
18 let server: ServerInfo 9 let server: PeerTubeServer
19 let userAccessToken = '' 10 let userAccessToken = ''
20 11
21 // --------------------------------------------------------------- 12 // ---------------------------------------------------------------
@@ -23,7 +14,7 @@ describe('Test logs 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 logs 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 logs', function () { 29 describe('When getting logs', function () {
@@ -41,7 +32,7 @@ describe('Test logs 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 logs 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
@@ -59,7 +50,7 @@ describe('Test logs API validators', function () {
59 url: server.url, 50 url: server.url,
60 path, 51 path,
61 token: server.accessToken, 52 token: server.accessToken,
62 statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 53 expectedStatus: HttpStatusCode.BAD_REQUEST_400
63 }) 54 })
64 }) 55 })
65 56
@@ -69,7 +60,7 @@ describe('Test logs API validators', function () {
69 path, 60 path,
70 token: server.accessToken, 61 token: server.accessToken,
71 query: { startDate: 'toto' }, 62 query: { startDate: 'toto' },
72 statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 63 expectedStatus: HttpStatusCode.BAD_REQUEST_400
73 }) 64 })
74 }) 65 })
75 66
@@ -79,7 +70,7 @@ describe('Test logs API validators', function () {
79 path, 70 path,
80 token: server.accessToken, 71 token: server.accessToken,
81 query: { startDate: new Date().toISOString(), endDate: 'toto' }, 72 query: { startDate: new Date().toISOString(), endDate: 'toto' },
82 statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 73 expectedStatus: HttpStatusCode.BAD_REQUEST_400
83 }) 74 })
84 }) 75 })
85 76
@@ -89,7 +80,7 @@ describe('Test logs API validators', function () {
89 path, 80 path,
90 token: server.accessToken, 81 token: server.accessToken,
91 query: { startDate: new Date().toISOString(), level: 'toto' }, 82 query: { startDate: new Date().toISOString(), level: 'toto' },
92 statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 83 expectedStatus: HttpStatusCode.BAD_REQUEST_400
93 }) 84 })
94 }) 85 })
95 86
@@ -99,7 +90,7 @@ describe('Test logs API validators', function () {
99 path, 90 path,
100 token: server.accessToken, 91 token: server.accessToken,
101 query: { startDate: new Date().toISOString() }, 92 query: { startDate: new Date().toISOString() },
102 statusCodeExpected: HttpStatusCode.OK_200 93 expectedStatus: HttpStatusCode.OK_200
103 }) 94 })
104 }) 95 })
105 }) 96 })