+ it('Should run filter:api.video.pre-import-url.accept.result', async function () {
+ const baseAttributes = {
+ name: 'normal title',
+ privacy: VideoPrivacy.PUBLIC,
+ channelId: servers[0].videoChannel.id,
+ targetUrl: getGoodVideoUrl() + 'bad'
+ }
+ await importVideo(servers[0].url, servers[0].accessToken, baseAttributes, 403)
+ })
+
+ it('Should run filter:api.video.pre-import-torrent.accept.result', async function () {
+ const baseAttributes = {
+ name: 'bad torrent',
+ privacy: VideoPrivacy.PUBLIC,
+ channelId: servers[0].videoChannel.id,
+ torrentfile: 'video-720p.torrent' as any
+ }
+ await importVideo(servers[0].url, servers[0].accessToken, baseAttributes, 403)
+ })
+
+ it('Should run filter:api.video.post-import-url.accept.result', async function () {
+ this.timeout(60000)
+
+ let videoImportId: number
+
+ {
+ const baseAttributes = {
+ name: 'title with bad word',
+ privacy: VideoPrivacy.PUBLIC,
+ channelId: servers[0].videoChannel.id,
+ targetUrl: getGoodVideoUrl()
+ }
+ const res = await importVideo(servers[0].url, servers[0].accessToken, baseAttributes)
+ videoImportId = res.body.id
+ }
+
+ await waitJobs(servers)
+
+ {
+ const res = await getMyVideoImports(servers[0].url, servers[0].accessToken)
+ const videoImports = res.body.data as VideoImport[]
+
+ const videoImport = videoImports.find(i => i.id === videoImportId)
+
+ expect(videoImport.state.id).to.equal(VideoImportState.REJECTED)
+ expect(videoImport.state.label).to.equal('Rejected')
+ }
+ })
+
+ it('Should run filter:api.video.post-import-torrent.accept.result', async function () {
+ this.timeout(60000)
+
+ let videoImportId: number
+
+ {
+ const baseAttributes = {
+ name: 'title with bad word',
+ privacy: VideoPrivacy.PUBLIC,
+ channelId: servers[0].videoChannel.id,
+ torrentfile: 'video-720p.torrent' as any
+ }
+ const res = await importVideo(servers[0].url, servers[0].accessToken, baseAttributes)
+ videoImportId = res.body.id
+ }
+
+ await waitJobs(servers)
+
+ {
+ const res = await getMyVideoImports(servers[0].url, servers[0].accessToken)
+ const videoImports = res.body.data as VideoImport[]
+
+ const videoImport = videoImports.find(i => i.id === videoImportId)
+
+ expect(videoImport.state.id).to.equal(VideoImportState.REJECTED)
+ expect(videoImport.state.label).to.equal('Rejected')
+ }
+ })
+