aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-05-31 16:30:11 +0200
committerChocobozzz <me@florianbigard.com>2019-05-31 16:44:46 +0200
commit7d14d4d2ca82cc43c93b45bb1f90af975cfbf67c (patch)
treed2d2c9806dd1bf551ad39102149f514bca4c52eb /server/tests/api/videos
parent9977c128387f38dddd697b2e9a405dcea52407b7 (diff)
downloadPeerTube-7d14d4d2ca82cc43c93b45bb1f90af975cfbf67c.tar.gz
PeerTube-7d14d4d2ca82cc43c93b45bb1f90af975cfbf67c.tar.zst
PeerTube-7d14d4d2ca82cc43c93b45bb1f90af975cfbf67c.zip
Server: Bulk update videos support field
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/video-channels.ts42
1 files changed, 36 insertions, 6 deletions
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 2d298dd3f..4f600cae8 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -2,12 +2,12 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { User, Video, VideoChannel } from '../../../../shared/index' 5import { User, Video, VideoChannel, VideoDetails } from '../../../../shared/index'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 createUser, 8 createUser,
9 doubleFollow, 9 doubleFollow,
10 flushAndRunMultipleServers, 10 flushAndRunMultipleServers, getVideo,
11 getVideoChannelVideos, 11 getVideoChannelVideos,
12 testImage, 12 testImage,
13 updateVideo, 13 updateVideo,
@@ -79,7 +79,8 @@ describe('Test video channels', function () {
79 79
80 // The channel is 1 is propagated to servers 2 80 // The channel is 1 is propagated to servers 2
81 { 81 {
82 const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, { name: 'my video name', channelId: secondVideoChannelId }) 82 const videoAttributesArg = { name: 'my video name', channelId: secondVideoChannelId, support: 'video support field' }
83 const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, videoAttributesArg)
83 videoUUID = res.body.video.uuid 84 videoUUID = res.body.video.uuid
84 } 85 }
85 86
@@ -201,12 +202,12 @@ describe('Test video channels', function () {
201 }) 202 })
202 203
203 it('Should update video channel', async function () { 204 it('Should update video channel', async function () {
204 this.timeout(5000) 205 this.timeout(15000)
205 206
206 const videoChannelAttributes = { 207 const videoChannelAttributes = {
207 displayName: 'video channel updated', 208 displayName: 'video channel updated',
208 description: 'video channel description updated', 209 description: 'video channel description updated',
209 support: 'video channel support text updated' 210 support: 'support updated'
210 } 211 }
211 212
212 await updateVideoChannel(servers[0].url, servers[0].accessToken, 'second_video_channel', videoChannelAttributes) 213 await updateVideoChannel(servers[0].url, servers[0].accessToken, 'second_video_channel', videoChannelAttributes)
@@ -224,7 +225,36 @@ describe('Test video channels', function () {
224 expect(res.body.data[0].name).to.equal('second_video_channel') 225 expect(res.body.data[0].name).to.equal('second_video_channel')
225 expect(res.body.data[0].displayName).to.equal('video channel updated') 226 expect(res.body.data[0].displayName).to.equal('video channel updated')
226 expect(res.body.data[0].description).to.equal('video channel description updated') 227 expect(res.body.data[0].description).to.equal('video channel description updated')
227 expect(res.body.data[0].support).to.equal('video channel support text updated') 228 expect(res.body.data[0].support).to.equal('support updated')
229 }
230 })
231
232 it('Should not have updated the video support field', async function () {
233 for (const server of servers) {
234 const res = await getVideo(server.url, videoUUID)
235 const video: VideoDetails = res.body
236
237 expect(video.support).to.equal('video support field')
238 }
239 })
240
241 it('Should update the channel support field and update videos too', async function () {
242 this.timeout(35000)
243
244 const videoChannelAttributes = {
245 support: 'video channel support text updated',
246 bulkVideosSupportUpdate: true
247 }
248
249 await updateVideoChannel(servers[0].url, servers[0].accessToken, 'second_video_channel', videoChannelAttributes)
250
251 await waitJobs(servers)
252
253 for (const server of servers) {
254 const res = await getVideo(server.url, videoUUID)
255 const video: VideoDetails = res.body
256
257 expect(video.support).to.equal(videoChannelAttributes.support)
228 } 258 }
229 }) 259 })
230 260