]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/video-imports.ts
Bumped to version v5.2.1
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / video-imports.ts
index 0583134b2e2be0e8a6756166cfb4ef166f3ac306..192b2aeb9ae7c705090ee2ecf90d1eaeb23e8ef0 100644 (file)
@@ -23,9 +23,8 @@ async function checkVideosServer1 (server: PeerTubeServer, idHttp: string, idMag
   const videoHttp = await server.videos.get({ id: idHttp })
 
   expect(videoHttp.name).to.equal('small video - youtube')
-  // FIXME: youtube-dl seems broken
-  // expect(videoHttp.category.label).to.equal('News & Politics')
-  // expect(videoHttp.licence.label).to.equal('Attribution')
+  expect(videoHttp.category.label).to.equal('News & Politics')
+  expect(videoHttp.licence.label).to.equal('Attribution')
   expect(videoHttp.language.label).to.equal('Unknown')
   expect(videoHttp.nsfw).to.be.false
   expect(videoHttp.description).to.equal('this is a super description')
@@ -41,7 +40,7 @@ async function checkVideosServer1 (server: PeerTubeServer, idHttp: string, idMag
   const videoTorrent = await server.videos.get({ id: idTorrent })
 
   for (const video of [ videoMagnet, videoTorrent ]) {
-    expect(video.category.label).to.equal('Misc')
+    expect(video.category.label).to.equal('Unknown')
     expect(video.licence.label).to.equal('Unknown')
     expect(video.language.label).to.equal('Unknown')
     expect(video.nsfw).to.be.false
@@ -68,6 +67,8 @@ async function checkVideoServer2 (server: PeerTubeServer, id: number | string) {
   expect(video.description).to.equal('my super description')
   expect(video.tags).to.deep.equal([ 'supertag1', 'supertag2' ])
 
+  await testImage(server.url, 'thumbnail', video.thumbnailPath)
+
   expect(video.files).to.have.lengthOf(1)
 
   const bodyCaptions = await server.captions.list({ videoId: id })
@@ -254,18 +255,20 @@ describe('Test video imports', function () {
       it('Should import a video on server 2 with some fields', async function () {
         this.timeout(60_000)
 
-        const attributes = {
-          targetUrl: FIXTURE_URLS.youtube,
-          channelId: servers[1].store.channel.id,
-          privacy: VideoPrivacy.PUBLIC,
-          category: 10,
-          licence: 7,
-          language: 'en',
-          name: 'my super name',
-          description: 'my super description',
-          tags: [ 'supertag1', 'supertag2' ]
-        }
-        const { video } = await servers[1].imports.importVideo({ attributes })
+        const { video } = await servers[1].imports.importVideo({
+          attributes: {
+            targetUrl: FIXTURE_URLS.youtube,
+            channelId: servers[1].store.channel.id,
+            privacy: VideoPrivacy.PUBLIC,
+            category: 10,
+            licence: 7,
+            language: 'en',
+            name: 'my super name',
+            description: 'my super description',
+            tags: [ 'supertag1', 'supertag2' ],
+            thumbnailfile: 'thumbnail.jpg'
+          }
+        })
         expect(video.name).to.equal('my super name')
       })
 
@@ -446,6 +449,16 @@ describe('Test video imports', function () {
             const video = await server.videos.get({ id: videoUUID })
 
             expect(video.name).to.equal('E2E tests')
+
+            const { data: captions } = await server.captions.list({ videoId: videoUUID })
+            expect(captions).to.have.lengthOf(1)
+            expect(captions[0].language.id).to.equal('fr')
+
+            const str = `WEBVTT FILE\r?\n\r?\n` +
+            `1\r?\n` +
+            `00:00:04.000 --> 00:00:09.000\r?\n` +
+            `January 1, 1994. The North American`
+            await testCaptionFile(server.url, captions[0].captionPath, new RegExp(str))
           }
         }
       })
@@ -456,7 +469,8 @@ describe('Test video imports', function () {
     })
   }
 
-  runSuite('youtube-dl')
+  // FIXME: youtube-dl seems broken
+  // runSuite('youtube-dl')
 
   runSuite('yt-dlp')