diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-19 14:36:04 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 09071200c73f5358e1d0bfb61a274e4f2c4ec52b (patch) | |
tree | 602749b149df1675518846dd223105196b19a557 /server/controllers/api/plugins.ts | |
parent | 9b474844e85cce916370693cc24f53339a695570 (diff) | |
download | PeerTube-09071200c73f5358e1d0bfb61a274e4f2c4ec52b.tar.gz PeerTube-09071200c73f5358e1d0bfb61a274e4f2c4ec52b.tar.zst PeerTube-09071200c73f5358e1d0bfb61a274e4f2c4ec52b.zip |
Add plugin API tests
Diffstat (limited to 'server/controllers/api/plugins.ts')
-rw-r--r-- | server/controllers/api/plugins.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/server/controllers/api/plugins.ts b/server/controllers/api/plugins.ts index bb410e891..de58a7350 100644 --- a/server/controllers/api/plugins.ts +++ b/server/controllers/api/plugins.ts | |||
@@ -25,6 +25,7 @@ import { ManagePlugin } from '../../../shared/models/plugins/manage-plugin.model | |||
25 | import { logger } from '../../helpers/logger' | 25 | import { logger } from '../../helpers/logger' |
26 | import { listAvailablePluginsFromIndex } from '../../lib/plugins/plugin-index' | 26 | import { listAvailablePluginsFromIndex } from '../../lib/plugins/plugin-index' |
27 | import { PeertubePluginIndexList } from '../../../shared/models/plugins/peertube-plugin-index-list.model' | 27 | import { PeertubePluginIndexList } from '../../../shared/models/plugins/peertube-plugin-index-list.model' |
28 | import { RegisteredSettings } from '../../../shared/models/plugins/register-setting.model' | ||
28 | 29 | ||
29 | const pluginRouter = express.Router() | 30 | const pluginRouter = express.Router() |
30 | 31 | ||
@@ -103,9 +104,11 @@ export { | |||
103 | 104 | ||
104 | async function listPlugins (req: express.Request, res: express.Response) { | 105 | async function listPlugins (req: express.Request, res: express.Response) { |
105 | const pluginType = req.query.pluginType | 106 | const pluginType = req.query.pluginType |
107 | const uninstalled = req.query.uninstalled | ||
106 | 108 | ||
107 | const resultList = await PluginModel.listForApi({ | 109 | const resultList = await PluginModel.listForApi({ |
108 | pluginType, | 110 | pluginType, |
111 | uninstalled, | ||
109 | start: req.query.start, | 112 | start: req.query.start, |
110 | count: req.query.count, | 113 | count: req.query.count, |
111 | sort: req.query.sort | 114 | sort: req.query.sort |
@@ -161,9 +164,9 @@ async function uninstallPlugin (req: express.Request, res: express.Response) { | |||
161 | function getPluginRegisteredSettings (req: express.Request, res: express.Response) { | 164 | function getPluginRegisteredSettings (req: express.Request, res: express.Response) { |
162 | const settings = PluginManager.Instance.getRegisteredSettings(req.params.npmName) | 165 | const settings = PluginManager.Instance.getRegisteredSettings(req.params.npmName) |
163 | 166 | ||
164 | return res.json({ | 167 | const json: RegisteredSettings = { settings } |
165 | settings | 168 | |
166 | }) | 169 | return res.json(json) |
167 | } | 170 | } |
168 | 171 | ||
169 | async function updatePluginSettings (req: express.Request, res: express.Response) { | 172 | async function updatePluginSettings (req: express.Request, res: express.Response) { |