]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/cli/update-host.ts
Precisions and security enhancements to the production guide (#287)
[github/Chocobozzz/PeerTube.git] / server / tests / cli / update-host.ts
index e31a8415682f7727c4b002b105828fd972b4cf40..39242c494cde3f027f7053d5d196c6eac95f0087 100644 (file)
@@ -1,3 +1,5 @@
+/* tslint:disable:no-unused-expression */
+
 import 'mocha'
 import * as chai from 'chai'
 const expect = chai.expect
@@ -13,7 +15,8 @@ import {
   ServerInfo,
   setAccessTokensToServers,
   uploadVideo,
-  wait
+  wait,
+  getVideo
 } from '../utils'
 
 describe('Test update host scripts', function () {
@@ -55,14 +58,22 @@ describe('Test update host scripts', function () {
     expect(videos).to.have.lengthOf(2)
 
     for (const video of videos) {
-      expect(video.files).to.have.lengthOf(5)
+      const res2 = await getVideo(server.url, video.id)
+      const videoDetails = res2.body
+
+      expect(videoDetails.files).to.have.lengthOf(4)
 
-      for (const file of video.files) {
+      for (const file of videoDetails.files) {
         expect(file.magnetUri).to.contain('localhost%3A9002%2Ftracker%2Fsocket')
         expect(file.magnetUri).to.contain('localhost%3A9002%2Fstatic%2Fwebseed%2F')
 
-        const torrent = await parseTorrentVideo(server, video.uuid, file.resolutionLabel)
-        expect(torrent.announce[0]).to.equal('ws://localhost:9002/tracker/socket')
+        const torrent = await parseTorrentVideo(server, videoDetails.uuid, file.resolution)
+        const announceWS = torrent.announce.find(a => a === 'ws://localhost:9002/tracker/socket')
+        expect(announceWS).to.not.be.undefined
+
+        const announceHttp = torrent.announce.find(a => a === 'http://localhost:9002/tracker/announce')
+        expect(announceHttp).to.not.be.undefined
+
         expect(torrent.urlList[0]).to.contain('http://localhost:9002/static/webseed')
       }
     }