diff options
-rw-r--r-- | server/tests/api/server/plugins.ts | 16 | ||||
-rw-r--r-- | server/tests/cli/peertube.ts | 5 | ||||
-rw-r--r-- | shared/extra-utils/server/plugins.ts | 20 |
3 files changed, 27 insertions, 14 deletions
diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts index ecf7c0d3f..1c6eabe6d 100644 --- a/server/tests/api/server/plugins.ts +++ b/server/tests/api/server/plugins.ts | |||
@@ -10,7 +10,6 @@ import { | |||
10 | getMyUserInformation, | 10 | getMyUserInformation, |
11 | getPlugin, | 11 | getPlugin, |
12 | getPluginPackageJSON, | 12 | getPluginPackageJSON, |
13 | getPluginRegisteredSettings, | ||
14 | getPublicSettings, | 13 | getPublicSettings, |
15 | installPlugin, | 14 | installPlugin, |
16 | killallServers, | 15 | killallServers, |
@@ -20,6 +19,7 @@ import { | |||
20 | ServerInfo, | 19 | ServerInfo, |
21 | setAccessTokensToServers, | 20 | setAccessTokensToServers, |
22 | setPluginVersion, | 21 | setPluginVersion, |
22 | testHelloWorldRegisteredSettings, | ||
23 | uninstallPlugin, | 23 | uninstallPlugin, |
24 | updateCustomSubConfig, | 24 | updateCustomSubConfig, |
25 | updateMyUser, | 25 | updateMyUser, |
@@ -34,7 +34,6 @@ import { PeerTubePlugin } from '../../../../shared/models/plugins/peertube-plugi | |||
34 | import { PluginPackageJson } from '../../../../shared/models/plugins/plugin-package-json.model' | 34 | import { PluginPackageJson } from '../../../../shared/models/plugins/plugin-package-json.model' |
35 | import { PluginType } from '../../../../shared/models/plugins/plugin.type' | 35 | import { PluginType } from '../../../../shared/models/plugins/plugin.type' |
36 | import { PublicServerSetting } from '../../../../shared/models/plugins/public-server.setting' | 36 | import { PublicServerSetting } from '../../../../shared/models/plugins/public-server.setting' |
37 | import { RegisteredServerSettings } from '../../../../shared/models/plugins/register-server-setting.model' | ||
38 | import { ServerConfig } from '../../../../shared/models/server' | 37 | import { ServerConfig } from '../../../../shared/models/server' |
39 | import { User } from '../../../../shared/models/users' | 38 | import { User } from '../../../../shared/models/users' |
40 | 39 | ||
@@ -209,18 +208,7 @@ describe('Test plugins', function () { | |||
209 | }) | 208 | }) |
210 | 209 | ||
211 | it('Should get registered settings', async function () { | 210 | it('Should get registered settings', async function () { |
212 | const res = await getPluginRegisteredSettings({ | 211 | await testHelloWorldRegisteredSettings(server) |
213 | url: server.url, | ||
214 | accessToken: server.accessToken, | ||
215 | npmName: 'peertube-plugin-hello-world' | ||
216 | }) | ||
217 | |||
218 | const registeredSettings = (res.body as RegisteredServerSettings).registeredSettings | ||
219 | |||
220 | expect(registeredSettings).to.have.length.at.least(1) | ||
221 | |||
222 | const adminNameSettings = registeredSettings.find(s => s.name === 'admin-name') | ||
223 | expect(adminNameSettings).to.not.be.undefined | ||
224 | }) | 212 | }) |
225 | 213 | ||
226 | it('Should get public settings', async function () { | 214 | it('Should get public settings', async function () { |
diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts index e2861f46e..348438533 100644 --- a/server/tests/cli/peertube.ts +++ b/server/tests/cli/peertube.ts | |||
@@ -19,6 +19,7 @@ import { | |||
19 | removeVideo, | 19 | removeVideo, |
20 | ServerInfo, | 20 | ServerInfo, |
21 | setAccessTokensToServers, | 21 | setAccessTokensToServers, |
22 | testHelloWorldRegisteredSettings, | ||
22 | uploadVideoAndGetId, | 23 | uploadVideoAndGetId, |
23 | userLogin, | 24 | userLogin, |
24 | waitJobs | 25 | waitJobs |
@@ -205,6 +206,10 @@ describe('Test CLI wrapper', function () { | |||
205 | await execCLI(`${env} ${cmd} plugins install --npm-name peertube-plugin-hello-world`) | 206 | await execCLI(`${env} ${cmd} plugins install --npm-name peertube-plugin-hello-world`) |
206 | }) | 207 | }) |
207 | 208 | ||
209 | it('Should have registered settings', async function () { | ||
210 | await testHelloWorldRegisteredSettings(server) | ||
211 | }) | ||
212 | |||
208 | it('Should list installed plugins', async function () { | 213 | it('Should list installed plugins', async function () { |
209 | const env = getEnvCli(server) | 214 | const env = getEnvCli(server) |
210 | const res = await execCLI(`${env} ${cmd} plugins list`) | 215 | const res = await execCLI(`${env} ${cmd} plugins list`) |
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, |