]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/multiple-servers.ts
Move original publication date in advanced settings
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / multiple-servers.ts
index 516dc5aba2ab2436af7a01cbbae279b23a4da85b..1b471ba799b36b5207abb1cb001186d6d825bba5 100644 (file)
@@ -6,9 +6,9 @@ import { join } from 'path'
 import * as request from 'supertest'
 import { VideoPrivacy } from '../../../../shared/models/videos'
 import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
-
 import {
   addVideoChannel,
+  checkTmpIsEmpty,
   checkVideoFilesWereRemoved,
   completeVideoCheck,
   createUser,
@@ -32,15 +32,15 @@ import {
   viewVideo,
   wait,
   webtorrentAdd
-} from '../../utils'
+} from '../../../../shared/utils'
 import {
   addVideoCommentReply,
   addVideoCommentThread,
   deleteVideoComment,
   getVideoCommentThreads,
   getVideoThreadComments
-} from '../../utils/videos/video-comments'
-import { waitJobs } from '../../utils/server/jobs'
+} from '../../../../shared/utils/videos/video-comments'
+import { waitJobs } from '../../../../shared/utils/server/jobs'
 
 const expect = chai.expect
 
@@ -60,6 +60,7 @@ describe('Test multiple servers', function () {
 
     {
       const videoChannel = {
+        name: 'super_channel_name',
         displayName: 'my channel',
         description: 'super channel'
       }
@@ -127,8 +128,10 @@ describe('Test multiple servers', function () {
           tags: [ 'tag1p1', 'tag2p1' ],
           privacy: VideoPrivacy.PUBLIC,
           commentsEnabled: true,
+          downloadEnabled: true,
           channel: {
-            name: 'my channel',
+            displayName: 'my channel',
+            name: 'super_channel_name',
             description: 'super channel',
             isLocal
           },
@@ -197,11 +200,13 @@ describe('Test multiple servers', function () {
           },
           isLocal,
           commentsEnabled: true,
+          downloadEnabled: true,
           duration: 5,
           tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
           privacy: VideoPrivacy.PUBLIC,
           channel: {
-            name: 'Default user1 channel',
+            displayName: 'Main user1 channel',
+            name: 'user1_channel',
             description: 'super channel',
             isLocal
           },
@@ -209,19 +214,19 @@ describe('Test multiple servers', function () {
           files: [
             {
               resolution: 240,
-              size: 280000
+              size: 187000
             },
             {
               resolution: 360,
-              size: 370000
+              size: 278000
             },
             {
               resolution: 480,
-              size: 470000
+              size: 383000
             },
             {
               resolution: 720,
-              size: 740000
+              size: 706000
             }
           ],
           thumbnailfile: 'thumbnail',
@@ -304,10 +309,12 @@ describe('Test multiple servers', function () {
           isLocal,
           duration: 5,
           commentsEnabled: true,
+          downloadEnabled: true,
           tags: [ 'tag1p3' ],
           privacy: VideoPrivacy.PUBLIC,
           channel: {
-            name: 'Default root channel',
+            displayName: 'Main root channel',
+            name: 'root_channel',
             description: '',
             isLocal
           },
@@ -334,12 +341,14 @@ describe('Test multiple servers', function () {
             host: 'localhost:9003'
           },
           commentsEnabled: true,
+          downloadEnabled: true,
           isLocal,
           duration: 5,
           tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
           privacy: VideoPrivacy.PUBLIC,
           channel: {
-            name: 'Default root channel',
+            displayName: 'Main root channel',
+            name: 'root_channel',
             description: '',
             isLocal
           },
@@ -488,7 +497,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should view multiple videos on owned servers', async function () {
-      this.timeout(15000)
+      this.timeout(30000)
 
       const tasks: Promise<any>[] = []
       await viewVideo(servers[2].url, localVideosServer3[0])
@@ -507,6 +516,9 @@ describe('Test multiple servers', function () {
 
       await waitJobs(servers)
 
+      // Wait the repeatable job
+      await wait(6000)
+
       for (const server of servers) {
         const res = await getVideosList(server.url)
 
@@ -520,7 +532,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should view multiple videos on each servers', async function () {
-      this.timeout(15000)
+      this.timeout(30000)
 
       const tasks: Promise<any>[] = []
       tasks.push(viewVideo(servers[0].url, remoteVideosServer1[0]))
@@ -538,6 +550,9 @@ describe('Test multiple servers', function () {
 
       await waitJobs(servers)
 
+      // Wait the repeatable job
+      await wait(8000)
+
       let baseVideos = null
 
       for (const server of servers) {
@@ -644,10 +659,12 @@ describe('Test multiple servers', function () {
           isLocal,
           duration: 5,
           commentsEnabled: true,
+          downloadEnabled: true,
           tags: [ 'tag_up_1', 'tag_up_2' ],
           privacy: VideoPrivacy.PUBLIC,
           channel: {
-            name: 'Default root channel',
+            displayName: 'Main root channel',
+            name: 'root_channel',
             description: '',
             isLocal
           },
@@ -902,11 +919,12 @@ describe('Test multiple servers', function () {
       }
     })
 
-    it('Should disable comments', async function () {
+    it('Should disable comments and download', async function () {
       this.timeout(20000)
 
       const attributes = {
-        commentsEnabled: false
+        commentsEnabled: false,
+        downloadEnabled: false
       }
 
       await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, attributes)
@@ -916,6 +934,7 @@ describe('Test multiple servers', function () {
       for (const server of servers) {
         const res = await getVideo(server.url, videoUUID)
         expect(res.body.commentsEnabled).to.be.false
+        expect(res.body.downloadEnabled).to.be.false
 
         const text = 'my super forbidden comment'
         await addVideoCommentThread(server.url, server.accessToken, videoUUID, text, 409)
@@ -964,10 +983,12 @@ describe('Test multiple servers', function () {
           isLocal,
           duration: 5,
           commentsEnabled: false,
+          downloadEnabled: false,
           tags: [ ],
           privacy: VideoPrivacy.PUBLIC,
           channel: {
-            name: 'Default root channel',
+            displayName: 'Main root channel',
+            name: 'root_channel',
             description: '',
             isLocal
           },
@@ -975,19 +996,19 @@ describe('Test multiple servers', function () {
           files: [
             {
               resolution: 720,
-              size: 36000
+              size: 72000
             },
             {
               resolution: 480,
-              size: 21000
+              size: 45000
             },
             {
               resolution: 360,
-              size: 17000
+              size: 34600
             },
             {
               resolution: 240,
-              size: 13000
+              size: 24770
             }
           ]
         }
@@ -996,6 +1017,14 @@ describe('Test multiple servers', function () {
     })
   })
 
+  describe('TMP directory', function () {
+    it('Should have an empty tmp directory', async function () {
+      for (const server of servers) {
+        await checkTmpIsEmpty(server)
+      }
+    })
+  })
+
   after(async function () {
     killallServers(servers)