]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/cli/peertube.ts
Speedup CI
[github/Chocobozzz/PeerTube.git] / server / tests / cli / peertube.ts
index 15b6755f22d1338622944afcd77fd3d5abc75f6c..fcf7e2e2e50c253b14d187a7f82f0bc490612fb5 100644 (file)
@@ -1,24 +1,29 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
 import { expect } from 'chai'
+import { Video, VideoDetails } from '../../../shared'
 import {
   addVideoChannel,
+  areHttpImportTestsDisabled,
   buildAbsoluteFixturePath,
   cleanupTests,
-  createUser, doubleFollow,
+  createUser,
+  doubleFollow,
   execCLI,
   flushAndRunServer,
-  getEnvCli, getLocalIdByUUID,
+  getEnvCli,
+  getLocalIdByUUID,
   getVideo,
   getVideosList,
-  getVideosListWithToken, removeVideo,
+  removeVideo,
   ServerInfo,
-  setAccessTokensToServers, uploadVideo, uploadVideoAndGetId,
+  setAccessTokensToServers,
+  testHelloWorldRegisteredSettings,
+  uploadVideoAndGetId,
   userLogin,
   waitJobs
 } from '../../../shared/extra-utils'
-import { Video, VideoDetails } from '../../../shared'
 import { getYoutubeVideoUrl } from '../../../shared/extra-utils/videos/video-imports'
 
 describe('Test CLI wrapper', function () {
@@ -61,6 +66,18 @@ describe('Test CLI wrapper', function () {
       await execCLI(`${env} ${cmd} auth add -u ${server.url} -U user_1 -p super_password`)
     })
 
+    it('Should not fail to add a user if there is a slash at the end of the instance URL', async function () {
+      this.timeout(60000)
+
+      const env = getEnvCli(server)
+      let fullServerURL
+      fullServerURL = server.url + '/'
+      await execCLI(`${env} ${cmd} auth add -u ${fullServerURL} -U user_1 -p super_password`)
+
+      fullServerURL = server.url + '/asdfasdf'
+      await execCLI(`${env} ${cmd} auth add -u ${fullServerURL} -U user_1 -p super_password`)
+    })
+
     it('Should default to this user', async function () {
       this.timeout(60000)
 
@@ -101,7 +118,7 @@ describe('Test CLI wrapper', function () {
 
       const videos: Video[] = res.body.data
 
-      const video: VideoDetails = (await getVideo(server.url, videos[ 0 ].uuid)).body
+      const video: VideoDetails = (await getVideo(server.url, videos[0].uuid)).body
 
       expect(video.name).to.equal('test upload')
       expect(video.support).to.equal('support_text')
@@ -109,6 +126,8 @@ describe('Test CLI wrapper', function () {
     })
 
     it('Should import a video', async function () {
+      if (areHttpImportTestsDisabled()) return
+
       this.timeout(60000)
 
       const env = getEnvCli(server)
@@ -119,6 +138,8 @@ describe('Test CLI wrapper', function () {
     })
 
     it('Should have imported the video', async function () {
+      if (areHttpImportTestsDisabled()) return
+
       this.timeout(60000)
 
       await waitJobs([ server ])
@@ -141,6 +162,8 @@ describe('Test CLI wrapper', function () {
     })
 
     it('Should import and override some imported attributes', async function () {
+      if (areHttpImportTestsDisabled()) return
+
       this.timeout(60000)
 
       const env = getEnvCli(server)
@@ -195,6 +218,10 @@ describe('Test CLI wrapper', function () {
       await execCLI(`${env} ${cmd} plugins install --npm-name peertube-plugin-hello-world`)
     })
 
+    it('Should have registered settings', async function () {
+      await testHelloWorldRegisteredSettings(server)
+    })
+
     it('Should list installed plugins', async function () {
       const env = getEnvCli(server)
       const res = await execCLI(`${env} ${cmd} plugins list`)
@@ -250,7 +277,7 @@ describe('Test CLI wrapper', function () {
       {
         const env = getEnvCli(server)
 
-        const params = `list-my-redundancies`
+        const params = 'list-my-redundancies'
         const stdout = await execCLI(`${env} ${cmd} redundancy ${params}`)
 
         expect(stdout).to.contain('super video')
@@ -271,7 +298,7 @@ describe('Test CLI wrapper', function () {
 
       {
         const env = getEnvCli(server)
-        const params = `list-my-redundancies`
+        const params = 'list-my-redundancies'
         const stdout = await execCLI(`${env} ${cmd} redundancy ${params}`)
 
         expect(stdout).to.not.contain('super video')