aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/abuses.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 10:42:24 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commitc0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea (patch)
treebaf29753ac5d4598643e3bee719f8df0cc36c59d /server/tests/api/check-params/abuses.ts
parent08642a765ea514a00f159db898edf14c376fbe6c (diff)
downloadPeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.tar.gz
PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.tar.zst
PeerTube-c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea.zip
Refactor requests
Diffstat (limited to 'server/tests/api/check-params/abuses.ts')
-rw-r--r--server/tests/api/check-params/abuses.ts26
1 files changed, 13 insertions, 13 deletions
diff --git a/server/tests/api/check-params/abuses.ts b/server/tests/api/check-params/abuses.ts
index 62811f932..87d93195c 100644
--- a/server/tests/api/check-params/abuses.ts
+++ b/server/tests/api/check-params/abuses.ts
@@ -1,7 +1,7 @@
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'
4import { HttpStatusCode } from '@shared/core-utils' 4import { HttpStatusCode } from '@shared/models'
5import { 5import {
6 AbusesCommand, 6 AbusesCommand,
7 checkBadCountPagination, 7 checkBadCountPagination,
@@ -66,7 +66,7 @@ describe('Test abuses API validators', function () {
66 await makeGetRequest({ 66 await makeGetRequest({
67 url: server.url, 67 url: server.url,
68 path, 68 path,
69 statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 69 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
70 }) 70 })
71 }) 71 })
72 72
@@ -75,7 +75,7 @@ describe('Test abuses API validators', function () {
75 url: server.url, 75 url: server.url,
76 path, 76 path,
77 token: userToken, 77 token: userToken,
78 statusCodeExpected: HttpStatusCode.FORBIDDEN_403 78 expectedStatus: HttpStatusCode.FORBIDDEN_403
79 }) 79 })
80 }) 80 })
81 81
@@ -110,7 +110,7 @@ describe('Test abuses API validators', function () {
110 videoIs: 'deleted' 110 videoIs: 'deleted'
111 } 111 }
112 112
113 await makeGetRequest({ url: server.url, path, token: server.accessToken, query, statusCodeExpected: HttpStatusCode.OK_200 }) 113 await makeGetRequest({ url: server.url, path, token: server.accessToken, query, expectedStatus: HttpStatusCode.OK_200 })
114 }) 114 })
115 }) 115 })
116 116
@@ -133,7 +133,7 @@ describe('Test abuses API validators', function () {
133 await makeGetRequest({ 133 await makeGetRequest({
134 url: server.url, 134 url: server.url,
135 path, 135 path,
136 statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 136 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
137 }) 137 })
138 }) 138 })
139 139
@@ -152,7 +152,7 @@ describe('Test abuses API validators', function () {
152 state: 2 152 state: 2
153 } 153 }
154 154
155 await makeGetRequest({ url: server.url, path, token: userToken, query, statusCodeExpected: HttpStatusCode.OK_200 }) 155 await makeGetRequest({ url: server.url, path, token: userToken, query, expectedStatus: HttpStatusCode.OK_200 })
156 }) 156 })
157 }) 157 })
158 158
@@ -176,7 +176,7 @@ describe('Test abuses API validators', function () {
176 path, 176 path,
177 token: userToken, 177 token: userToken,
178 fields, 178 fields,
179 statusCodeExpected: HttpStatusCode.NOT_FOUND_404 179 expectedStatus: HttpStatusCode.NOT_FOUND_404
180 }) 180 })
181 }) 181 })
182 182
@@ -192,7 +192,7 @@ describe('Test abuses API validators', function () {
192 path, 192 path,
193 token: userToken, 193 token: userToken,
194 fields, 194 fields,
195 statusCodeExpected: HttpStatusCode.NOT_FOUND_404 195 expectedStatus: HttpStatusCode.NOT_FOUND_404
196 }) 196 })
197 }) 197 })
198 198
@@ -208,7 +208,7 @@ describe('Test abuses API validators', function () {
208 path, 208 path,
209 token: userToken, 209 token: userToken,
210 fields, 210 fields,
211 statusCodeExpected: HttpStatusCode.NOT_FOUND_404 211 expectedStatus: HttpStatusCode.NOT_FOUND_404
212 }) 212 })
213 }) 213 })
214 214
@@ -219,14 +219,14 @@ describe('Test abuses API validators', function () {
219 path, 219 path,
220 token: userToken, 220 token: userToken,
221 fields, 221 fields,
222 statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 222 expectedStatus: HttpStatusCode.BAD_REQUEST_400
223 }) 223 })
224 }) 224 })
225 225
226 it('Should fail with a non authenticated user', async function () { 226 it('Should fail with a non authenticated user', async function () {
227 const fields = { video: { id: server.store.video.id }, reason: 'my super reason' } 227 const fields = { video: { id: server.store.video.id }, reason: 'my super reason' }
228 228
229 await makePostBodyRequest({ url: server.url, path, token: 'hello', fields, statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 }) 229 await makePostBodyRequest({ url: server.url, path, token: 'hello', fields, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
230 }) 230 })
231 231
232 it('Should fail with a reason too short', async function () { 232 it('Should fail with a reason too short', async function () {
@@ -249,7 +249,7 @@ describe('Test abuses API validators', function () {
249 path, 249 path,
250 token: userToken, 250 token: userToken,
251 fields, 251 fields,
252 statusCodeExpected: HttpStatusCode.OK_200 252 expectedStatus: HttpStatusCode.OK_200
253 }) 253 })
254 abuseId = res.body.abuse.id 254 abuseId = res.body.abuse.id
255 }) 255 })
@@ -283,7 +283,7 @@ describe('Test abuses API validators', function () {
283 predefinedReasons: [ 'serverRules' ] 283 predefinedReasons: [ 'serverRules' ]
284 } 284 }
285 285
286 await makePostBodyRequest({ url: server.url, path, token: userToken, fields, statusCodeExpected: HttpStatusCode.OK_200 }) 286 await makePostBodyRequest({ url: server.url, path, token: userToken, fields, expectedStatus: HttpStatusCode.OK_200 })
287 }) 287 })
288 }) 288 })
289 289