diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-16 10:42:24 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea (patch) | |
tree | baf29753ac5d4598643e3bee719f8df0cc36c59d /server/tests/api/check-params/logs.ts | |
parent | 08642a765ea514a00f159db898edf14c376fbe6c (diff) | |
download | PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.tar.gz PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.tar.zst PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.zip |
Refactor requests
Diffstat (limited to 'server/tests/api/check-params/logs.ts')
-rw-r--r-- | server/tests/api/check-params/logs.ts | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/server/tests/api/check-params/logs.ts b/server/tests/api/check-params/logs.ts index 2eb074007..05372257a 100644 --- a/server/tests/api/check-params/logs.ts +++ b/server/tests/api/check-params/logs.ts | |||
@@ -1,15 +1,8 @@ | |||
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 | createSingleServer, | ||
8 | PeerTubeServer, | ||
9 | setAccessTokensToServers | ||
10 | } from '../../../../shared/extra-utils' | ||
11 | import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' | ||
12 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
13 | 6 | ||
14 | describe('Test logs API validators', function () { | 7 | describe('Test logs API validators', function () { |
15 | const path = '/api/v1/server/logs' | 8 | const path = '/api/v1/server/logs' |
@@ -39,7 +32,7 @@ describe('Test logs API validators', function () { | |||
39 | await makeGetRequest({ | 32 | await makeGetRequest({ |
40 | url: server.url, | 33 | url: server.url, |
41 | path, | 34 | path, |
42 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 | 35 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 |
43 | }) | 36 | }) |
44 | }) | 37 | }) |
45 | 38 | ||
@@ -48,7 +41,7 @@ describe('Test logs API validators', function () { | |||
48 | url: server.url, | 41 | url: server.url, |
49 | path, | 42 | path, |
50 | token: userAccessToken, | 43 | token: userAccessToken, |
51 | statusCodeExpected: HttpStatusCode.FORBIDDEN_403 | 44 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
52 | }) | 45 | }) |
53 | }) | 46 | }) |
54 | 47 | ||
@@ -57,7 +50,7 @@ describe('Test logs API validators', function () { | |||
57 | url: server.url, | 50 | url: server.url, |
58 | path, | 51 | path, |
59 | token: server.accessToken, | 52 | token: server.accessToken, |
60 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 | 53 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
61 | }) | 54 | }) |
62 | }) | 55 | }) |
63 | 56 | ||
@@ -67,7 +60,7 @@ describe('Test logs API validators', function () { | |||
67 | path, | 60 | path, |
68 | token: server.accessToken, | 61 | token: server.accessToken, |
69 | query: { startDate: 'toto' }, | 62 | query: { startDate: 'toto' }, |
70 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 | 63 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
71 | }) | 64 | }) |
72 | }) | 65 | }) |
73 | 66 | ||
@@ -77,7 +70,7 @@ describe('Test logs API validators', function () { | |||
77 | path, | 70 | path, |
78 | token: server.accessToken, | 71 | token: server.accessToken, |
79 | query: { startDate: new Date().toISOString(), endDate: 'toto' }, | 72 | query: { startDate: new Date().toISOString(), endDate: 'toto' }, |
80 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 | 73 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
81 | }) | 74 | }) |
82 | }) | 75 | }) |
83 | 76 | ||
@@ -87,7 +80,7 @@ describe('Test logs API validators', function () { | |||
87 | path, | 80 | path, |
88 | token: server.accessToken, | 81 | token: server.accessToken, |
89 | query: { startDate: new Date().toISOString(), level: 'toto' }, | 82 | query: { startDate: new Date().toISOString(), level: 'toto' }, |
90 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 | 83 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
91 | }) | 84 | }) |
92 | }) | 85 | }) |
93 | 86 | ||
@@ -97,7 +90,7 @@ describe('Test logs API validators', function () { | |||
97 | path, | 90 | path, |
98 | token: server.accessToken, | 91 | token: server.accessToken, |
99 | query: { startDate: new Date().toISOString() }, | 92 | query: { startDate: new Date().toISOString() }, |
100 | statusCodeExpected: HttpStatusCode.OK_200 | 93 | expectedStatus: HttpStatusCode.OK_200 |
101 | }) | 94 | }) |
102 | }) | 95 | }) |
103 | }) | 96 | }) |