diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-27 11:41:38 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-27 11:41:38 +0100 |
commit | 353f8bc0c7a71ad490e4501b8c80e13e5cec1932 (patch) | |
tree | a3a6c637e2baf57597c733dbc166b1959754bf34 /shared/extra-utils | |
parent | e2c1f7795752caf8cde19fdee8b9ab7fb16b0395 (diff) | |
download | PeerTube-353f8bc0c7a71ad490e4501b8c80e13e5cec1932.tar.gz PeerTube-353f8bc0c7a71ad490e4501b8c80e13e5cec1932.tar.zst PeerTube-353f8bc0c7a71ad490e4501b8c80e13e5cec1932.zip |
Add registered setting CLI plugin install test
Diffstat (limited to 'shared/extra-utils')
-rw-r--r-- | shared/extra-utils/server/plugins.ts | 20 |
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 | |||
3 | import { expect } from 'chai' | ||
1 | import { readJSON, writeJSON } from 'fs-extra' | 4 | import { readJSON, writeJSON } from 'fs-extra' |
2 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { RegisteredServerSettings } from '@shared/models' | ||
3 | import { PeertubePluginIndexList } from '../../models/plugins/peertube-plugin-index-list.model' | 7 | import { PeertubePluginIndexList } from '../../models/plugins/peertube-plugin-index-list.model' |
4 | import { PluginType } from '../../models/plugins/plugin.type' | 8 | import { PluginType } from '../../models/plugins/plugin.type' |
5 | import { buildServerDirectory, root } from '../miscs/miscs' | 9 | import { buildServerDirectory, root } from '../miscs/miscs' |
@@ -119,6 +123,21 @@ function getPluginRegisteredSettings (parameters: { | |||
119 | }) | 123 | }) |
120 | } | 124 | } |
121 | 125 | ||
126 | async 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 | |||
122 | function getPublicSettings (parameters: { | 141 | function 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, |