aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli/peertube.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/cli/peertube.ts')
-rw-r--r--server/tests/cli/peertube.ts41
1 files changed, 14 insertions, 27 deletions
diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts
index a0c149ac0..fe5f63191 100644
--- a/server/tests/cli/peertube.ts
+++ b/server/tests/cli/peertube.ts
@@ -2,7 +2,6 @@
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { Video, VideoDetails } from '../../../shared'
6import { 5import {
7 areHttpImportTestsDisabled, 6 areHttpImportTestsDisabled,
8 buildAbsoluteFixturePath, 7 buildAbsoluteFixturePath,
@@ -10,15 +9,10 @@ import {
10 CLICommand, 9 CLICommand,
11 doubleFollow, 10 doubleFollow,
12 flushAndRunServer, 11 flushAndRunServer,
13 getLocalIdByUUID,
14 getVideo,
15 getVideosList,
16 ImportsCommand, 12 ImportsCommand,
17 removeVideo,
18 ServerInfo, 13 ServerInfo,
19 setAccessTokensToServers, 14 setAccessTokensToServers,
20 testHelloWorldRegisteredSettings, 15 testHelloWorldRegisteredSettings,
21 uploadVideoAndGetId,
22 waitJobs 16 waitJobs
23} from '../../../shared/extra-utils' 17} from '../../../shared/extra-utils'
24 18
@@ -109,14 +103,10 @@ describe('Test CLI wrapper', function () {
109 }) 103 })
110 104
111 it('Should have the video uploaded', async function () { 105 it('Should have the video uploaded', async function () {
112 const res = await getVideosList(server.url) 106 const { total, data } = await server.videosCommand.list()
113 107 expect(total).to.equal(1)
114 expect(res.body.total).to.equal(1)
115
116 const videos: Video[] = res.body.data
117
118 const video: VideoDetails = (await getVideo(server.url, videos[0].uuid)).body
119 108
109 const video = await server.videosCommand.get({ id: data[0].uuid })
120 expect(video.name).to.equal('test upload') 110 expect(video.name).to.equal('test upload')
121 expect(video.support).to.equal('support_text') 111 expect(video.support).to.equal('support_text')
122 expect(video.channel.name).to.equal('user_channel') 112 expect(video.channel.name).to.equal('user_channel')
@@ -138,21 +128,19 @@ describe('Test CLI wrapper', function () {
138 128
139 await waitJobs([ server ]) 129 await waitJobs([ server ])
140 130
141 const res = await getVideosList(server.url) 131 const { total, data } = await server.videosCommand.list()
142 132 expect(total).to.equal(2)
143 expect(res.body.total).to.equal(2)
144 133
145 const videos: Video[] = res.body.data 134 const video = data.find(v => v.name === 'small video - youtube')
146 const video = videos.find(v => v.name === 'small video - youtube')
147 expect(video).to.not.be.undefined 135 expect(video).to.not.be.undefined
148 136
149 const videoDetails: VideoDetails = (await getVideo(server.url, video.id)).body 137 const videoDetails = await server.videosCommand.get({ id: video.id })
150 expect(videoDetails.channel.name).to.equal('user_channel') 138 expect(videoDetails.channel.name).to.equal('user_channel')
151 expect(videoDetails.support).to.equal('super support text') 139 expect(videoDetails.support).to.equal('super support text')
152 expect(videoDetails.nsfw).to.be.false 140 expect(videoDetails.nsfw).to.be.false
153 141
154 // So we can reimport it 142 // So we can reimport it
155 await removeVideo(server.url, userAccessToken, video.id) 143 await server.videosCommand.remove({ token: userAccessToken, id: video.id })
156 }) 144 })
157 145
158 it('Should import and override some imported attributes', async function () { 146 it('Should import and override some imported attributes', async function () {
@@ -167,14 +155,13 @@ describe('Test CLI wrapper', function () {
167 await waitJobs([ server ]) 155 await waitJobs([ server ])
168 156
169 { 157 {
170 const res = await getVideosList(server.url) 158 const { total, data } = await server.videosCommand.list()
171 expect(res.body.total).to.equal(2) 159 expect(total).to.equal(2)
172 160
173 const videos: Video[] = res.body.data 161 const video = data.find(v => v.name === 'toto')
174 const video = videos.find(v => v.name === 'toto')
175 expect(video).to.not.be.undefined 162 expect(video).to.not.be.undefined
176 163
177 const videoDetails: VideoDetails = (await getVideo(server.url, video.id)).body 164 const videoDetails = await server.videosCommand.get({ id: video.id })
178 expect(videoDetails.channel.name).to.equal('user_channel') 165 expect(videoDetails.channel.name).to.equal('user_channel')
179 expect(videoDetails.support).to.equal('support') 166 expect(videoDetails.support).to.equal('support')
180 expect(videoDetails.nsfw).to.be.true 167 expect(videoDetails.nsfw).to.be.true
@@ -238,10 +225,10 @@ describe('Test CLI wrapper', function () {
238 servers = [ server, anotherServer ] 225 servers = [ server, anotherServer ]
239 await waitJobs(servers) 226 await waitJobs(servers)
240 227
241 const uuid = (await uploadVideoAndGetId({ server: anotherServer, videoName: 'super video' })).uuid 228 const { uuid } = await anotherServer.videosCommand.quickUpload({ name: 'super video' })
242 await waitJobs(servers) 229 await waitJobs(servers)
243 230
244 video1Server2 = await getLocalIdByUUID(server.url, uuid) 231 video1Server2 = await server.videosCommand.getId({ uuid })
245 }) 232 })
246 233
247 it('Should add a redundancy', async function () { 234 it('Should add a redundancy', async function () {