aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-27 11:41:38 +0100
committerChocobozzz <me@florianbigard.com>2020-11-27 11:41:38 +0100
commit353f8bc0c7a71ad490e4501b8c80e13e5cec1932 (patch)
treea3a6c637e2baf57597c733dbc166b1959754bf34 /shared
parente2c1f7795752caf8cde19fdee8b9ab7fb16b0395 (diff)
downloadPeerTube-353f8bc0c7a71ad490e4501b8c80e13e5cec1932.tar.gz
PeerTube-353f8bc0c7a71ad490e4501b8c80e13e5cec1932.tar.zst
PeerTube-353f8bc0c7a71ad490e4501b8c80e13e5cec1932.zip
Add registered setting CLI plugin install test
Diffstat (limited to 'shared')
-rw-r--r--shared/extra-utils/server/plugins.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/shared/extra-utils/server/plugins.ts b/shared/extra-utils/server/plugins.ts
index 8f370f655..83db2f6b8 100644
--- a/shared/extra-utils/server/plugins.ts
+++ b/shared/extra-utils/server/plugins.ts
@@ -1,5 +1,9 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2
3import { expect } from 'chai'
1import { readJSON, writeJSON } from 'fs-extra' 4import { readJSON, writeJSON } from 'fs-extra'
2import { join } from 'path' 5import { join } from 'path'
6import { RegisteredServerSettings } from '@shared/models'
3import { PeertubePluginIndexList } from '../../models/plugins/peertube-plugin-index-list.model' 7import { PeertubePluginIndexList } from '../../models/plugins/peertube-plugin-index-list.model'
4import { PluginType } from '../../models/plugins/plugin.type' 8import { PluginType } from '../../models/plugins/plugin.type'
5import { buildServerDirectory, root } from '../miscs/miscs' 9import { buildServerDirectory, root } from '../miscs/miscs'
@@ -119,6 +123,21 @@ function getPluginRegisteredSettings (parameters: {
119 }) 123 })
120} 124}
121 125
126async function testHelloWorldRegisteredSettings (server: ServerInfo) {
127 const res = await getPluginRegisteredSettings({
128 url: server.url,
129 accessToken: server.accessToken,
130 npmName: 'peertube-plugin-hello-world'
131 })
132
133 const registeredSettings = (res.body as RegisteredServerSettings).registeredSettings
134
135 expect(registeredSettings).to.have.length.at.least(1)
136
137 const adminNameSettings = registeredSettings.find(s => s.name === 'admin-name')
138 expect(adminNameSettings).to.not.be.undefined
139}
140
122function getPublicSettings (parameters: { 141function getPublicSettings (parameters: {
123 url: string 142 url: string
124 npmName: string 143 npmName: string
@@ -265,6 +284,7 @@ export {
265 updatePlugin, 284 updatePlugin,
266 getPlugin, 285 getPlugin,
267 uninstallPlugin, 286 uninstallPlugin,
287 testHelloWorldRegisteredSettings,
268 updatePluginSettings, 288 updatePluginSettings,
269 getPluginRegisteredSettings, 289 getPluginRegisteredSettings,
270 getPackageJSONPath, 290 getPackageJSONPath,