]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/utils/videos/video-captions.ts
Try to cache video_high_bitrate_1080p in travis
[github/Chocobozzz/PeerTube.git] / server / tests / utils / videos / video-captions.ts
index 207e89632ba2c359a02c5554cee51eb6d18326f4..41e52be0702fcf97244cc3b6b67aca54964c29f6 100644 (file)
@@ -10,10 +10,15 @@ function createVideoCaption (args: {
   accessToken: string
   videoId: string | number
   language: string
-  fixture: string
+  fixture: string,
+  mimeType?: string,
+  statusCodeExpected?: number
 }) {
   const path = '/api/v1/videos/' + args.videoId + '/captions/' + args.language
 
+  const captionfile = buildAbsoluteFixturePath(args.fixture)
+  const captionfileAttach = args.mimeType ? [ captionfile, { contentType: args.mimeType } ] : captionfile
+
   return makeUploadRequest({
     method: 'PUT',
     url: args.url,
@@ -21,9 +26,9 @@ function createVideoCaption (args: {
     token: args.accessToken,
     fields: {},
     attaches: {
-      captionfile: buildAbsoluteFixturePath(args.fixture)
+      captionfile: captionfileAttach
     },
-    statusCodeExpected: 204
+    statusCodeExpected: args.statusCodeExpected || 204
   })
 }