X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fserver%2Fplugins.ts;h=655cf00fae7679e255ea23e54c7c0e063ff6a6f4;hb=9293139fde7091e9badcafa9b570b83cea9a10ad;hp=1536997d5fdabb041c36ddde158f21297d0632e0;hpb=ae2abfd3aed3e75d39a316b49b914d187faa7475;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts index 1536997d5..655cf00fa 100644 --- a/server/tests/api/server/plugins.ts +++ b/server/tests/api/server/plugins.ts @@ -5,23 +5,19 @@ import * as chai from 'chai' import { HttpStatusCode } from '@shared/core-utils' import { cleanupTests, - closeAllSequelize, flushAndRunServer, - getConfig, getMyUserInformation, killallServers, PluginsCommand, reRunServer, ServerInfo, setAccessTokensToServers, - setPluginVersion, testHelloWorldRegisteredSettings, - updateCustomSubConfig, updateMyUser, wait, waitUntilLog } from '@shared/extra-utils' -import { PluginType, ServerConfig, User } from '@shared/models' +import { PluginType, User } from '@shared/models' const expect = chai.expect @@ -39,6 +35,8 @@ describe('Test plugins', function () { } server = await flushAndRunServer(1, configOverride) await setAccessTokensToServers([ server ]) + + command = server.pluginsCommand }) it('Should list and search available plugins and themes', async function () { @@ -102,8 +100,7 @@ describe('Test plugins', function () { }) it('Should have the plugin loaded in the configuration', async function () { - const res = await getConfig(server.url) - const config: ServerConfig = res.body + const config = await server.configCommand.getConfig() const theme = config.theme.registered.find(r => r.name === 'background-red') expect(theme).to.not.be.undefined @@ -113,11 +110,13 @@ describe('Test plugins', function () { }) it('Should update the default theme in the configuration', async function () { - await updateCustomSubConfig(server.url, server.accessToken, { theme: { default: 'background-red' } }) - - const res = await getConfig(server.url) - const config: ServerConfig = res.body + await server.configCommand.updateCustomSubConfig({ + newConfig: { + theme: { default: 'background-red' } + } + }) + const config = await server.configCommand.getConfig() expect(config.theme.default).to.equal('background-red') }) @@ -243,7 +242,7 @@ describe('Test plugins', function () { await wait(6000) // Fake update our plugin version - await setPluginVersion(server.internalServerNumber, 'hello-world', '0.0.1') + await server.sqlCommand.setPluginVersion('hello-world', '0.0.1') // Fake update package.json const packageJSON = await command.getPackageJSON('peertube-plugin-hello-world') @@ -253,7 +252,7 @@ describe('Test plugins', function () { await command.updatePackageJSON('peertube-plugin-hello-world', packageJSON) // Restart the server to take into account this change - killallServers([ server ]) + await killallServers([ server ]) await reRunServer(server) { @@ -302,9 +301,7 @@ describe('Test plugins', function () { }) it('Should have updated the configuration', async function () { - // get /config (default theme + registered themes + registered plugins) - const res = await getConfig(server.url) - const config: ServerConfig = res.body + const config = await server.configCommand.getConfig() expect(config.theme.default).to.equal('default') @@ -336,14 +333,13 @@ describe('Test plugins', function () { await check() - killallServers([ server ]) + await killallServers([ server ]) await reRunServer(server) await check() }) after(async function () { - await closeAllSequelize([ server ]) await cleanupTests([ server ]) }) })