X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fmisc-endpoints.ts;h=3d02243232c9f71e85d7b6f3be807a9e8f0631bb;hb=797d05bdd99b63104522051d0f61f1e0f003e780;hp=b53803ee1d64e235f036faf97aa8cdf0be4ba0c0;hpb=2feebf3e6afaad9ab80976d1557d3a7bcf94de03;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts index b53803ee1..3d0224323 100644 --- a/server/tests/misc-endpoints.ts +++ b/server/tests/misc-endpoints.ts @@ -1,18 +1,17 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' import * as chai from 'chai' import { addVideoChannel, + cleanupTests, createUser, - flushTests, - killallServers, + flushAndRunServer, makeGetRequest, - runServer, ServerInfo, setAccessTokensToServers, uploadVideo -} from './utils' +} from '../../shared/extra-utils' import { VideoPrivacy } from '../../shared/models/videos' const expect = chai.expect @@ -23,9 +22,7 @@ describe('Test misc endpoints', function () { before(async function () { this.timeout(120000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) }) @@ -72,6 +69,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 () { @@ -115,7 +122,7 @@ describe('Test misc endpoints', function () { }) 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('http://localhost:' + server.port + '/about/instance') }) it('Should get the empty cached sitemap', async function () { @@ -126,7 +133,7 @@ describe('Test misc endpoints', function () { }) 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('http://localhost:' + server.port + '/about/instance') }) it('Should add videos, channel and accounts and get sitemap', async function () { @@ -139,8 +146,8 @@ describe('Test misc endpoints', function () { 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') + await createUser({ url: server.url, accessToken: server.accessToken, username: 'user1', password: 'password' }) + await createUser({ url: server.url, accessToken: server.accessToken, username: 'user2', password: 'password' }) const res = await makeGetRequest({ url: server.url, @@ -149,21 +156,21 @@ describe('Test misc endpoints', function () { }) 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('http://localhost:' + server.port + '/about/instance') - expect(res.text).to.contain('') - expect(res.text).to.contain('') - expect(res.text).to.not.contain('') + expect(res.text).to.contain('video 1') + expect(res.text).to.contain('video 2') + expect(res.text).to.not.contain('video 3') - 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:' + server.port + '/video-channels/channel1') + expect(res.text).to.contain('http://localhost:' + server.port + '/video-channels/channel2') - expect(res.text).to.contain('http://localhost:9001/accounts/user1') - expect(res.text).to.contain('http://localhost:9001/accounts/user2') + expect(res.text).to.contain('http://localhost:' + server.port + '/accounts/user1') + expect(res.text).to.contain('http://localhost:' + server.port + '/accounts/user2') }) }) after(async function () { - killallServers([ server ]) + await cleanupTests([ server ]) }) })