aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli/update-host.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-15 10:02:54 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commitd23dd9fbfc4d26026352c10f81d2795ceaf2908a (patch)
treeda82286d423c5e834a1ee2dcd5970076b8263cf1 /server/tests/cli/update-host.ts
parent7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (diff)
downloadPeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.gz
PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.zst
PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.zip
Introduce videos command
Diffstat (limited to 'server/tests/cli/update-host.ts')
-rw-r--r--server/tests/cli/update-host.ts29
1 files changed, 10 insertions, 19 deletions
diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts
index b857fcf28..d90b4a64d 100644
--- a/server/tests/cli/update-host.ts
+++ b/server/tests/cli/update-host.ts
@@ -5,18 +5,14 @@ import { expect } from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 flushAndRunServer,
8 getVideo,
9 getVideosList,
10 killallServers, 8 killallServers,
11 makeActivityPubGetRequest, 9 makeActivityPubGetRequest,
12 parseTorrentVideo, 10 parseTorrentVideo,
13 reRunServer, 11 reRunServer,
14 ServerInfo, 12 ServerInfo,
15 setAccessTokensToServers, 13 setAccessTokensToServers,
16 uploadVideo,
17 waitJobs 14 waitJobs
18} from '@shared/extra-utils' 15} from '@shared/extra-utils'
19import { VideoDetails } from '@shared/models'
20 16
21describe('Test update host scripts', function () { 17describe('Test update host scripts', function () {
22 let server: ServerInfo 18 let server: ServerInfo
@@ -34,10 +30,8 @@ describe('Test update host scripts', function () {
34 await setAccessTokensToServers([ server ]) 30 await setAccessTokensToServers([ server ])
35 31
36 // Upload two videos for our needs 32 // Upload two videos for our needs
37 const videoAttributes = {} 33 const { uuid: video1UUID } = await server.videosCommand.upload()
38 const resVideo1 = await uploadVideo(server.url, server.accessToken, videoAttributes) 34 await server.videosCommand.upload()
39 const video1UUID = resVideo1.body.video.uuid
40 await uploadVideo(server.url, server.accessToken, videoAttributes)
41 35
42 // Create a user 36 // Create a user
43 await server.usersCommand.create({ username: 'toto', password: 'coucou' }) 37 await server.usersCommand.create({ username: 'toto', password: 'coucou' })
@@ -68,16 +62,15 @@ describe('Test update host scripts', function () {
68 }) 62 })
69 63
70 it('Should have updated videos url', async function () { 64 it('Should have updated videos url', async function () {
71 const res = await getVideosList(server.url) 65 const { total, data } = await server.videosCommand.list()
72 expect(res.body.total).to.equal(2) 66 expect(total).to.equal(2)
73 67
74 for (const video of res.body.data) { 68 for (const video of data) {
75 const { body } = await makeActivityPubGetRequest(server.url, '/videos/watch/' + video.uuid) 69 const { body } = await makeActivityPubGetRequest(server.url, '/videos/watch/' + video.uuid)
76 70
77 expect(body.id).to.equal('http://localhost:9002/videos/watch/' + video.uuid) 71 expect(body.id).to.equal('http://localhost:9002/videos/watch/' + video.uuid)
78 72
79 const res = await getVideo(server.url, video.uuid) 73 const videoDetails = await server.videosCommand.get({ id: video.uuid })
80 const videoDetails: VideoDetails = res.body
81 74
82 expect(videoDetails.trackerUrls[0]).to.include(server.host) 75 expect(videoDetails.trackerUrls[0]).to.include(server.host)
83 expect(videoDetails.streamingPlaylists[0].playlistUrl).to.include(server.host) 76 expect(videoDetails.streamingPlaylists[0].playlistUrl).to.include(server.host)
@@ -111,13 +104,11 @@ describe('Test update host scripts', function () {
111 it('Should have updated torrent hosts', async function () { 104 it('Should have updated torrent hosts', async function () {
112 this.timeout(30000) 105 this.timeout(30000)
113 106
114 const res = await getVideosList(server.url) 107 const { data } = await server.videosCommand.list()
115 const videos = res.body.data 108 expect(data).to.have.lengthOf(2)
116 expect(videos).to.have.lengthOf(2)
117 109
118 for (const video of videos) { 110 for (const video of data) {
119 const res2 = await getVideo(server.url, video.id) 111 const videoDetails = await server.videosCommand.get({ id: video.id })
120 const videoDetails: VideoDetails = res2.body
121 112
122 expect(videoDetails.files).to.have.lengthOf(4) 113 expect(videoDetails.files).to.have.lengthOf(4)
123 114