Add registered setting CLI plugin install test
This commit is contained in:
parent
e2c1f77957
commit
353f8bc0c7
|
@ -10,7 +10,6 @@ import {
|
||||||
getMyUserInformation,
|
getMyUserInformation,
|
||||||
getPlugin,
|
getPlugin,
|
||||||
getPluginPackageJSON,
|
getPluginPackageJSON,
|
||||||
getPluginRegisteredSettings,
|
|
||||||
getPublicSettings,
|
getPublicSettings,
|
||||||
installPlugin,
|
installPlugin,
|
||||||
killallServers,
|
killallServers,
|
||||||
|
@ -20,6 +19,7 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
setPluginVersion,
|
setPluginVersion,
|
||||||
|
testHelloWorldRegisteredSettings,
|
||||||
uninstallPlugin,
|
uninstallPlugin,
|
||||||
updateCustomSubConfig,
|
updateCustomSubConfig,
|
||||||
updateMyUser,
|
updateMyUser,
|
||||||
|
@ -34,7 +34,6 @@ import { PeerTubePlugin } from '../../../../shared/models/plugins/peertube-plugi
|
||||||
import { PluginPackageJson } from '../../../../shared/models/plugins/plugin-package-json.model'
|
import { PluginPackageJson } from '../../../../shared/models/plugins/plugin-package-json.model'
|
||||||
import { PluginType } from '../../../../shared/models/plugins/plugin.type'
|
import { PluginType } from '../../../../shared/models/plugins/plugin.type'
|
||||||
import { PublicServerSetting } from '../../../../shared/models/plugins/public-server.setting'
|
import { PublicServerSetting } from '../../../../shared/models/plugins/public-server.setting'
|
||||||
import { RegisteredServerSettings } from '../../../../shared/models/plugins/register-server-setting.model'
|
|
||||||
import { ServerConfig } from '../../../../shared/models/server'
|
import { ServerConfig } from '../../../../shared/models/server'
|
||||||
import { User } from '../../../../shared/models/users'
|
import { User } from '../../../../shared/models/users'
|
||||||
|
|
||||||
|
@ -209,18 +208,7 @@ describe('Test plugins', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should get registered settings', async function () {
|
it('Should get registered settings', async function () {
|
||||||
const res = await getPluginRegisteredSettings({
|
await testHelloWorldRegisteredSettings(server)
|
||||||
url: server.url,
|
|
||||||
accessToken: server.accessToken,
|
|
||||||
npmName: 'peertube-plugin-hello-world'
|
|
||||||
})
|
|
||||||
|
|
||||||
const registeredSettings = (res.body as RegisteredServerSettings).registeredSettings
|
|
||||||
|
|
||||||
expect(registeredSettings).to.have.length.at.least(1)
|
|
||||||
|
|
||||||
const adminNameSettings = registeredSettings.find(s => s.name === 'admin-name')
|
|
||||||
expect(adminNameSettings).to.not.be.undefined
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should get public settings', async function () {
|
it('Should get public settings', async function () {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import {
|
||||||
removeVideo,
|
removeVideo,
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
|
testHelloWorldRegisteredSettings,
|
||||||
uploadVideoAndGetId,
|
uploadVideoAndGetId,
|
||||||
userLogin,
|
userLogin,
|
||||||
waitJobs
|
waitJobs
|
||||||
|
@ -205,6 +206,10 @@ describe('Test CLI wrapper', function () {
|
||||||
await execCLI(`${env} ${cmd} plugins install --npm-name peertube-plugin-hello-world`)
|
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 () {
|
it('Should list installed plugins', async function () {
|
||||||
const env = getEnvCli(server)
|
const env = getEnvCli(server)
|
||||||
const res = await execCLI(`${env} ${cmd} plugins list`)
|
const res = await execCLI(`${env} ${cmd} plugins list`)
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
|
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
|
||||||
|
|
||||||
|
import { expect } from 'chai'
|
||||||
import { readJSON, writeJSON } from 'fs-extra'
|
import { readJSON, writeJSON } from 'fs-extra'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
import { RegisteredServerSettings } from '@shared/models'
|
||||||
import { PeertubePluginIndexList } from '../../models/plugins/peertube-plugin-index-list.model'
|
import { PeertubePluginIndexList } from '../../models/plugins/peertube-plugin-index-list.model'
|
||||||
import { PluginType } from '../../models/plugins/plugin.type'
|
import { PluginType } from '../../models/plugins/plugin.type'
|
||||||
import { buildServerDirectory, root } from '../miscs/miscs'
|
import { buildServerDirectory, root } from '../miscs/miscs'
|
||||||
|
@ -119,6 +123,21 @@ function getPluginRegisteredSettings (parameters: {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function testHelloWorldRegisteredSettings (server: ServerInfo) {
|
||||||
|
const res = await getPluginRegisteredSettings({
|
||||||
|
url: server.url,
|
||||||
|
accessToken: server.accessToken,
|
||||||
|
npmName: 'peertube-plugin-hello-world'
|
||||||
|
})
|
||||||
|
|
||||||
|
const registeredSettings = (res.body as RegisteredServerSettings).registeredSettings
|
||||||
|
|
||||||
|
expect(registeredSettings).to.have.length.at.least(1)
|
||||||
|
|
||||||
|
const adminNameSettings = registeredSettings.find(s => s.name === 'admin-name')
|
||||||
|
expect(adminNameSettings).to.not.be.undefined
|
||||||
|
}
|
||||||
|
|
||||||
function getPublicSettings (parameters: {
|
function getPublicSettings (parameters: {
|
||||||
url: string
|
url: string
|
||||||
npmName: string
|
npmName: string
|
||||||
|
@ -265,6 +284,7 @@ export {
|
||||||
updatePlugin,
|
updatePlugin,
|
||||||
getPlugin,
|
getPlugin,
|
||||||
uninstallPlugin,
|
uninstallPlugin,
|
||||||
|
testHelloWorldRegisteredSettings,
|
||||||
updatePluginSettings,
|
updatePluginSettings,
|
||||||
getPluginRegisteredSettings,
|
getPluginRegisteredSettings,
|
||||||
getPackageJSONPath,
|
getPackageJSONPath,
|
||||||
|
|
Loading…
Reference in New Issue