diff options
author | Kim <1877318+kimsible@users.noreply.github.com> | 2020-04-20 10:28:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-20 10:28:38 +0200 |
commit | b1770a0af464ad6350d156245b1abcc1395e142e (patch) | |
tree | 0712a2cd912ecd3f41084134d513920a6f723fb6 /server/tests | |
parent | 8f31261f77c6e521917b3f629b223ccc8df50960 (diff) | |
download | PeerTube-b1770a0af464ad6350d156245b1abcc1395e142e.tar.gz PeerTube-b1770a0af464ad6350d156245b1abcc1395e142e.tar.zst PeerTube-b1770a0af464ad6350d156245b1abcc1395e142e.zip |
Add thumbnail / preview generation from url on the fly (#2646)
* Add thumbnails generation on the fly to URL import
* Display generated preview to import first edit
* Use ternary to get type inference
* Move preview/thumbnail test just after import
Co-authored-by: kimsible <kimsible@users.noreply.github.com>
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/videos/video-imports.ts | 5 | ||||
-rw-r--r-- | server/tests/fixtures/video_import_preview.jpg | bin | 0 -> 37360 bytes | |||
-rw-r--r-- | server/tests/fixtures/video_import_thumbnail.jpg | bin | 0 -> 5885 bytes |
3 files changed, 5 insertions, 0 deletions
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts index 8e179b825..4d5989f43 100644 --- a/server/tests/api/videos/video-imports.ts +++ b/server/tests/api/videos/video-imports.ts | |||
@@ -19,6 +19,7 @@ import { | |||
19 | } from '../../../../shared/extra-utils' | 19 | } from '../../../../shared/extra-utils' |
20 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | 20 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' |
21 | import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports' | 21 | import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports' |
22 | import { testImage } from '../../../../shared/extra-utils/miscs/miscs' | ||
22 | 23 | ||
23 | const expect = chai.expect | 24 | const expect = chai.expect |
24 | 25 | ||
@@ -118,6 +119,10 @@ describe('Test video imports', function () { | |||
118 | const attributes = immutableAssign(baseAttributes, { targetUrl: getYoutubeVideoUrl() }) | 119 | const attributes = immutableAssign(baseAttributes, { targetUrl: getYoutubeVideoUrl() }) |
119 | const res = await importVideo(servers[0].url, servers[0].accessToken, attributes) | 120 | const res = await importVideo(servers[0].url, servers[0].accessToken, attributes) |
120 | expect(res.body.video.name).to.equal('small video - youtube') | 121 | expect(res.body.video.name).to.equal('small video - youtube') |
122 | expect(res.body.video.thumbnailPath).to.equal(`/static/thumbnails/${res.body.video.uuid}.jpg`) | ||
123 | expect(res.body.video.previewPath).to.equal(`/static/previews/${res.body.video.uuid}.jpg`) | ||
124 | await testImage(servers[0].url, 'video_import_thumbnail', res.body.video.thumbnailPath) | ||
125 | await testImage(servers[0].url, 'video_import_preview', res.body.video.previewPath) | ||
121 | 126 | ||
122 | const resCaptions = await listVideoCaptions(servers[0].url, res.body.video.id) | 127 | const resCaptions = await listVideoCaptions(servers[0].url, res.body.video.id) |
123 | const videoCaptions: VideoCaption[] = resCaptions.body.data | 128 | const videoCaptions: VideoCaption[] = resCaptions.body.data |
diff --git a/server/tests/fixtures/video_import_preview.jpg b/server/tests/fixtures/video_import_preview.jpg new file mode 100644 index 000000000..1f8d1d91d --- /dev/null +++ b/server/tests/fixtures/video_import_preview.jpg | |||
Binary files differ | |||
diff --git a/server/tests/fixtures/video_import_thumbnail.jpg b/server/tests/fixtures/video_import_thumbnail.jpg new file mode 100644 index 000000000..fcc50b75f --- /dev/null +++ b/server/tests/fixtures/video_import_thumbnail.jpg | |||
Binary files differ | |||