aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/abuses.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/abuses.ts')
-rw-r--r--server/tests/api/check-params/abuses.ts20
1 files changed, 10 insertions, 10 deletions
diff --git a/server/tests/api/check-params/abuses.ts b/server/tests/api/check-params/abuses.ts
index 72f2cbd8f..fb9a5fd8b 100644
--- a/server/tests/api/check-params/abuses.ts
+++ b/server/tests/api/check-params/abuses.ts
@@ -41,7 +41,7 @@ describe('Test abuses API validators', function () {
41 userToken = await server.users.generateUserAndToken('user_1') 41 userToken = await server.users.generateUserAndToken('user_1')
42 userToken2 = await server.users.generateUserAndToken('user_2') 42 userToken2 = await server.users.generateUserAndToken('user_2')
43 43
44 server.store.video = await server.videos.upload() 44 server.store.videoCreated = await server.videos.upload()
45 45
46 command = server.abuses 46 command = server.abuses
47 }) 47 })
@@ -223,25 +223,25 @@ describe('Test abuses API validators', function () {
223 }) 223 })
224 224
225 it('Should fail with a non authenticated user', async function () { 225 it('Should fail with a non authenticated user', async function () {
226 const fields = { video: { id: server.store.video.id }, reason: 'my super reason' } 226 const fields = { video: { id: server.store.videoCreated.id }, reason: 'my super reason' }
227 227
228 await makePostBodyRequest({ url: server.url, path, token: 'hello', fields, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 228 await makePostBodyRequest({ url: server.url, path, token: 'hello', fields, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
229 }) 229 })
230 230
231 it('Should fail with a reason too short', async function () { 231 it('Should fail with a reason too short', async function () {
232 const fields = { video: { id: server.store.video.id }, reason: 'h' } 232 const fields = { video: { id: server.store.videoCreated.id }, reason: 'h' }
233 233
234 await makePostBodyRequest({ url: server.url, path, token: userToken, fields }) 234 await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
235 }) 235 })
236 236
237 it('Should fail with a too big reason', async function () { 237 it('Should fail with a too big reason', async function () {
238 const fields = { video: { id: server.store.video.id }, reason: 'super'.repeat(605) } 238 const fields = { video: { id: server.store.videoCreated.id }, reason: 'super'.repeat(605) }
239 239
240 await makePostBodyRequest({ url: server.url, path, token: userToken, fields }) 240 await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
241 }) 241 })
242 242
243 it('Should succeed with the correct parameters (basic)', async function () { 243 it('Should succeed with the correct parameters (basic)', async function () {
244 const fields: AbuseCreate = { video: { id: server.store.video.shortUUID }, reason: 'my super reason' } 244 const fields: AbuseCreate = { video: { id: server.store.videoCreated.shortUUID }, reason: 'my super reason' }
245 245
246 const res = await makePostBodyRequest({ 246 const res = await makePostBodyRequest({
247 url: server.url, 247 url: server.url,
@@ -254,19 +254,19 @@ describe('Test abuses API validators', function () {
254 }) 254 })
255 255
256 it('Should fail with a wrong predefined reason', async function () { 256 it('Should fail with a wrong predefined reason', async function () {
257 const fields = { video: { id: server.store.video.id }, reason: 'my super reason', predefinedReasons: [ 'wrongPredefinedReason' ] } 257 const fields = { video: server.store.videoCreated, reason: 'my super reason', predefinedReasons: [ 'wrongPredefinedReason' ] }
258 258
259 await makePostBodyRequest({ url: server.url, path, token: userToken, fields }) 259 await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
260 }) 260 })
261 261
262 it('Should fail with negative timestamps', async function () { 262 it('Should fail with negative timestamps', async function () {
263 const fields = { video: { id: server.store.video.id, startAt: -1 }, reason: 'my super reason' } 263 const fields = { video: { id: server.store.videoCreated.id, startAt: -1 }, reason: 'my super reason' }
264 264
265 await makePostBodyRequest({ url: server.url, path, token: userToken, fields }) 265 await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
266 }) 266 })
267 267
268 it('Should fail mith misordered startAt/endAt', async function () { 268 it('Should fail mith misordered startAt/endAt', async function () {
269 const fields = { video: { id: server.store.video.id, startAt: 5, endAt: 1 }, reason: 'my super reason' } 269 const fields = { video: { id: server.store.videoCreated.id, startAt: 5, endAt: 1 }, reason: 'my super reason' }
270 270
271 await makePostBodyRequest({ url: server.url, path, token: userToken, fields }) 271 await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
272 }) 272 })
@@ -274,7 +274,7 @@ describe('Test abuses API validators', function () {
274 it('Should succeed with the corret parameters (advanced)', async function () { 274 it('Should succeed with the corret parameters (advanced)', async function () {
275 const fields: AbuseCreate = { 275 const fields: AbuseCreate = {
276 video: { 276 video: {
277 id: server.store.video.id, 277 id: server.store.videoCreated.id,
278 startAt: 1, 278 startAt: 1,
279 endAt: 5 279 endAt: 5
280 }, 280 },
@@ -413,7 +413,7 @@ describe('Test abuses API validators', function () {
413 413
414 await doubleFollow(anotherServer, server) 414 await doubleFollow(anotherServer, server)
415 415
416 const server2VideoId = await anotherServer.videos.getId({ uuid: server.store.video.uuid }) 416 const server2VideoId = await anotherServer.videos.getId({ uuid: server.store.videoCreated.uuid })
417 await anotherServer.abuses.report({ reason: 'remote server', videoId: server2VideoId }) 417 await anotherServer.abuses.report({ reason: 'remote server', videoId: server2VideoId })
418 418
419 await waitJobs([ server, anotherServer ]) 419 await waitJobs([ server, anotherServer ])