+ const params = `--target-url ${ImportsCommand.getYoutubeVideoUrl()} --channel-name user_channel`
+ await cliCommand.execWithEnv(`${cmd} import ${params}`)
+ })
+
+ it('Should have imported the video', async function () {
+ if (areHttpImportTestsDisabled()) return
+
+ this.timeout(60000)
+
+ await waitJobs([ server ])
+
+ const res = await getVideosList(server.url)
+
+ expect(res.body.total).to.equal(2)
+
+ const videos: Video[] = res.body.data
+ const video = videos.find(v => v.name === 'small video - youtube')
+ expect(video).to.not.be.undefined
+
+ const videoDetails: VideoDetails = (await getVideo(server.url, video.id)).body
+ expect(videoDetails.channel.name).to.equal('user_channel')
+ expect(videoDetails.support).to.equal('super support text')
+ expect(videoDetails.nsfw).to.be.false
+
+ // So we can reimport it
+ await removeVideo(server.url, userAccessToken, video.id)
+ })
+
+ it('Should import and override some imported attributes', async function () {
+ if (areHttpImportTestsDisabled()) return
+
+ this.timeout(60000)
+
+ const params = `--target-url ${ImportsCommand.getYoutubeVideoUrl()} ` +
+ `--channel-name user_channel --video-name toto --nsfw --support support`
+ await cliCommand.execWithEnv(`${cmd} import ${params}`)
+
+ await waitJobs([ server ])
+
+ {
+ const res = await getVideosList(server.url)
+ expect(res.body.total).to.equal(2)
+
+ const videos: Video[] = res.body.data
+ const video = videos.find(v => v.name === 'toto')
+ expect(video).to.not.be.undefined
+
+ const videoDetails: VideoDetails = (await getVideo(server.url, video.id)).body
+ expect(videoDetails.channel.name).to.equal('user_channel')
+ expect(videoDetails.support).to.equal('support')
+ expect(videoDetails.nsfw).to.be.true
+ expect(videoDetails.commentsEnabled).to.be.true
+ }
+ })