]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/misc-endpoints.ts
Force signed headers in http signatures
[github/Chocobozzz/PeerTube.git] / server / tests / misc-endpoints.ts
index d78b62d60c35186fb4e8f86b03a5fc8b030075a6..3d02243232c9f71e85d7b6f3be807a9e8f0631bb 100644 (file)
@@ -1,14 +1,13 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
 import * as chai from 'chai'
 import {
   addVideoChannel,
+  cleanupTests,
   createUser,
-  flushTests,
-  killallServers,
+  flushAndRunServer,
   makeGetRequest,
-  runServer,
   ServerInfo,
   setAccessTokensToServers,
   uploadVideo
@@ -23,9 +22,7 @@ describe('Test misc endpoints', function () {
   before(async function () {
     this.timeout(120000)
 
-    await flushTests()
-
-    server = await runServer(1)
+    server = await flushAndRunServer(1)
     await setAccessTokensToServers([ server ])
   })
 
@@ -125,7 +122,7 @@ describe('Test misc endpoints', function () {
       })
 
       expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')
-      expect(res.text).to.contain('<url><loc>http://localhost:9001/about/instance</loc></url>')
+      expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>')
     })
 
     it('Should get the empty cached sitemap', async function () {
@@ -136,7 +133,7 @@ describe('Test misc endpoints', function () {
       })
 
       expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')
-      expect(res.text).to.contain('<url><loc>http://localhost:9001/about/instance</loc></url>')
+      expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>')
     })
 
     it('Should add videos, channel and accounts and get sitemap', async function () {
@@ -159,21 +156,21 @@ describe('Test misc endpoints', function () {
       })
 
       expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"')
-      expect(res.text).to.contain('<url><loc>http://localhost:9001/about/instance</loc></url>')
+      expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/about/instance</loc></url>')
 
-      expect(res.text).to.contain('<video:title><![CDATA[video 1]]></video:title>')
-      expect(res.text).to.contain('<video:title><![CDATA[video 2]]></video:title>')
-      expect(res.text).to.not.contain('<video:title><![CDATA[video 3]]></video:title>')
+      expect(res.text).to.contain('<video:title>video 1</video:title>')
+      expect(res.text).to.contain('<video:title>video 2</video:title>')
+      expect(res.text).to.not.contain('<video:title>video 3</video:title>')
 
-      expect(res.text).to.contain('<url><loc>http://localhost:9001/video-channels/channel1</loc></url>')
-      expect(res.text).to.contain('<url><loc>http://localhost:9001/video-channels/channel2</loc></url>')
+      expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/video-channels/channel1</loc></url>')
+      expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/video-channels/channel2</loc></url>')
 
-      expect(res.text).to.contain('<url><loc>http://localhost:9001/accounts/user1</loc></url>')
-      expect(res.text).to.contain('<url><loc>http://localhost:9001/accounts/user2</loc></url>')
+      expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/accounts/user1</loc></url>')
+      expect(res.text).to.contain('<url><loc>http://localhost:' + server.port + '/accounts/user2</loc></url>')
     })
   })
 
   after(async function () {
-    killallServers([ server ])
+    await cleanupTests([ server ])
   })
 })