aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-11 19:16:00 +0200
committerChocobozzz <me@florianbigard.com>2018-06-11 19:16:00 +0200
commit6ccdf3a23ecec5ba2eeaf487fd1fafdc7606b4bf (patch)
treefdbae8827da56dc9039925b090add90ce24a6e2c /server/tests/cli
parent77540346413259e4ec62ee8302e503bcd2a01047 (diff)
downloadPeerTube-6ccdf3a23ecec5ba2eeaf487fd1fafdc7606b4bf.tar.gz
PeerTube-6ccdf3a23ecec5ba2eeaf487fd1fafdc7606b4bf.tar.zst
PeerTube-6ccdf3a23ecec5ba2eeaf487fd1fafdc7606b4bf.zip
Fix import with when the imported file has the same extension than an
already existing file
Diffstat (limited to 'server/tests/cli')
-rw-r--r--server/tests/cli/create-import-video-file-job.ts32
1 files changed, 28 insertions, 4 deletions
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts
index 372c7e517..1472e60f6 100644
--- a/server/tests/cli/create-import-video-file-job.ts
+++ b/server/tests/cli/create-import-video-file-job.ts
@@ -73,22 +73,22 @@ describe('Test create import video jobs', function () {
73 73
74 expect(videoDetail.files).to.have.lengthOf(2) 74 expect(videoDetail.files).to.have.lengthOf(2)
75 const [originalVideo, transcodedVideo] = videoDetail.files 75 const [originalVideo, transcodedVideo] = videoDetail.files
76 assertVideoProperties(originalVideo, 720, 'webm') 76 assertVideoProperties(originalVideo, 720, 'webm', 218910)
77 assertVideoProperties(transcodedVideo, 480, 'webm') 77 assertVideoProperties(transcodedVideo, 480, 'webm', 69217)
78 78
79 if (!magnetUri) magnetUri = transcodedVideo.magnetUri 79 if (!magnetUri) magnetUri = transcodedVideo.magnetUri
80 else expect(transcodedVideo.magnetUri).to.equal(magnetUri) 80 else expect(transcodedVideo.magnetUri).to.equal(magnetUri)
81 } 81 }
82 }) 82 })
83 83
84 it('Should run a import job on video 2 with the same resolution', async function () { 84 it('Should run a import job on video 2 with the same resolution and a different extension', async function () {
85 const env = getEnvCli(servers[1]) 85 const env = getEnvCli(servers[1])
86 await execCLI(`${env} npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/fixtures/video_short.ogv`) 86 await execCLI(`${env} npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/fixtures/video_short.ogv`)
87 87
88 await wait(30000) 88 await wait(30000)
89 89
90 let magnetUri: string 90 let magnetUri: string
91 for (const server of servers.reverse()) { 91 for (const server of servers) {
92 const { data: videos } = (await getVideosList(server.url)).body 92 const { data: videos } = (await getVideosList(server.url)).body
93 expect(videos).to.have.lengthOf(2) 93 expect(videos).to.have.lengthOf(2)
94 94
@@ -107,6 +107,30 @@ describe('Test create import video jobs', function () {
107 } 107 }
108 }) 108 })
109 109
110 it('Should run a import job on video 2 with the same resolution and the same extension', async function () {
111 const env = getEnvCli(servers[0])
112 await execCLI(`${env} npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short2.webm`)
113
114 await wait(30000)
115
116 let magnetUri: string
117 for (const server of servers) {
118 const { data: videos } = (await getVideosList(server.url)).body
119 expect(videos).to.have.lengthOf(2)
120
121 const video = videos.find(({ uuid }) => uuid === video1UUID)
122 const videoDetail: VideoDetails = (await getVideo(server.url, video.uuid)).body
123
124 expect(videoDetail.files).to.have.lengthOf(2)
125 const [ video720, video480 ] = videoDetail.files
126 assertVideoProperties(video720, 720, 'webm', 942961)
127 assertVideoProperties(video480, 480, 'webm', 69217)
128
129 if (!magnetUri) magnetUri = video720.magnetUri
130 else expect(video720.magnetUri).to.equal(magnetUri)
131 }
132 })
133
110 after(async function () { 134 after(async function () {
111 killallServers(servers) 135 killallServers(servers)
112 136