]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/video-captions.ts
Merge branch 'release/v1.2.0'
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / video-captions.ts
index a3d7ac35dbc7fab1ff86e18ce2c854ad331b4755..e4d36fd4fe7e84c20cc87cbc454167c7ab323075 100644 (file)
@@ -13,8 +13,9 @@ import {
   setAccessTokensToServers,
   uploadVideo,
   userLogin
-} from '../../utils'
+} from '../../../../shared/utils'
 import { join } from 'path'
+import { createVideoCaption } from '../../../../shared/utils/videos/video-captions'
 
 describe('Test video captions API validator', function () {
   const path = '/api/v1/videos/'
@@ -143,6 +144,31 @@ describe('Test video captions API validator', function () {
       })
     })
 
+    // We don't check the extension yet
+    // it('Should fail with an invalid captionfile extension and octet-stream mime type', async function () {
+    //   await createVideoCaption({
+    //     url: server.url,
+    //     accessToken: server.accessToken,
+    //     language: 'zh',
+    //     videoId: videoUUID,
+    //     fixture: 'subtitle-bad.txt',
+    //     mimeType: 'application/octet-stream',
+    //     statusCodeExpected: 400
+    //   })
+    // })
+
+    it('Should succeed with a valid captionfile extension and octet-stream mime type', async function () {
+      await createVideoCaption({
+        url: server.url,
+        accessToken: server.accessToken,
+        language: 'zh',
+        videoId: videoUUID,
+        fixture: 'subtitle-good.srt',
+        mimeType: 'application/octet-stream'
+      })
+    })
+
+    // We don't check the file validity yet
     // it('Should fail with an invalid captionfile srt', async function () {
     //   const attaches = {
     //     'captionfile': join(__dirname, '..', '..', 'fixtures', 'subtitle-bad.srt')