aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/moderation/abuses.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/moderation/abuses.ts')
-rw-r--r--server/tests/api/moderation/abuses.ts54
1 files changed, 27 insertions, 27 deletions
diff --git a/server/tests/api/moderation/abuses.ts b/server/tests/api/moderation/abuses.ts
index 8d6360eb3..c258414ce 100644
--- a/server/tests/api/moderation/abuses.ts
+++ b/server/tests/api/moderation/abuses.ts
@@ -64,8 +64,8 @@ describe('Test abuses', function () {
64 const { data } = await servers[0].videos.list() 64 const { data } = await servers[0].videos.list()
65 expect(data.length).to.equal(2) 65 expect(data.length).to.equal(2)
66 66
67 servers[0].store.video = data.find(video => video.name === 'my super name for server 1') 67 servers[0].store.videoCreated = data.find(video => video.name === 'my super name for server 1')
68 servers[1].store.video = data.find(video => video.name === 'my super name for server 2') 68 servers[1].store.videoCreated = data.find(video => video.name === 'my super name for server 2')
69 }) 69 })
70 70
71 it('Should not have abuses', async function () { 71 it('Should not have abuses', async function () {
@@ -80,7 +80,7 @@ describe('Test abuses', function () {
80 this.timeout(15000) 80 this.timeout(15000)
81 81
82 const reason = 'my super bad reason' 82 const reason = 'my super bad reason'
83 await commands[0].report({ videoId: servers[0].store.video.id, reason }) 83 await commands[0].report({ videoId: servers[0].store.videoCreated.id, reason })
84 84
85 // We wait requests propagation, even if the server 1 is not supposed to make a request to server 2 85 // We wait requests propagation, even if the server 1 is not supposed to make a request to server 2
86 await waitJobs(servers) 86 await waitJobs(servers)
@@ -100,7 +100,7 @@ describe('Test abuses', function () {
100 expect(abuse.reporterAccount.name).to.equal('root') 100 expect(abuse.reporterAccount.name).to.equal('root')
101 expect(abuse.reporterAccount.host).to.equal(servers[0].host) 101 expect(abuse.reporterAccount.host).to.equal(servers[0].host)
102 102
103 expect(abuse.video.id).to.equal(servers[0].store.video.id) 103 expect(abuse.video.id).to.equal(servers[0].store.videoCreated.id)
104 expect(abuse.video.channel).to.exist 104 expect(abuse.video.channel).to.exist
105 105
106 expect(abuse.comment).to.be.null 106 expect(abuse.comment).to.be.null
@@ -127,7 +127,7 @@ describe('Test abuses', function () {
127 this.timeout(10000) 127 this.timeout(10000)
128 128
129 const reason = 'my super bad reason 2' 129 const reason = 'my super bad reason 2'
130 const videoId = await servers[0].videos.getId({ uuid: servers[1].store.video.uuid }) 130 const videoId = await servers[0].videos.getId({ uuid: servers[1].store.videoCreated.uuid })
131 await commands[0].report({ videoId, reason }) 131 await commands[0].report({ videoId, reason })
132 132
133 // We wait requests propagation 133 // We wait requests propagation
@@ -146,7 +146,7 @@ describe('Test abuses', function () {
146 expect(abuse1.reporterAccount.name).to.equal('root') 146 expect(abuse1.reporterAccount.name).to.equal('root')
147 expect(abuse1.reporterAccount.host).to.equal(servers[0].host) 147 expect(abuse1.reporterAccount.host).to.equal(servers[0].host)
148 148
149 expect(abuse1.video.id).to.equal(servers[0].store.video.id) 149 expect(abuse1.video.id).to.equal(servers[0].store.videoCreated.id)
150 expect(abuse1.video.countReports).to.equal(1) 150 expect(abuse1.video.countReports).to.equal(1)
151 expect(abuse1.video.nthReport).to.equal(1) 151 expect(abuse1.video.nthReport).to.equal(1)
152 152
@@ -165,7 +165,7 @@ describe('Test abuses', function () {
165 expect(abuse2.reporterAccount.name).to.equal('root') 165 expect(abuse2.reporterAccount.name).to.equal('root')
166 expect(abuse2.reporterAccount.host).to.equal(servers[0].host) 166 expect(abuse2.reporterAccount.host).to.equal(servers[0].host)
167 167
168 expect(abuse2.video.id).to.equal(servers[1].store.video.id) 168 expect(abuse2.video.id).to.equal(servers[1].store.videoCreated.id)
169 169
170 expect(abuse2.comment).to.be.null 170 expect(abuse2.comment).to.be.null
171 171
@@ -200,7 +200,7 @@ describe('Test abuses', function () {
200 this.timeout(10000) 200 this.timeout(10000)
201 201
202 { 202 {
203 const videoId = await servers[1].videos.getId({ uuid: servers[0].store.video.uuid }) 203 const videoId = await servers[1].videos.getId({ uuid: servers[0].store.videoCreated.uuid })
204 await commands[1].report({ videoId, reason: 'will mute this' }) 204 await commands[1].report({ videoId, reason: 'will mute this' })
205 await waitJobs(servers) 205 await waitJobs(servers)
206 206
@@ -288,7 +288,7 @@ describe('Test abuses', function () {
288 await commands[0].report({ videoId: video3Id, reason: reason3 }) 288 await commands[0].report({ videoId: video3Id, reason: reason3 })
289 289
290 const reason4 = 'my super bad reason 4' 290 const reason4 = 'my super bad reason 4'
291 await commands[0].report({ token: userAccessToken, videoId: servers[0].store.video.id, reason: reason4 }) 291 await commands[0].report({ token: userAccessToken, videoId: servers[0].store.videoCreated.id, reason: reason4 })
292 292
293 { 293 {
294 const body = await commands[0].getAdminList() 294 const body = await commands[0].getAdminList()
@@ -301,7 +301,7 @@ describe('Test abuses', function () {
301 expect(abuseVideo3.countReportsForReportee).to.equal(1, "wrong reports count for reporter on video 3 abuse") 301 expect(abuseVideo3.countReportsForReportee).to.equal(1, "wrong reports count for reporter on video 3 abuse")
302 expect(abuseVideo3.countReportsForReporter).to.equal(3, "wrong reports count for reportee on video 3 abuse") 302 expect(abuseVideo3.countReportsForReporter).to.equal(3, "wrong reports count for reportee on video 3 abuse")
303 303
304 const abuseServer1 = abuses.find(a => a.video.id === servers[0].store.video.id) 304 const abuseServer1 = abuses.find(a => a.video.id === servers[0].store.videoCreated.id)
305 expect(abuseServer1.countReportsForReportee).to.equal(3, "wrong reports count for reporter on video 1 abuse") 305 expect(abuseServer1.countReportsForReportee).to.equal(3, "wrong reports count for reporter on video 1 abuse")
306 } 306 }
307 }) 307 })
@@ -312,7 +312,7 @@ describe('Test abuses', function () {
312 const reason5 = 'my super bad reason 5' 312 const reason5 = 'my super bad reason 5'
313 const predefinedReasons5: AbusePredefinedReasonsString[] = [ 'violentOrRepulsive', 'captions' ] 313 const predefinedReasons5: AbusePredefinedReasonsString[] = [ 'violentOrRepulsive', 'captions' ]
314 const createRes = await commands[0].report({ 314 const createRes = await commands[0].report({
315 videoId: servers[0].store.video.id, 315 videoId: servers[0].store.videoCreated.id,
316 reason: reason5, 316 reason: reason5,
317 predefinedReasons: predefinedReasons5, 317 predefinedReasons: predefinedReasons5,
318 startAt: 1, 318 startAt: 1,
@@ -402,11 +402,11 @@ describe('Test abuses', function () {
402 before(async function () { 402 before(async function () {
403 this.timeout(50000) 403 this.timeout(50000)
404 404
405 servers[0].store.video = await servers[0].videos.quickUpload({ name: 'server 1' }) 405 servers[0].store.videoCreated = await servers[0].videos.quickUpload({ name: 'server 1' })
406 servers[1].store.video = await servers[1].videos.quickUpload({ name: 'server 2' }) 406 servers[1].store.videoCreated = await servers[1].videos.quickUpload({ name: 'server 2' })
407 407
408 await servers[0].comments.createThread({ videoId: servers[0].store.video.id, text: 'comment server 1' }) 408 await servers[0].comments.createThread({ videoId: servers[0].store.videoCreated.id, text: 'comment server 1' })
409 await servers[1].comments.createThread({ videoId: servers[1].store.video.id, text: 'comment server 2' }) 409 await servers[1].comments.createThread({ videoId: servers[1].store.videoCreated.id, text: 'comment server 2' })
410 410
411 await waitJobs(servers) 411 await waitJobs(servers)
412 }) 412 })
@@ -414,7 +414,7 @@ describe('Test abuses', function () {
414 it('Should report abuse on a comment', async function () { 414 it('Should report abuse on a comment', async function () {
415 this.timeout(15000) 415 this.timeout(15000)
416 416
417 const comment = await getComment(servers[0], servers[0].store.video.id) 417 const comment = await getComment(servers[0], servers[0].store.videoCreated.id)
418 418
419 const reason = 'it is a bad comment' 419 const reason = 'it is a bad comment'
420 await commands[0].report({ commentId: comment.id, reason }) 420 await commands[0].report({ commentId: comment.id, reason })
@@ -424,7 +424,7 @@ describe('Test abuses', function () {
424 424
425 it('Should have 1 comment abuse on server 1 and 0 on server 2', async function () { 425 it('Should have 1 comment abuse on server 1 and 0 on server 2', async function () {
426 { 426 {
427 const comment = await getComment(servers[0], servers[0].store.video.id) 427 const comment = await getComment(servers[0], servers[0].store.videoCreated.id)
428 const body = await commands[0].getAdminList({ filter: 'comment' }) 428 const body = await commands[0].getAdminList({ filter: 'comment' })
429 429
430 expect(body.total).to.equal(1) 430 expect(body.total).to.equal(1)
@@ -442,8 +442,8 @@ describe('Test abuses', function () {
442 expect(abuse.comment.id).to.equal(comment.id) 442 expect(abuse.comment.id).to.equal(comment.id)
443 expect(abuse.comment.text).to.equal(comment.text) 443 expect(abuse.comment.text).to.equal(comment.text)
444 expect(abuse.comment.video.name).to.equal('server 1') 444 expect(abuse.comment.video.name).to.equal('server 1')
445 expect(abuse.comment.video.id).to.equal(servers[0].store.video.id) 445 expect(abuse.comment.video.id).to.equal(servers[0].store.videoCreated.id)
446 expect(abuse.comment.video.uuid).to.equal(servers[0].store.video.uuid) 446 expect(abuse.comment.video.uuid).to.equal(servers[0].store.videoCreated.uuid)
447 447
448 expect(abuse.countReportsForReporter).to.equal(5) 448 expect(abuse.countReportsForReporter).to.equal(5)
449 expect(abuse.countReportsForReportee).to.equal(5) 449 expect(abuse.countReportsForReportee).to.equal(5)
@@ -459,7 +459,7 @@ describe('Test abuses', function () {
459 it('Should report abuse on a remote comment', async function () { 459 it('Should report abuse on a remote comment', async function () {
460 this.timeout(10000) 460 this.timeout(10000)
461 461
462 const comment = await getComment(servers[0], servers[1].store.video.uuid) 462 const comment = await getComment(servers[0], servers[1].store.videoCreated.uuid)
463 463
464 const reason = 'it is a really bad comment' 464 const reason = 'it is a really bad comment'
465 await commands[0].report({ commentId: comment.id, reason }) 465 await commands[0].report({ commentId: comment.id, reason })
@@ -468,7 +468,7 @@ describe('Test abuses', function () {
468 }) 468 })
469 469
470 it('Should have 2 comment abuses on server 1 and 1 on server 2', async function () { 470 it('Should have 2 comment abuses on server 1 and 1 on server 2', async function () {
471 const commentServer2 = await getComment(servers[0], servers[1].store.video.id) 471 const commentServer2 = await getComment(servers[0], servers[1].store.videoCreated.id)
472 472
473 { 473 {
474 const body = await commands[0].getAdminList({ filter: 'comment' }) 474 const body = await commands[0].getAdminList({ filter: 'comment' })
@@ -493,7 +493,7 @@ describe('Test abuses', function () {
493 expect(abuse2.comment.id).to.equal(commentServer2.id) 493 expect(abuse2.comment.id).to.equal(commentServer2.id)
494 expect(abuse2.comment.text).to.equal(commentServer2.text) 494 expect(abuse2.comment.text).to.equal(commentServer2.text)
495 expect(abuse2.comment.video.name).to.equal('server 2') 495 expect(abuse2.comment.video.name).to.equal('server 2')
496 expect(abuse2.comment.video.uuid).to.equal(servers[1].store.video.uuid) 496 expect(abuse2.comment.video.uuid).to.equal(servers[1].store.videoCreated.uuid)
497 497
498 expect(abuse2.state.id).to.equal(AbuseState.PENDING) 498 expect(abuse2.state.id).to.equal(AbuseState.PENDING)
499 expect(abuse2.state.label).to.equal('Pending') 499 expect(abuse2.state.label).to.equal('Pending')
@@ -527,9 +527,9 @@ describe('Test abuses', function () {
527 it('Should keep the comment abuse when deleting the comment', async function () { 527 it('Should keep the comment abuse when deleting the comment', async function () {
528 this.timeout(10000) 528 this.timeout(10000)
529 529
530 const commentServer2 = await getComment(servers[0], servers[1].store.video.id) 530 const commentServer2 = await getComment(servers[0], servers[1].store.videoCreated.id)
531 531
532 await servers[0].comments.delete({ videoId: servers[1].store.video.uuid, commentId: commentServer2.id }) 532 await servers[0].comments.delete({ videoId: servers[1].store.videoCreated.uuid, commentId: commentServer2.id })
533 533
534 await waitJobs(servers) 534 await waitJobs(servers)
535 535
@@ -761,9 +761,9 @@ describe('Test abuses', function () {
761 before(async function () { 761 before(async function () {
762 userAccessToken = await servers[0].users.generateUserAndToken('user_42') 762 userAccessToken = await servers[0].users.generateUserAndToken('user_42')
763 763
764 await commands[0].report({ token: userAccessToken, videoId: servers[0].store.video.id, reason: 'user reason 1' }) 764 await commands[0].report({ token: userAccessToken, videoId: servers[0].store.videoCreated.id, reason: 'user reason 1' })
765 765
766 const videoId = await servers[0].videos.getId({ uuid: servers[1].store.video.uuid }) 766 const videoId = await servers[0].videos.getId({ uuid: servers[1].store.videoCreated.uuid })
767 await commands[0].report({ token: userAccessToken, videoId, reason: 'user reason 2' }) 767 await commands[0].report({ token: userAccessToken, videoId, reason: 'user reason 2' })
768 }) 768 })
769 769
@@ -832,7 +832,7 @@ describe('Test abuses', function () {
832 before(async function () { 832 before(async function () {
833 userToken = await servers[0].users.generateUserAndToken('user_43') 833 userToken = await servers[0].users.generateUserAndToken('user_43')
834 834
835 const body = await commands[0].report({ token: userToken, videoId: servers[0].store.video.id, reason: 'user 43 reason 1' }) 835 const body = await commands[0].report({ token: userToken, videoId: servers[0].store.videoCreated.id, reason: 'user 43 reason 1' })
836 abuseId = body.abuse.id 836 abuseId = body.abuse.id
837 }) 837 })
838 838