aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-06-22 13:00:39 +0200
committerGitHub <noreply@github.com>2020-06-22 13:00:39 +0200
commit1ebddadd0704812a4600c39cabe2268321e88331 (patch)
tree1cc8560e5b63e9976aa5411ba800a62cfe7b8ea9 /server/tests/api/videos
parent07aea1a2642fc9868cb01e30c322514029d5b95a (diff)
downloadPeerTube-1ebddadd0704812a4600c39cabe2268321e88331.tar.gz
PeerTube-1ebddadd0704812a4600c39cabe2268321e88331.tar.zst
PeerTube-1ebddadd0704812a4600c39cabe2268321e88331.zip
predefined report reasons & improved reporter UI (#2842)
- added `startAt` and `endAt` optional timestamps to help pin down reported sections of a video - added predefined report reasons - added video player with report modal
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/video-abuse.ts43
1 files changed, 36 insertions, 7 deletions
diff --git a/server/tests/api/videos/video-abuse.ts b/server/tests/api/videos/video-abuse.ts
index a96be97f6..7383bd991 100644
--- a/server/tests/api/videos/video-abuse.ts
+++ b/server/tests/api/videos/video-abuse.ts
@@ -2,7 +2,7 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { VideoAbuse, VideoAbuseState } from '../../../../shared/models/videos' 5import { VideoAbuse, VideoAbuseState, VideoAbusePredefinedReasonsString } from '../../../../shared/models/videos'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 deleteVideoAbuse, 8 deleteVideoAbuse,
@@ -291,6 +291,32 @@ describe('Test video abuses', function () {
291 } 291 }
292 }) 292 })
293 293
294 it('Should list predefined reasons as well as timestamps for the reported video', async function () {
295 this.timeout(10000)
296
297 const reason5 = 'my super bad reason 5'
298 const predefinedReasons5: VideoAbusePredefinedReasonsString[] = [ 'violentOrRepulsive', 'captions' ]
299 const createdAbuse = (await reportVideoAbuse(
300 servers[0].url,
301 servers[0].accessToken,
302 servers[0].video.id,
303 reason5,
304 predefinedReasons5,
305 1,
306 5
307 )).body.videoAbuse as VideoAbuse
308
309 const res = await getVideoAbusesList({ url: servers[0].url, token: servers[0].accessToken })
310
311 {
312 const abuse = (res.body.data as VideoAbuse[]).find(a => a.id === createdAbuse.id)
313 expect(abuse.reason).to.equals(reason5)
314 expect(abuse.predefinedReasons).to.deep.equals(predefinedReasons5, "predefined reasons do not match the one reported")
315 expect(abuse.startAt).to.equal(1, "starting timestamp doesn't match the one reported")
316 expect(abuse.endAt).to.equal(5, "ending timestamp doesn't match the one reported")
317 }
318 })
319
294 it('Should delete the video abuse', async function () { 320 it('Should delete the video abuse', async function () {
295 this.timeout(10000) 321 this.timeout(10000)
296 322
@@ -307,7 +333,7 @@ describe('Test video abuses', function () {
307 333
308 { 334 {
309 const res = await getVideoAbusesList({ url: servers[0].url, token: servers[0].accessToken }) 335 const res = await getVideoAbusesList({ url: servers[0].url, token: servers[0].accessToken })
310 expect(res.body.total).to.equal(5) 336 expect(res.body.total).to.equal(6)
311 } 337 }
312 }) 338 })
313 339
@@ -328,25 +354,28 @@ describe('Test video abuses', function () {
328 expect(await list({ id: 56 })).to.have.lengthOf(0) 354 expect(await list({ id: 56 })).to.have.lengthOf(0)
329 expect(await list({ id: 1 })).to.have.lengthOf(1) 355 expect(await list({ id: 1 })).to.have.lengthOf(1)
330 356
331 expect(await list({ search: 'my super name for server 1' })).to.have.lengthOf(3) 357 expect(await list({ search: 'my super name for server 1' })).to.have.lengthOf(4)
332 expect(await list({ search: 'aaaaaaaaaaaaaaaaaaaaaaaaaa' })).to.have.lengthOf(0) 358 expect(await list({ search: 'aaaaaaaaaaaaaaaaaaaaaaaaaa' })).to.have.lengthOf(0)
333 359
334 expect(await list({ searchVideo: 'my second super name for server 1' })).to.have.lengthOf(1) 360 expect(await list({ searchVideo: 'my second super name for server 1' })).to.have.lengthOf(1)
335 361
336 expect(await list({ searchVideoChannel: 'root' })).to.have.lengthOf(3) 362 expect(await list({ searchVideoChannel: 'root' })).to.have.lengthOf(4)
337 expect(await list({ searchVideoChannel: 'aaaa' })).to.have.lengthOf(0) 363 expect(await list({ searchVideoChannel: 'aaaa' })).to.have.lengthOf(0)
338 364
339 expect(await list({ searchReporter: 'user2' })).to.have.lengthOf(1) 365 expect(await list({ searchReporter: 'user2' })).to.have.lengthOf(1)
340 expect(await list({ searchReporter: 'root' })).to.have.lengthOf(4) 366 expect(await list({ searchReporter: 'root' })).to.have.lengthOf(5)
341 367
342 expect(await list({ searchReportee: 'root' })).to.have.lengthOf(3) 368 expect(await list({ searchReportee: 'root' })).to.have.lengthOf(4)
343 expect(await list({ searchReportee: 'aaaa' })).to.have.lengthOf(0) 369 expect(await list({ searchReportee: 'aaaa' })).to.have.lengthOf(0)
344 370
345 expect(await list({ videoIs: 'deleted' })).to.have.lengthOf(1) 371 expect(await list({ videoIs: 'deleted' })).to.have.lengthOf(1)
346 expect(await list({ videoIs: 'blacklisted' })).to.have.lengthOf(0) 372 expect(await list({ videoIs: 'blacklisted' })).to.have.lengthOf(0)
347 373
348 expect(await list({ state: VideoAbuseState.ACCEPTED })).to.have.lengthOf(0) 374 expect(await list({ state: VideoAbuseState.ACCEPTED })).to.have.lengthOf(0)
349 expect(await list({ state: VideoAbuseState.PENDING })).to.have.lengthOf(5) 375 expect(await list({ state: VideoAbuseState.PENDING })).to.have.lengthOf(6)
376
377 expect(await list({ predefinedReason: 'violentOrRepulsive' })).to.have.lengthOf(1)
378 expect(await list({ predefinedReason: 'serverRules' })).to.have.lengthOf(0)
350 }) 379 })
351 380
352 after(async function () { 381 after(async function () {