diff options
Diffstat (limited to 'server/tests/cli/update-host.ts')
-rw-r--r-- | server/tests/cli/update-host.ts | 29 |
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' | |||
5 | import { | 5 | import { |
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' |
19 | import { VideoDetails } from '@shared/models' | ||
20 | 16 | ||
21 | describe('Test update host scripts', function () { | 17 | describe('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 | ||