aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-30 11:45:06 +0200
committerChocobozzz <me@florianbigard.com>2021-06-30 11:45:20 +0200
commit9c2e051c56e1ef6b9c9901f492fb506ee5d16def (patch)
treeba9d731b0e3d89e2a3004c047c59c0c4e4e7bac0 /server/tests/api
parent4c0a6954fb6df177f842de4bf3e3a97eb171a11b (diff)
downloadPeerTube-9c2e051c56e1ef6b9c9901f492fb506ee5d16def.tar.gz
PeerTube-9c2e051c56e1ef6b9c9901f492fb506ee5d16def.tar.zst
PeerTube-9c2e051c56e1ef6b9c9901f492fb506ee5d16def.zip
Handle broken plugin install
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/server/plugins.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts
index 6046ab97e..6b61c7c33 100644
--- a/server/tests/api/server/plugins.ts
+++ b/server/tests/api/server/plugins.ts
@@ -2,6 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils'
5import { 6import {
6 cleanupTests, 7 cleanupTests,
7 closeAllSequelize, 8 closeAllSequelize,
@@ -10,6 +11,7 @@ import {
10 getMyUserInformation, 11 getMyUserInformation,
11 getPlugin, 12 getPlugin,
12 getPluginPackageJSON, 13 getPluginPackageJSON,
14 getPluginTestPath,
13 getPublicSettings, 15 getPublicSettings,
14 installPlugin, 16 installPlugin,
15 killallServers, 17 killallServers,
@@ -400,6 +402,36 @@ describe('Test plugins', function () {
400 expect((res.body as User).theme).to.equal('instance-default') 402 expect((res.body as User).theme).to.equal('instance-default')
401 }) 403 })
402 404
405 it('Should not install a broken plugin', async function () {
406 this.timeout(60000)
407
408 async function check () {
409 const res = await listPlugins({
410 url: server.url,
411 accessToken: server.accessToken,
412 pluginType: PluginType.PLUGIN
413 })
414
415 const plugins: PeerTubePlugin[] = res.body.data
416
417 expect(plugins.find(p => p.name === 'test-broken')).to.not.exist
418 }
419
420 await installPlugin({
421 url: server.url,
422 accessToken: server.accessToken,
423 path: getPluginTestPath('-broken'),
424 expectedStatus: HttpStatusCode.BAD_REQUEST_400
425 })
426
427 await check()
428
429 killallServers([ server ])
430 await reRunServer(server)
431
432 await check()
433 })
434
403 after(async function () { 435 after(async function () {
404 await closeAllSequelize([ server ]) 436 await closeAllSequelize([ server ])
405 await cleanupTests([ server ]) 437 await cleanupTests([ server ])