aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2020-12-06 19:23:12 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-12-08 11:15:11 +0100
commite5024f5181b2e8ec23a58a821671000041b5bf2b (patch)
tree09b89d76fed2bb765694e595314d03c4d0fcefee
parent106fa2249de343b60259a98634e2f38bd34c20d8 (diff)
downloadPeerTube-e5024f5181b2e8ec23a58a821671000041b5bf2b.tar.gz
PeerTube-e5024f5181b2e8ec23a58a821671000041b5bf2b.tar.zst
PeerTube-e5024f5181b2e8ec23a58a821671000041b5bf2b.zip
Add tests
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
-rw-r--r--server/tests/client.ts30
1 files changed, 25 insertions, 5 deletions
diff --git a/server/tests/client.ts b/server/tests/client.ts
index 6dd4b7cf6..7bcb999ea 100644
--- a/server/tests/client.ts
+++ b/server/tests/client.ts
@@ -8,19 +8,20 @@ import {
8 addVideoInPlaylist, 8 addVideoInPlaylist,
9 cleanupTests, 9 cleanupTests,
10 createVideoPlaylist, 10 createVideoPlaylist,
11 flushAndRunServer,
12 getAccount, 11 getAccount,
13 getCustomConfig, 12 getCustomConfig,
14 getVideosList, 13 getVideosList,
15 makeHTMLRequest, 14 makeHTMLRequest,
16 ServerInfo, 15 ServerInfo,
17 serverLogin,
18 setDefaultVideoChannel, 16 setDefaultVideoChannel,
19 updateCustomConfig, 17 updateCustomConfig,
20 updateCustomSubConfig, 18 updateCustomSubConfig,
21 uploadVideo, 19 uploadVideo,
22 updateMyUser, 20 updateMyUser,
23 updateVideoChannel 21 updateVideoChannel,
22 doubleFollow,
23 flushAndRunMultipleServers,
24 setAccessTokensToServers
24} from '../../shared/extra-utils' 25} from '../../shared/extra-utils'
25import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' 26import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
26 27
@@ -33,8 +34,11 @@ function checkIndexTags (html: string, title: string, description: string, css:
33} 34}
34 35
35describe('Test a client controllers', function () { 36describe('Test a client controllers', function () {
37 let servers: ServerInfo[] = []
36 let server: ServerInfo 38 let server: ServerInfo
37 let account: Account 39 let account: Account
40 let videoUUID: string
41 let videoOriginalUrl: string
38 42
39 const videoName = 'my super name for server 1' 43 const videoName = 'my super name for server 1'
40 const videoDescription = 'my super description for server 1' 44 const videoDescription = 'my super description for server 1'
@@ -48,8 +52,19 @@ describe('Test a client controllers', function () {
48 before(async function () { 52 before(async function () {
49 this.timeout(120000) 53 this.timeout(120000)
50 54
51 server = await flushAndRunServer(1) 55 servers = await flushAndRunMultipleServers(2)
52 server.accessToken = await serverLogin(server) 56 const server = servers[0]
57
58 await setAccessTokensToServers(servers)
59
60 {
61 const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video' })
62 videoUUID = res.body.video.uuid
63 videoOriginalUrl = res.body.video.url
64 }
65
66 await doubleFollow(servers[0], servers[1])
67
53 await setDefaultVideoChannel([ server ]) 68 await setDefaultVideoChannel([ server ])
54 69
55 await updateVideoChannel(server.url, server.accessToken, server.videoChannel.name, { description: channelDescription }) 70 await updateVideoChannel(server.url, server.accessToken, server.videoChannel.name, { description: channelDescription })
@@ -319,6 +334,11 @@ describe('Test a client controllers', function () {
319 334
320 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }') 335 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }')
321 }) 336 })
337
338 it('Should use the original video URL for the canonical tag', async function () {
339 const res = await makeHTMLRequest(servers[1].url, '/videos/watch/' + videoUUID)
340 expect(res.text).to.contain(`<link rel="canonical" href="${videoOriginalUrl}" />`)
341 })
322 }) 342 })
323 343
324 after(async function () { 344 after(async function () {