]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/plugins.ts
Introduce server commands
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / plugins.ts
index 6e540bcbbf1ece86c6c67bf34c554a0aaf3a252d..8509b8ac5b8e46a8be0f4f93cdc87e53da2725ab 100644 (file)
@@ -1,7 +1,7 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
-
+import { HttpStatusCode } from '@shared/core-utils'
 import {
   checkBadCountPagination,
   checkBadSortPagination,
@@ -9,16 +9,14 @@ import {
   cleanupTests,
   createUser,
   flushAndRunServer,
-  immutableAssign,
-  installPlugin,
-  makeGetRequest, makePostBodyRequest, makePutBodyRequest,
+  makeGetRequest,
+  makePostBodyRequest,
+  makePutBodyRequest,
   ServerInfo,
   setAccessTokensToServers,
   userLogin
-} from '../../../../shared/extra-utils'
-import { PluginType } from '../../../../shared/models/plugins/plugin.type'
-import { PeerTubePlugin } from '../../../../shared/models/plugins/peertube-plugin.model'
-import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
+} from '@shared/extra-utils'
+import { PeerTubePlugin, PluginType } from '@shared/models'
 
 describe('Test server plugins API validators', function () {
   let server: ServerInfo
@@ -50,13 +48,13 @@ describe('Test server plugins API validators', function () {
     userAccessToken = await userLogin(server, user)
 
     {
-      const res = await installPlugin({ url: server.url, accessToken: server.accessToken, npmName: npmPlugin })
+      const res = await server.pluginsCommand.install({ npmName: npmPlugin })
       const plugin = res.body as PeerTubePlugin
       npmVersion = plugin.version
     }
 
     {
-      const res = await installPlugin({ url: server.url, accessToken: server.accessToken, npmName: themePlugin })
+      const res = await server.pluginsCommand.install({ npmName: themePlugin })
       const plugin = res.body as PeerTubePlugin
       themeVersion = plugin.version
     }
@@ -201,7 +199,7 @@ describe('Test server plugins API validators', function () {
     })
 
     it('Should fail with an invalid plugin type', async function () {
-      const query = immutableAssign(baseQuery, { pluginType: 5 })
+      const query = { ...baseQuery, pluginType: 5 }
 
       await makeGetRequest({
         url: server.url,
@@ -212,7 +210,7 @@ describe('Test server plugins API validators', function () {
     })
 
     it('Should fail with an invalid current peertube engine', async function () {
-      const query = immutableAssign(baseQuery, { currentPeerTubeEngine: '1.0' })
+      const query = { ...baseQuery, currentPeerTubeEngine: '1.0' }
 
       await makeGetRequest({
         url: server.url,
@@ -272,7 +270,7 @@ describe('Test server plugins API validators', function () {
     })
 
     it('Should fail with an invalid plugin type', async function () {
-      const query = immutableAssign(baseQuery, { pluginType: 5 })
+      const query = { ...baseQuery, pluginType: 5 }
 
       await makeGetRequest({
         url: server.url,