X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fserver%2Fconfig.ts;h=ca389b7b6b64c126d249464809024556ddfa0127;hb=bec4ea343987c69252b84d02f444c0f033d4a3f9;hp=cb2700f2949a862980a030c001c162ad499062ec;hpb=5b9c965d5aa747f29b081289f930ee215fdc23c8;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index cb2700f29..ca389b7b6 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts @@ -5,23 +5,23 @@ import * as chai from 'chai' import { About } from '../../../../shared/models/server/about.model' import { CustomConfig } from '../../../../shared/models/server/custom-config.model' import { + cleanupTests, deleteCustomConfig, + flushAndRunServer, getAbout, - killallServers, - reRunServer, - flushTests, getConfig, getCustomConfig, + killallServers, parallelTests, registerUser, - runServer, + reRunServer, ServerInfo, setAccessTokensToServers, updateCustomConfig -} from '../../../../shared/utils' +} from '../../../../shared/extra-utils' import { ServerConfig } from '../../../../shared/models' const expect = chai.expect -function checkInitialConfig (data: CustomConfig) { +function checkInitialConfig (server: ServerInfo, data: CustomConfig) { expect(data.instance.name).to.equal('PeerTube') expect(data.instance.shortDescription).to.equal( 'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser ' + @@ -45,7 +45,7 @@ function checkInitialConfig (data: CustomConfig) { expect(data.signup.limit).to.equal(4) expect(data.signup.requiresEmailVerification).to.be.false - expect(data.admin.email).to.equal('admin1@example.com') + expect(data.admin.email).to.equal('admin' + server.internalServerNumber + '@example.com') expect(data.contactForm.enabled).to.be.true expect(data.user.videoQuota).to.equal(5242880) @@ -65,6 +65,7 @@ function checkInitialConfig (data: CustomConfig) { expect(data.autoBlacklist.videos.ofUsers.enabled).to.be.false expect(data.followers.instance.enabled).to.be.true + expect(data.followers.instance.manualApproval).to.be.false } function checkUpdatedConfig (data: CustomConfig) { @@ -88,7 +89,11 @@ function checkUpdatedConfig (data: CustomConfig) { expect(data.signup.limit).to.equal(5) expect(data.signup.requiresEmailVerification).to.be.false - expect(data.admin.email).to.equal('superadmin1@example.com') + // We override admin email in parallel tests, so skip this exception + if (parallelTests() === false) { + expect(data.admin.email).to.equal('superadmin1@example.com') + } + expect(data.contactForm.enabled).to.be.false expect(data.user.videoQuota).to.equal(5242881) @@ -109,6 +114,7 @@ function checkUpdatedConfig (data: CustomConfig) { expect(data.autoBlacklist.videos.ofUsers.enabled).to.be.true expect(data.followers.instance.enabled).to.be.false + expect(data.followers.instance.manualApproval).to.be.true } describe('Test config', function () { @@ -117,8 +123,7 @@ describe('Test config', function () { before(async function () { this.timeout(30000) - await flushTests() - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) }) @@ -160,7 +165,7 @@ describe('Test config', function () { const res = await getCustomConfig(server.url, server.accessToken) const data = res.body as CustomConfig - checkInitialConfig(data) + checkInitialConfig(server, data) }) it('Should update the customized configuration', async function () { @@ -241,7 +246,8 @@ describe('Test config', function () { }, followers: { instance: { - enabled: false + enabled: false, + manualApproval: true } } } @@ -296,10 +302,10 @@ describe('Test config', function () { const res = await getCustomConfig(server.url, server.accessToken) const data = res.body - checkInitialConfig(data) + checkInitialConfig(server, data) }) after(async function () { - killallServers([ server ]) + await cleanupTests([ server ]) }) })