]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/video-captions.ts
emit more specific status codes on video upload (#3423)
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / video-captions.ts
index 57bee713f9c1ce182e02b1ce728c03803189c749..00e04d69d3dcac19222bd8dd44b89d70a9653138 100644 (file)
@@ -1,18 +1,24 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import * as chai from 'chai'
 import 'mocha'
 import {
   checkVideoFilesWereRemoved,
+  cleanupTests,
   doubleFollow,
   flushAndRunMultipleServers,
   removeVideo,
   uploadVideo,
   wait
-} from '../../../../shared/utils'
-import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from '../../../../shared/utils/index'
-import { waitJobs } from '../../../../shared/utils/server/jobs'
-import { createVideoCaption, deleteVideoCaption, listVideoCaptions, testCaptionFile } from '../../../../shared/utils/videos/video-captions'
+} from '../../../../shared/extra-utils'
+import { ServerInfo, setAccessTokensToServers } from '../../../../shared/extra-utils/index'
+import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
+import {
+  createVideoCaption,
+  deleteVideoCaption,
+  listVideoCaptions,
+  testCaptionFile
+} from '../../../../shared/extra-utils/videos/video-captions'
 import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model'
 
 const expect = chai.expect
@@ -24,8 +30,6 @@ describe('Test video captions', function () {
   before(async function () {
     this.timeout(30000)
 
-    await flushTests()
-
     servers = await flushAndRunMultipleServers(2)
 
     await setAccessTokensToServers(servers)
@@ -33,7 +37,7 @@ describe('Test video captions', function () {
 
     await waitJobs(servers)
 
-    const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, { name: 'my video name' })
+    const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'my video name' })
     videoUUID = res.body.video.uuid
 
     await waitJobs(servers)
@@ -79,13 +83,13 @@ describe('Test video captions', function () {
       const caption1: VideoCaption = res.body.data[0]
       expect(caption1.language.id).to.equal('ar')
       expect(caption1.language.label).to.equal('Arabic')
-      expect(caption1.captionPath).to.equal('/static/video-captions/' + videoUUID + '-ar.vtt')
+      expect(caption1.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-ar.vtt')
       await testCaptionFile(server.url, caption1.captionPath, 'Subtitle good 1.')
 
       const caption2: VideoCaption = res.body.data[1]
       expect(caption2.language.id).to.equal('zh')
       expect(caption2.language.label).to.equal('Chinese')
-      expect(caption2.captionPath).to.equal('/static/video-captions/' + videoUUID + '-zh.vtt')
+      expect(caption2.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-zh.vtt')
       await testCaptionFile(server.url, caption2.captionPath, 'Subtitle good 2.')
     }
   })
@@ -113,7 +117,7 @@ describe('Test video captions', function () {
       const caption1: VideoCaption = res.body.data[0]
       expect(caption1.language.id).to.equal('ar')
       expect(caption1.language.label).to.equal('Arabic')
-      expect(caption1.captionPath).to.equal('/static/video-captions/' + videoUUID + '-ar.vtt')
+      expect(caption1.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-ar.vtt')
       await testCaptionFile(server.url, caption1.captionPath, 'Subtitle good 2.')
     }
   })
@@ -144,7 +148,7 @@ describe('Test video captions', function () {
       const caption1: VideoCaption = res.body.data[0]
       expect(caption1.language.id).to.equal('ar')
       expect(caption1.language.label).to.equal('Arabic')
-      expect(caption1.captionPath).to.equal('/static/video-captions/' + videoUUID + '-ar.vtt')
+      expect(caption1.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-ar.vtt')
 
       const expected = 'WEBVTT FILE\r\n' +
         '\r\n' +
@@ -181,7 +185,7 @@ describe('Test video captions', function () {
 
       expect(caption.language.id).to.equal('zh')
       expect(caption.language.label).to.equal('Chinese')
-      expect(caption.captionPath).to.equal('/static/video-captions/' + videoUUID + '-zh.vtt')
+      expect(caption.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-zh.vtt')
       await testCaptionFile(server.url, caption.captionPath, 'Subtitle good 2.')
     }
   })
@@ -193,6 +197,6 @@ describe('Test video captions', function () {
   })
 
   after(async function () {
-    killallServers(servers)
+    await cleanupTests(servers)
   })
 })