aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-09 11:21:30 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commita54618880c394ad7571f3f3222dc96ec2dd10d9a (patch)
treec9f7b05e578abc2383bccd707c11438c61857c72 /server/tests/api/videos
parent57f879a540551c3b958b0991c8e1e3657a4481d8 (diff)
downloadPeerTube-a54618880c394ad7571f3f3222dc96ec2dd10d9a.tar.gz
PeerTube-a54618880c394ad7571f3f3222dc96ec2dd10d9a.tar.zst
PeerTube-a54618880c394ad7571f3f3222dc96ec2dd10d9a.zip
Introduce channels command
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/multiple-servers.ts8
-rw-r--r--server/tests/api/videos/video-channels.ts249
-rw-r--r--server/tests/api/videos/video-playlists.ts9
3 files changed, 94 insertions, 172 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index a8c8a889b..a59d5a858 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -5,7 +5,6 @@ import * as chai from 'chai'
5import * as request from 'supertest' 5import * as request from 'supertest'
6import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 6import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
7import { 7import {
8 addVideoChannel,
9 buildAbsoluteFixturePath, 8 buildAbsoluteFixturePath,
10 checkTmpIsEmpty, 9 checkTmpIsEmpty,
11 checkVideoFilesWereRemoved, 10 checkVideoFilesWereRemoved,
@@ -17,7 +16,6 @@ import {
17 flushAndRunMultipleServers, 16 flushAndRunMultipleServers,
18 getLocalVideos, 17 getLocalVideos,
19 getVideo, 18 getVideo,
20 getVideoChannelsList,
21 getVideosList, 19 getVideosList,
22 rateVideo, 20 rateVideo,
23 removeVideo, 21 removeVideo,
@@ -64,9 +62,9 @@ describe('Test multiple servers', function () {
64 displayName: 'my channel', 62 displayName: 'my channel',
65 description: 'super channel' 63 description: 'super channel'
66 } 64 }
67 await addVideoChannel(servers[0].url, servers[0].accessToken, videoChannel) 65 await servers[0].channelsCommand.create({ attributes: videoChannel })
68 const channelRes = await getVideoChannelsList(servers[0].url, 0, 1) 66 const { data } = await servers[0].channelsCommand.list({ start: 0, count: 1 })
69 videoChannelId = channelRes.body.data[0].id 67 videoChannelId = data[0].id
70 } 68 }
71 69
72 // Server 1 and server 2 follow each other 70 // Server 1 and server 2 follow each other
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 865098777..daf066eb1 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -7,43 +7,29 @@ import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants'
7import { 7import {
8 cleanupTests, 8 cleanupTests,
9 createUser, 9 createUser,
10 deleteVideoChannelImage,
11 doubleFollow, 10 doubleFollow,
12 flushAndRunMultipleServers, 11 flushAndRunMultipleServers,
13 getActorImage, 12 getActorImage,
14 getVideo, 13 getVideo,
15 getVideoChannel,
16 getVideoChannelVideos, 14 getVideoChannelVideos,
17 setDefaultVideoChannel, 15 setDefaultVideoChannel,
18 testFileExistsOrNot, 16 testFileExistsOrNot,
19 testImage, 17 testImage,
20 updateVideo, 18 updateVideo,
21 updateVideoChannelImage,
22 uploadVideo, 19 uploadVideo,
23 userLogin, 20 userLogin,
24 wait 21 wait
25} from '../../../../shared/extra-utils' 22} from '../../../../shared/extra-utils'
26import { 23import { getMyUserInformation, ServerInfo, setAccessTokensToServers, viewVideo } from '../../../../shared/extra-utils/index'
27 addVideoChannel,
28 deleteVideoChannel,
29 getAccountVideoChannelsList,
30 getMyUserInformation,
31 getVideoChannelsList,
32 ServerInfo,
33 setAccessTokensToServers,
34 updateVideoChannel,
35 viewVideo
36} from '../../../../shared/extra-utils/index'
37import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 24import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
38import { User, Video, VideoChannel, VideoDetails } from '../../../../shared/index' 25import { User, Video, VideoChannel, VideoDetails } from '../../../../shared/index'
39 26
40const expect = chai.expect 27const expect = chai.expect
41 28
42async function findChannel (server: ServerInfo, channelId: number) { 29async function findChannel (server: ServerInfo, channelId: number) {
43 const res = await getVideoChannelsList(server.url, 0, 5, '-name') 30 const body = await server.channelsCommand.list({ sort: '-name' })
44 const videoChannel = res.body.data.find(c => c.id === channelId)
45 31
46 return videoChannel as VideoChannel 32 return body.data.find(c => c.id === channelId)
47} 33}
48 34
49describe('Test video channels', function () { 35describe('Test video channels', function () {
@@ -69,11 +55,11 @@ describe('Test video channels', function () {
69 }) 55 })
70 56
71 it('Should have one video channel (created with root)', async () => { 57 it('Should have one video channel (created with root)', async () => {
72 const res = await getVideoChannelsList(servers[0].url, 0, 2) 58 const body = await servers[0].channelsCommand.list({ start: 0, count: 2 })
73 59
74 expect(res.body.total).to.equal(1) 60 expect(body.total).to.equal(1)
75 expect(res.body.data).to.be.an('array') 61 expect(body.data).to.be.an('array')
76 expect(res.body.data).to.have.lengthOf(1) 62 expect(body.data).to.have.lengthOf(1)
77 }) 63 })
78 64
79 it('Should create another video channel', async function () { 65 it('Should create another video channel', async function () {
@@ -86,8 +72,8 @@ describe('Test video channels', function () {
86 description: 'super video channel description', 72 description: 'super video channel description',
87 support: 'super video channel support text' 73 support: 'super video channel support text'
88 } 74 }
89 const res = await addVideoChannel(servers[0].url, servers[0].accessToken, videoChannel) 75 const created = await servers[0].channelsCommand.create({ attributes: videoChannel })
90 secondVideoChannelId = res.body.videoChannel.id 76 secondVideoChannelId = created.id
91 } 77 }
92 78
93 // The channel is 1 is propagated to servers 2 79 // The channel is 1 is propagated to servers 2
@@ -120,16 +106,14 @@ describe('Test video channels', function () {
120 }) 106 })
121 107
122 it('Should have two video channels when getting account channels on server 1', async function () { 108 it('Should have two video channels when getting account channels on server 1', async function () {
123 const res = await getAccountVideoChannelsList({ 109 const body = await servers[0].channelsCommand.listByAccount({ accountName })
124 url: servers[0].url, 110 expect(body.total).to.equal(2)
125 accountName
126 })
127 111
128 expect(res.body.total).to.equal(2) 112 const videoChannels = body.data
129 expect(res.body.data).to.be.an('array') 113
130 expect(res.body.data).to.have.lengthOf(2) 114 expect(videoChannels).to.be.an('array')
115 expect(videoChannels).to.have.lengthOf(2)
131 116
132 const videoChannels = res.body.data
133 expect(videoChannels[0].name).to.equal('root_channel') 117 expect(videoChannels[0].name).to.equal('root_channel')
134 expect(videoChannels[0].displayName).to.equal('Main root channel') 118 expect(videoChannels[0].displayName).to.equal('Main root channel')
135 119
@@ -141,79 +125,69 @@ describe('Test video channels', function () {
141 125
142 it('Should paginate and sort account channels', async function () { 126 it('Should paginate and sort account channels', async function () {
143 { 127 {
144 const res = await getAccountVideoChannelsList({ 128 const body = await servers[0].channelsCommand.listByAccount({
145 url: servers[0].url,
146 accountName, 129 accountName,
147 start: 0, 130 start: 0,
148 count: 1, 131 count: 1,
149 sort: 'createdAt' 132 sort: 'createdAt'
150 }) 133 })
151 134
152 expect(res.body.total).to.equal(2) 135 expect(body.total).to.equal(2)
153 expect(res.body.data).to.have.lengthOf(1) 136 expect(body.data).to.have.lengthOf(1)
154 137
155 const videoChannel: VideoChannel = res.body.data[0] 138 const videoChannel: VideoChannel = body.data[0]
156 expect(videoChannel.name).to.equal('root_channel') 139 expect(videoChannel.name).to.equal('root_channel')
157 } 140 }
158 141
159 { 142 {
160 const res = await getAccountVideoChannelsList({ 143 const body = await servers[0].channelsCommand.listByAccount({
161 url: servers[0].url,
162 accountName, 144 accountName,
163 start: 0, 145 start: 0,
164 count: 1, 146 count: 1,
165 sort: '-createdAt' 147 sort: '-createdAt'
166 }) 148 })
167 149
168 expect(res.body.total).to.equal(2) 150 expect(body.total).to.equal(2)
169 expect(res.body.data).to.have.lengthOf(1) 151 expect(body.data).to.have.lengthOf(1)
170 152 expect(body.data[0].name).to.equal('second_video_channel')
171 const videoChannel: VideoChannel = res.body.data[0]
172 expect(videoChannel.name).to.equal('second_video_channel')
173 } 153 }
174 154
175 { 155 {
176 const res = await getAccountVideoChannelsList({ 156 const body = await servers[0].channelsCommand.listByAccount({
177 url: servers[0].url,
178 accountName, 157 accountName,
179 start: 1, 158 start: 1,
180 count: 1, 159 count: 1,
181 sort: '-createdAt' 160 sort: '-createdAt'
182 }) 161 })
183 162
184 expect(res.body.total).to.equal(2) 163 expect(body.total).to.equal(2)
185 expect(res.body.data).to.have.lengthOf(1) 164 expect(body.data).to.have.lengthOf(1)
186 165 expect(body.data[0].name).to.equal('root_channel')
187 const videoChannel: VideoChannel = res.body.data[0]
188 expect(videoChannel.name).to.equal('root_channel')
189 } 166 }
190 }) 167 })
191 168
192 it('Should have one video channel when getting account channels on server 2', async function () { 169 it('Should have one video channel when getting account channels on server 2', async function () {
193 const res = await getAccountVideoChannelsList({ 170 const body = await servers[1].channelsCommand.listByAccount({ accountName })
194 url: servers[1].url,
195 accountName
196 })
197 171
198 expect(res.body.total).to.equal(1) 172 expect(body.total).to.equal(1)
199 expect(res.body.data).to.be.an('array') 173 expect(body.data).to.be.an('array')
200 expect(res.body.data).to.have.lengthOf(1) 174 expect(body.data).to.have.lengthOf(1)
201 175
202 const videoChannels = res.body.data 176 const videoChannel = body.data[0]
203 expect(videoChannels[0].name).to.equal('second_video_channel') 177 expect(videoChannel.name).to.equal('second_video_channel')
204 expect(videoChannels[0].displayName).to.equal('second video channel') 178 expect(videoChannel.displayName).to.equal('second video channel')
205 expect(videoChannels[0].description).to.equal('super video channel description') 179 expect(videoChannel.description).to.equal('super video channel description')
206 expect(videoChannels[0].support).to.equal('super video channel support text') 180 expect(videoChannel.support).to.equal('super video channel support text')
207 }) 181 })
208 182
209 it('Should list video channels', async function () { 183 it('Should list video channels', async function () {
210 const res = await getVideoChannelsList(servers[0].url, 1, 1, '-name') 184 const body = await servers[0].channelsCommand.list({ start: 1, count: 1, sort: '-name' })
211 185
212 expect(res.body.total).to.equal(2) 186 expect(body.total).to.equal(2)
213 expect(res.body.data).to.be.an('array') 187 expect(body.data).to.be.an('array')
214 expect(res.body.data).to.have.lengthOf(1) 188 expect(body.data).to.have.lengthOf(1)
215 expect(res.body.data[0].name).to.equal('root_channel') 189 expect(body.data[0].name).to.equal('root_channel')
216 expect(res.body.data[0].displayName).to.equal('Main root channel') 190 expect(body.data[0].displayName).to.equal('Main root channel')
217 }) 191 })
218 192
219 it('Should update video channel', async function () { 193 it('Should update video channel', async function () {
@@ -225,22 +199,23 @@ describe('Test video channels', function () {
225 support: 'support updated' 199 support: 'support updated'
226 } 200 }
227 201
228 await updateVideoChannel(servers[0].url, servers[0].accessToken, 'second_video_channel', videoChannelAttributes) 202 await servers[0].channelsCommand.update({ channelName: 'second_video_channel', attributes: videoChannelAttributes })
229 203
230 await waitJobs(servers) 204 await waitJobs(servers)
231 }) 205 })
232 206
233 it('Should have video channel updated', async function () { 207 it('Should have video channel updated', async function () {
234 for (const server of servers) { 208 for (const server of servers) {
235 const res = await getVideoChannelsList(server.url, 0, 1, '-name') 209 const body = await server.channelsCommand.list({ start: 0, count: 1, sort: '-name' })
236 210
237 expect(res.body.total).to.equal(2) 211 expect(body.total).to.equal(2)
238 expect(res.body.data).to.be.an('array') 212 expect(body.data).to.be.an('array')
239 expect(res.body.data).to.have.lengthOf(1) 213 expect(body.data).to.have.lengthOf(1)
240 expect(res.body.data[0].name).to.equal('second_video_channel') 214
241 expect(res.body.data[0].displayName).to.equal('video channel updated') 215 expect(body.data[0].name).to.equal('second_video_channel')
242 expect(res.body.data[0].description).to.equal('video channel description updated') 216 expect(body.data[0].displayName).to.equal('video channel updated')
243 expect(res.body.data[0].support).to.equal('support updated') 217 expect(body.data[0].description).to.equal('video channel description updated')
218 expect(body.data[0].support).to.equal('support updated')
244 } 219 }
245 }) 220 })
246 221
@@ -261,7 +236,7 @@ describe('Test video channels', function () {
261 bulkVideosSupportUpdate: true 236 bulkVideosSupportUpdate: true
262 } 237 }
263 238
264 await updateVideoChannel(servers[0].url, servers[0].accessToken, 'second_video_channel', videoChannelAttributes) 239 await servers[0].channelsCommand.update({ channelName: 'second_video_channel', attributes: videoChannelAttributes })
265 240
266 await waitJobs(servers) 241 await waitJobs(servers)
267 242
@@ -278,10 +253,8 @@ describe('Test video channels', function () {
278 253
279 const fixture = 'avatar.png' 254 const fixture = 'avatar.png'
280 255
281 await updateVideoChannelImage({ 256 await servers[0].channelsCommand.updateImage({
282 url: servers[0].url, 257 channelName: 'second_video_channel',
283 accessToken: servers[0].accessToken,
284 videoChannelName: 'second_video_channel',
285 fixture, 258 fixture,
286 type: 'avatar' 259 type: 'avatar'
287 }) 260 })
@@ -306,10 +279,8 @@ describe('Test video channels', function () {
306 279
307 const fixture = 'banner.jpg' 280 const fixture = 'banner.jpg'
308 281
309 await updateVideoChannelImage({ 282 await servers[0].channelsCommand.updateImage({
310 url: servers[0].url, 283 channelName: 'second_video_channel',
311 accessToken: servers[0].accessToken,
312 videoChannelName: 'second_video_channel',
313 fixture, 284 fixture,
314 type: 'banner' 285 type: 'banner'
315 }) 286 })
@@ -317,8 +288,7 @@ describe('Test video channels', function () {
317 await waitJobs(servers) 288 await waitJobs(servers)
318 289
319 for (const server of servers) { 290 for (const server of servers) {
320 const res = await getVideoChannel(server.url, 'second_video_channel@' + servers[0].host) 291 const videoChannel = await server.channelsCommand.get({ channelName: 'second_video_channel@' + servers[0].host })
321 const videoChannel = res.body
322 292
323 bannerPaths[server.port] = videoChannel.banner.path 293 bannerPaths[server.port] = videoChannel.banner.path
324 await testImage(server.url, 'banner-resized', bannerPaths[server.port]) 294 await testImage(server.url, 'banner-resized', bannerPaths[server.port])
@@ -333,12 +303,7 @@ describe('Test video channels', function () {
333 it('Should delete the video channel avatar', async function () { 303 it('Should delete the video channel avatar', async function () {
334 this.timeout(15000) 304 this.timeout(15000)
335 305
336 await deleteVideoChannelImage({ 306 await servers[0].channelsCommand.deleteImage({ channelName: 'second_video_channel', type: 'avatar' })
337 url: servers[0].url,
338 accessToken: servers[0].accessToken,
339 videoChannelName: 'second_video_channel',
340 type: 'avatar'
341 })
342 307
343 await waitJobs(servers) 308 await waitJobs(servers)
344 309
@@ -353,12 +318,7 @@ describe('Test video channels', function () {
353 it('Should delete the video channel banner', async function () { 318 it('Should delete the video channel banner', async function () {
354 this.timeout(15000) 319 this.timeout(15000)
355 320
356 await deleteVideoChannelImage({ 321 await servers[0].channelsCommand.deleteImage({ channelName: 'second_video_channel', type: 'banner' })
357 url: servers[0].url,
358 accessToken: servers[0].accessToken,
359 videoChannelName: 'second_video_channel',
360 type: 'banner'
361 })
362 322
363 await waitJobs(servers) 323 await waitJobs(servers)
364 324
@@ -411,23 +371,23 @@ describe('Test video channels', function () {
411 }) 371 })
412 372
413 it('Should delete video channel', async function () { 373 it('Should delete video channel', async function () {
414 await deleteVideoChannel(servers[0].url, servers[0].accessToken, 'second_video_channel') 374 await servers[0].channelsCommand.delete({ channelName: 'second_video_channel' })
415 }) 375 })
416 376
417 it('Should have video channel deleted', async function () { 377 it('Should have video channel deleted', async function () {
418 const res = await getVideoChannelsList(servers[0].url, 0, 10) 378 const body = await servers[0].channelsCommand.list({ start: 0, count: 10 })
419 379
420 expect(res.body.total).to.equal(1) 380 expect(body.total).to.equal(1)
421 expect(res.body.data).to.be.an('array') 381 expect(body.data).to.be.an('array')
422 expect(res.body.data).to.have.lengthOf(1) 382 expect(body.data).to.have.lengthOf(1)
423 expect(res.body.data[0].displayName).to.equal('Main root channel') 383 expect(body.data[0].displayName).to.equal('Main root channel')
424 }) 384 })
425 385
426 it('Should create the main channel with an uuid if there is a conflict', async function () { 386 it('Should create the main channel with an uuid if there is a conflict', async function () {
427 { 387 {
428 const videoChannel = { name: 'toto_channel', displayName: 'My toto channel' } 388 const videoChannel = { name: 'toto_channel', displayName: 'My toto channel' }
429 const res = await addVideoChannel(servers[0].url, servers[0].accessToken, videoChannel) 389 const created = await servers[0].channelsCommand.create({ attributes: videoChannel })
430 totoChannel = res.body.videoChannel.id 390 totoChannel = created.id
431 } 391 }
432 392
433 { 393 {
@@ -444,15 +404,9 @@ describe('Test video channels', function () {
444 this.timeout(10000) 404 this.timeout(10000)
445 405
446 { 406 {
447 const res = await getAccountVideoChannelsList({ 407 const { data } = await servers[0].channelsCommand.listByAccount({ accountName, withStats: true })
448 url: servers[0].url,
449 accountName,
450 withStats: true
451 })
452
453 const channels: VideoChannel[] = res.body.data
454 408
455 for (const channel of channels) { 409 for (const channel of data) {
456 expect(channel).to.haveOwnProperty('viewsPerDay') 410 expect(channel).to.haveOwnProperty('viewsPerDay')
457 expect(channel.viewsPerDay).to.have.length(30 + 1) // daysPrior + today 411 expect(channel.viewsPerDay).to.have.length(30 + 1) // daysPrior + today
458 412
@@ -471,26 +425,17 @@ describe('Test video channels', function () {
471 // Wait the repeatable job 425 // Wait the repeatable job
472 await wait(8000) 426 await wait(8000)
473 427
474 const res = await getAccountVideoChannelsList({ 428 const { data } = await servers[0].channelsCommand.listByAccount({ accountName, withStats: true })
475 url: servers[0].url, 429 const channelWithView = data.find(channel => channel.id === servers[0].videoChannel.id)
476 accountName,
477 withStats: true
478 })
479 const channelWithView = res.body.data.find((channel: VideoChannel) => channel.id === servers[0].videoChannel.id)
480 expect(channelWithView.viewsPerDay.slice(-1)[0].views).to.equal(2) 430 expect(channelWithView.viewsPerDay.slice(-1)[0].views).to.equal(2)
481 } 431 }
482 }) 432 })
483 433
484 it('Should report correct videos count', async function () { 434 it('Should report correct videos count', async function () {
485 const res = await getAccountVideoChannelsList({ 435 const { data } = await servers[0].channelsCommand.listByAccount({ accountName, withStats: true })
486 url: servers[0].url,
487 accountName,
488 withStats: true
489 })
490 const channels: VideoChannel[] = res.body.data
491 436
492 const totoChannel = channels.find(c => c.name === 'toto_channel') 437 const totoChannel = data.find(c => c.name === 'toto_channel')
493 const rootChannel = channels.find(c => c.name === 'root_channel') 438 const rootChannel = data.find(c => c.name === 'root_channel')
494 439
495 expect(rootChannel.videosCount).to.equal(1) 440 expect(rootChannel.videosCount).to.equal(1)
496 expect(totoChannel.videosCount).to.equal(0) 441 expect(totoChannel.videosCount).to.equal(0)
@@ -498,26 +443,18 @@ describe('Test video channels', function () {
498 443
499 it('Should search among account video channels', async function () { 444 it('Should search among account video channels', async function () {
500 { 445 {
501 const res = await getAccountVideoChannelsList({ 446 const body = await servers[0].channelsCommand.listByAccount({ accountName, search: 'root' })
502 url: servers[0].url, 447 expect(body.total).to.equal(1)
503 accountName,
504 search: 'root'
505 })
506 expect(res.body.total).to.equal(1)
507 448
508 const channels = res.body.data 449 const channels = body.data
509 expect(channels).to.have.lengthOf(1) 450 expect(channels).to.have.lengthOf(1)
510 } 451 }
511 452
512 { 453 {
513 const res = await getAccountVideoChannelsList({ 454 const body = await servers[0].channelsCommand.listByAccount({ accountName, search: 'does not exist' })
514 url: servers[0].url, 455 expect(body.total).to.equal(0)
515 accountName,
516 search: 'does not exist'
517 })
518 expect(res.body.total).to.equal(0)
519 456
520 const channels = res.body.data 457 const channels = body.data
521 expect(channels).to.have.lengthOf(0) 458 expect(channels).to.have.lengthOf(0)
522 } 459 }
523 }) 460 })
@@ -529,30 +466,20 @@ describe('Test video channels', function () {
529 await waitJobs(servers) 466 await waitJobs(servers)
530 467
531 for (const server of servers) { 468 for (const server of servers) {
532 const res = await getAccountVideoChannelsList({ 469 const { data } = await server.channelsCommand.listByAccount({ accountName, sort: '-updatedAt' })
533 url: server.url,
534 accountName,
535 sort: '-updatedAt'
536 })
537 470
538 const channels: VideoChannel[] = res.body.data 471 expect(data[0].name).to.equal('toto_channel')
539 expect(channels[0].name).to.equal('toto_channel') 472 expect(data[1].name).to.equal('root_channel')
540 expect(channels[1].name).to.equal('root_channel')
541 } 473 }
542 474
543 await uploadVideo(servers[0].url, servers[0].accessToken, { channelId: servers[0].videoChannel.id }) 475 await uploadVideo(servers[0].url, servers[0].accessToken, { channelId: servers[0].videoChannel.id })
544 await waitJobs(servers) 476 await waitJobs(servers)
545 477
546 for (const server of servers) { 478 for (const server of servers) {
547 const res = await getAccountVideoChannelsList({ 479 const { data } = await server.channelsCommand.listByAccount({ accountName, sort: '-updatedAt' })
548 url: server.url,
549 accountName,
550 sort: '-updatedAt'
551 })
552 480
553 const channels: VideoChannel[] = res.body.data 481 expect(data[0].name).to.equal('root_channel')
554 expect(channels[0].name).to.equal('root_channel') 482 expect(data[1].name).to.equal('toto_channel')
555 expect(channels[1].name).to.equal('toto_channel')
556 } 483 }
557 }) 484 })
558 485
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts
index 4de6b3abf..2bb019348 100644
--- a/server/tests/api/videos/video-playlists.ts
+++ b/server/tests/api/videos/video-playlists.ts
@@ -4,11 +4,9 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 addVideoChannel,
8 checkPlaylistFilesWereRemoved, 7 checkPlaylistFilesWereRemoved,
9 cleanupTests, 8 cleanupTests,
10 createUser, 9 createUser,
11 deleteVideoChannel,
12 doubleFollow, 10 doubleFollow,
13 flushAndRunMultipleServers, 11 flushAndRunMultipleServers,
14 generateUserAccessToken, 12 generateUserAccessToken,
@@ -1096,20 +1094,19 @@ describe('Test video playlists', function () {
1096 it('Should delete a channel and put the associated playlist in private mode', async function () { 1094 it('Should delete a channel and put the associated playlist in private mode', async function () {
1097 this.timeout(30000) 1095 this.timeout(30000)
1098 1096
1099 const res = await addVideoChannel(servers[0].url, servers[0].accessToken, { name: 'super_channel', displayName: 'super channel' }) 1097 const channel = await servers[0].channelsCommand.create({ attributes: { name: 'super_channel', displayName: 'super channel' } })
1100 const videoChannelId = res.body.videoChannel.id
1101 1098
1102 const playlistCreated = await commands[0].create({ 1099 const playlistCreated = await commands[0].create({
1103 attributes: { 1100 attributes: {
1104 displayName: 'channel playlist', 1101 displayName: 'channel playlist',
1105 privacy: VideoPlaylistPrivacy.PUBLIC, 1102 privacy: VideoPlaylistPrivacy.PUBLIC,
1106 videoChannelId 1103 videoChannelId: channel.id
1107 } 1104 }
1108 }) 1105 })
1109 1106
1110 await waitJobs(servers) 1107 await waitJobs(servers)
1111 1108
1112 await deleteVideoChannel(servers[0].url, servers[0].accessToken, 'super_channel') 1109 await servers[0].channelsCommand.delete({ channelName: 'super_channel' })
1113 1110
1114 await waitJobs(servers) 1111 await waitJobs(servers)
1115 1112