From 9639bd175726b73f8fe664b5ced12a72407b1f0b Mon Sep 17 00:00:00 2001 From: buoyantair Date: Mon, 29 Oct 2018 22:18:31 +0530 Subject: Move utils to /shared Move utils used by /server/tools/* & /server/tests/**/* into /shared folder. Issue: #1336 --- server/tests/misc-endpoints.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/tests/misc-endpoints.ts') diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts index 8fab20971..f948fdfd0 100644 --- a/server/tests/misc-endpoints.ts +++ b/server/tests/misc-endpoints.ts @@ -2,7 +2,7 @@ import 'mocha' import * as chai from 'chai' -import { flushTests, killallServers, makeGetRequest, runServer, ServerInfo } from './utils' +import { flushTests, killallServers, makeGetRequest, runServer, ServerInfo } from '../../shared/utils' const expect = chai.expect -- cgit v1.2.3 From 2feebf3e6afaad9ab80976d1557d3a7bcf94de03 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 5 Dec 2018 17:27:24 +0100 Subject: Add sitemap --- server/tests/misc-endpoints.ts | 72 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) (limited to 'server/tests/misc-endpoints.ts') diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts index 8fab20971..b53803ee1 100644 --- a/server/tests/misc-endpoints.ts +++ b/server/tests/misc-endpoints.ts @@ -2,7 +2,18 @@ import 'mocha' import * as chai from 'chai' -import { flushTests, killallServers, makeGetRequest, runServer, ServerInfo } from './utils' +import { + addVideoChannel, + createUser, + flushTests, + killallServers, + makeGetRequest, + runServer, + ServerInfo, + setAccessTokensToServers, + uploadVideo +} from './utils' +import { VideoPrivacy } from '../../shared/models/videos' const expect = chai.expect @@ -15,6 +26,7 @@ describe('Test misc endpoints', function () { await flushTests() server = await runServer(1) + await setAccessTokensToServers([ server ]) }) describe('Test a well known endpoints', function () { @@ -93,6 +105,64 @@ describe('Test misc endpoints', function () { }) }) + describe('Test bots endpoints', function () { + + it('Should get the empty sitemap', async function () { + const res = await makeGetRequest({ + url: server.url, + path: '/sitemap.xml', + statusCodeExpected: 200 + }) + + expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') + expect(res.text).to.contain('http://localhost:9001/about/instance') + }) + + it('Should get the empty cached sitemap', async function () { + const res = await makeGetRequest({ + url: server.url, + path: '/sitemap.xml', + statusCodeExpected: 200 + }) + + expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') + expect(res.text).to.contain('http://localhost:9001/about/instance') + }) + + it('Should add videos, channel and accounts and get sitemap', async function () { + this.timeout(35000) + + await uploadVideo(server.url, server.accessToken, { name: 'video 1', nsfw: false }) + await uploadVideo(server.url, server.accessToken, { name: 'video 2', nsfw: false }) + await uploadVideo(server.url, server.accessToken, { name: 'video 3', privacy: VideoPrivacy.PRIVATE }) + + await addVideoChannel(server.url, server.accessToken, { name: 'channel1', displayName: 'channel 1' }) + await addVideoChannel(server.url, server.accessToken, { name: 'channel2', displayName: 'channel 2' }) + + await createUser(server.url, server.accessToken, 'user1', 'password') + await createUser(server.url, server.accessToken, 'user2', 'password') + + const res = await makeGetRequest({ + url: server.url, + path: '/sitemap.xml?t=1', // avoid using cache + statusCodeExpected: 200 + }) + + expect(res.text).to.contain('xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"') + expect(res.text).to.contain('http://localhost:9001/about/instance') + + expect(res.text).to.contain('') + expect(res.text).to.contain('') + expect(res.text).to.not.contain('') + + expect(res.text).to.contain('http://localhost:9001/video-channels/channel1') + expect(res.text).to.contain('http://localhost:9001/video-channels/channel2') + + expect(res.text).to.contain('http://localhost:9001/accounts/user1') + expect(res.text).to.contain('http://localhost:9001/accounts/user2') + }) + }) + after(async function () { killallServers([ server ]) }) -- cgit v1.2.3 From 314141279db4826bf4862576b7e0df104834ad00 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Fri, 7 Dec 2018 01:42:00 +0100 Subject: (well-known url) add change-password --- server/tests/misc-endpoints.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'server/tests/misc-endpoints.ts') diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts index b53803ee1..4de47d693 100644 --- a/server/tests/misc-endpoints.ts +++ b/server/tests/misc-endpoints.ts @@ -72,6 +72,16 @@ describe('Test misc endpoints', function () { expect(res.body.tracking).to.equal('N') }) + + it('Should get change-password location', async function () { + const res = await makeGetRequest({ + url: server.url, + path: '/.well-known/change-password', + statusCodeExpected: 302 + }) + + expect(res.header.location).to.equal('/my-account/settings') + }) }) describe('Test classic static endpoints', function () { -- cgit v1.2.3