aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/video-abuse.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/server/tests/api/videos/video-abuse.ts b/server/tests/api/videos/video-abuse.ts
index baeb543e0..0b6a0e8ae 100644
--- a/server/tests/api/videos/video-abuse.ts
+++ b/server/tests/api/videos/video-abuse.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { Abuse, AbusePredefinedReasonsString, AbuseState } from '@shared/models' 5import { AbusePredefinedReasonsString, AbuseState, AdminAbuse } from '@shared/models'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 createUser, 8 createUser,
@@ -33,7 +33,7 @@ const expect = chai.expect
33 33
34describe('Test video abuses', function () { 34describe('Test video abuses', function () {
35 let servers: ServerInfo[] = [] 35 let servers: ServerInfo[] = []
36 let abuseServer2: Abuse 36 let abuseServer2: AdminAbuse
37 37
38 before(async function () { 38 before(async function () {
39 this.timeout(50000) 39 this.timeout(50000)
@@ -97,7 +97,7 @@ describe('Test video abuses', function () {
97 expect(res1.body.data).to.be.an('array') 97 expect(res1.body.data).to.be.an('array')
98 expect(res1.body.data.length).to.equal(1) 98 expect(res1.body.data.length).to.equal(1)
99 99
100 const abuse: Abuse = res1.body.data[0] 100 const abuse: AdminAbuse = res1.body.data[0]
101 expect(abuse.reason).to.equal('my super bad reason') 101 expect(abuse.reason).to.equal('my super bad reason')
102 expect(abuse.reporterAccount.name).to.equal('root') 102 expect(abuse.reporterAccount.name).to.equal('root')
103 expect(abuse.reporterAccount.host).to.equal('localhost:' + servers[0].port) 103 expect(abuse.reporterAccount.host).to.equal('localhost:' + servers[0].port)
@@ -130,7 +130,7 @@ describe('Test video abuses', function () {
130 expect(res1.body.data).to.be.an('array') 130 expect(res1.body.data).to.be.an('array')
131 expect(res1.body.data.length).to.equal(2) 131 expect(res1.body.data.length).to.equal(2)
132 132
133 const abuse1: Abuse = res1.body.data[0] 133 const abuse1: AdminAbuse = res1.body.data[0]
134 expect(abuse1.reason).to.equal('my super bad reason') 134 expect(abuse1.reason).to.equal('my super bad reason')
135 expect(abuse1.reporterAccount.name).to.equal('root') 135 expect(abuse1.reporterAccount.name).to.equal('root')
136 expect(abuse1.reporterAccount.host).to.equal('localhost:' + servers[0].port) 136 expect(abuse1.reporterAccount.host).to.equal('localhost:' + servers[0].port)
@@ -141,7 +141,7 @@ describe('Test video abuses', function () {
141 expect(abuse1.video.countReports).to.equal(1) 141 expect(abuse1.video.countReports).to.equal(1)
142 expect(abuse1.video.nthReport).to.equal(1) 142 expect(abuse1.video.nthReport).to.equal(1)
143 143
144 const abuse2: Abuse = res1.body.data[1] 144 const abuse2: AdminAbuse = res1.body.data[1]
145 expect(abuse2.reason).to.equal('my super bad reason 2') 145 expect(abuse2.reason).to.equal('my super bad reason 2')
146 expect(abuse2.reporterAccount.name).to.equal('root') 146 expect(abuse2.reporterAccount.name).to.equal('root')
147 expect(abuse2.reporterAccount.host).to.equal('localhost:' + servers[0].port) 147 expect(abuse2.reporterAccount.host).to.equal('localhost:' + servers[0].port)
@@ -245,7 +245,7 @@ describe('Test video abuses', function () {
245 expect(res.body.data.length).to.equal(2, "wrong number of videos returned") 245 expect(res.body.data.length).to.equal(2, "wrong number of videos returned")
246 expect(res.body.data[0].id).to.equal(abuseServer2.id, "wrong origin server id for first video") 246 expect(res.body.data[0].id).to.equal(abuseServer2.id, "wrong origin server id for first video")
247 247
248 const abuse: Abuse = res.body.data[0] 248 const abuse: AdminAbuse = res.body.data[0]
249 expect(abuse.video.id).to.equal(abuseServer2.video.id, "wrong video id") 249 expect(abuse.video.id).to.equal(abuseServer2.video.id, "wrong video id")
250 expect(abuse.video.channel).to.exist 250 expect(abuse.video.channel).to.exist
251 expect(abuse.video.deleted).to.be.true 251 expect(abuse.video.deleted).to.be.true
@@ -279,7 +279,7 @@ describe('Test video abuses', function () {
279 const res2 = await getVideoAbusesList({ url: servers[0].url, token: servers[0].accessToken }) 279 const res2 = await getVideoAbusesList({ url: servers[0].url, token: servers[0].accessToken })
280 280
281 { 281 {
282 for (const abuse of res2.body.data as Abuse[]) { 282 for (const abuse of res2.body.data as AdminAbuse[]) {
283 if (abuse.video.id === video3.id) { 283 if (abuse.video.id === video3.id) {
284 expect(abuse.video.countReports).to.equal(1, "wrong reports count for video 3") 284 expect(abuse.video.countReports).to.equal(1, "wrong reports count for video 3")
285 expect(abuse.video.nthReport).to.equal(1, "wrong report position in report list for video 3") 285 expect(abuse.video.nthReport).to.equal(1, "wrong report position in report list for video 3")
@@ -311,7 +311,7 @@ describe('Test video abuses', function () {
311 const res = await getVideoAbusesList({ url: servers[0].url, token: servers[0].accessToken }) 311 const res = await getVideoAbusesList({ url: servers[0].url, token: servers[0].accessToken })
312 312
313 { 313 {
314 const abuse = (res.body.data as Abuse[]).find(a => a.id === createdAbuse.id) 314 const abuse = (res.body.data as AdminAbuse[]).find(a => a.id === createdAbuse.id)
315 expect(abuse.reason).to.equals(reason5) 315 expect(abuse.reason).to.equals(reason5)
316 expect(abuse.predefinedReasons).to.deep.equals(predefinedReasons5, "predefined reasons do not match the one reported") 316 expect(abuse.predefinedReasons).to.deep.equals(predefinedReasons5, "predefined reasons do not match the one reported")
317 expect(abuse.video.startAt).to.equal(1, "starting timestamp doesn't match the one reported") 317 expect(abuse.video.startAt).to.equal(1, "starting timestamp doesn't match the one reported")
@@ -350,7 +350,7 @@ describe('Test video abuses', function () {
350 350
351 const res = await getVideoAbusesList(options) 351 const res = await getVideoAbusesList(options)
352 352
353 return res.body.data as Abuse[] 353 return res.body.data as AdminAbuse[]
354 } 354 }
355 355
356 expect(await list({ id: 56 })).to.have.lengthOf(0) 356 expect(await list({ id: 56 })).to.have.lengthOf(0)