From 36f9424ff192b0584a433bc196bced6fcf265808 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 31 Jan 2018 17:47:36 +0100 Subject: Add about page --- server/tests/api/server/config.ts | 16 +++++++++++++++- server/tests/utils/server/config.ts | 22 ++++++++++++++++------ 2 files changed, 31 insertions(+), 7 deletions(-) (limited to 'server/tests') diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index f83e21e82..35a5c430b 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts @@ -2,7 +2,8 @@ import 'mocha' import * as chai from 'chai' -import { deleteCustomConfig, killallServers, reRunServer } from '../../utils' +import { About } from '../../../../shared/models/config/about.model' +import { deleteCustomConfig, getAbout, killallServers, reRunServer } from '../../utils' const expect = chai.expect import { @@ -108,6 +109,7 @@ describe('Test config', function () { expect(data.instance.name).to.equal('PeerTube updated') expect(data.instance.description).to.equal('my super description') expect(data.instance.terms).to.equal('my super terms') + expect(data.cache.previews.size).to.equal(2) expect(data.signup.enabled).to.be.false expect(data.signup.limit).to.equal(5) expect(data.admin.email).to.equal('superadmin1@example.com') @@ -131,6 +133,9 @@ describe('Test config', function () { const res = await getCustomConfig(server.url, server.accessToken) const data = res.body + expect(data.instance.name).to.equal('PeerTube updated') + expect(data.instance.description).to.equal('my super description') + expect(data.instance.terms).to.equal('my super terms') expect(data.cache.previews.size).to.equal(2) expect(data.signup.enabled).to.be.false expect(data.signup.limit).to.equal(5) @@ -145,6 +150,15 @@ describe('Test config', function () { expect(data.transcoding.resolutions['1080p']).to.be.false }) + it('Should fetch the about information', async function () { + const res = await getAbout(server.url) + const data: About = res.body + + expect(data.instance.name).to.equal('PeerTube updated') + expect(data.instance.description).to.equal('my super description') + expect(data.instance.terms).to.equal('my super terms') + }) + it('Should remove the custom configuration', async function () { this.timeout(10000) diff --git a/server/tests/utils/server/config.ts b/server/tests/utils/server/config.ts index b6905757a..e5411117a 100644 --- a/server/tests/utils/server/config.ts +++ b/server/tests/utils/server/config.ts @@ -1,15 +1,24 @@ -import * as request from 'supertest' import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../' import { CustomConfig } from '../../../../shared/models/config/custom-config.model' function getConfig (url: string) { const path = '/api/v1/config' - return request(url) - .get(path) - .set('Accept', 'application/json') - .expect(200) - .expect('Content-Type', /json/) + return makeGetRequest({ + url, + path, + statusCodeExpected: 200 + }) +} + +function getAbout (url: string) { + const path = '/api/v1/config/about' + + return makeGetRequest({ + url, + path, + statusCodeExpected: 200 + }) } function getCustomConfig (url: string, token: string, statusCodeExpected = 200) { @@ -52,5 +61,6 @@ export { getConfig, getCustomConfig, updateCustomConfig, + getAbout, deleteCustomConfig } -- cgit v1.2.3