aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 09:04:35 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit89d241a79c262b9775c233b73cff080043ebb5e6 (patch)
treecb3b6cb431d25d891ef4e02f66c61d252d17048f /server/tests/api/videos
parentd23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff)
downloadPeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip
Shorter server command names
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/audio-only.ts8
-rw-r--r--server/tests/api/videos/multiple-servers.ts168
-rw-r--r--server/tests/api/videos/resumable-upload.ts18
-rw-r--r--server/tests/api/videos/single-server.ts90
-rw-r--r--server/tests/api/videos/video-captions.ts24
-rw-r--r--server/tests/api/videos/video-change-ownership.ts50
-rw-r--r--server/tests/api/videos/video-channels.ts92
-rw-r--r--server/tests/api/videos/video-comments.ts8
-rw-r--r--server/tests/api/videos/video-description.ts16
-rw-r--r--server/tests/api/videos/video-hls.ts22
-rw-r--r--server/tests/api/videos/video-imports.ts44
-rw-r--r--server/tests/api/videos/video-nsfw.ts52
-rw-r--r--server/tests/api/videos/video-playlist-thumbnails.ts36
-rw-r--r--server/tests/api/videos/video-playlists.ts184
-rw-r--r--server/tests/api/videos/video-privacy.ts56
-rw-r--r--server/tests/api/videos/video-schedule-update.ts20
-rw-r--r--server/tests/api/videos/video-transcoder.ts122
-rw-r--r--server/tests/api/videos/videos-filter.ts10
-rw-r--r--server/tests/api/videos/videos-history.ts30
-rw-r--r--server/tests/api/videos/videos-overview.ts24
-rw-r--r--server/tests/api/videos/videos-views-cleaner.ts22
21 files changed, 548 insertions, 548 deletions
diff --git a/server/tests/api/videos/audio-only.ts b/server/tests/api/videos/audio-only.ts
index e31905b36..b2952e38b 100644
--- a/server/tests/api/videos/audio-only.ts
+++ b/server/tests/api/videos/audio-only.ts
@@ -48,13 +48,13 @@ describe('Test audio only video transcoding', function () {
48 it('Should upload a video and transcode it', async function () { 48 it('Should upload a video and transcode it', async function () {
49 this.timeout(120000) 49 this.timeout(120000)
50 50
51 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'audio only' } }) 51 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'audio only' } })
52 videoUUID = uuid 52 videoUUID = uuid
53 53
54 await waitJobs(servers) 54 await waitJobs(servers)
55 55
56 for (const server of servers) { 56 for (const server of servers) {
57 const video = await server.videosCommand.get({ id: videoUUID }) 57 const video = await server.videos.get({ id: videoUUID })
58 expect(video.streamingPlaylists).to.have.lengthOf(1) 58 expect(video.streamingPlaylists).to.have.lengthOf(1)
59 59
60 for (const files of [ video.files, video.streamingPlaylists[0].files ]) { 60 for (const files of [ video.files, video.streamingPlaylists[0].files ]) {
@@ -68,8 +68,8 @@ describe('Test audio only video transcoding', function () {
68 68
69 it('0p transcoded video should not have video', async function () { 69 it('0p transcoded video should not have video', async function () {
70 const paths = [ 70 const paths = [
71 servers[0].serversCommand.buildDirectory(join('videos', videoUUID + '-0.mp4')), 71 servers[0].servers.buildDirectory(join('videos', videoUUID + '-0.mp4')),
72 servers[0].serversCommand.buildDirectory(join('streaming-playlists', 'hls', videoUUID, videoUUID + '-0-fragmented.mp4')) 72 servers[0].servers.buildDirectory(join('streaming-playlists', 'hls', videoUUID, videoUUID + '-0-fragmented.mp4'))
73 ] 73 ]
74 74
75 for (const path of paths) { 75 for (const path of paths) {
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index 5c13ac629..89d842307 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -44,8 +44,8 @@ describe('Test multiple servers', function () {
44 displayName: 'my channel', 44 displayName: 'my channel',
45 description: 'super channel' 45 description: 'super channel'
46 } 46 }
47 await servers[0].channelsCommand.create({ attributes: videoChannel }) 47 await servers[0].channels.create({ attributes: videoChannel })
48 const { data } = await servers[0].channelsCommand.list({ start: 0, count: 1 }) 48 const { data } = await servers[0].channels.list({ start: 0, count: 1 })
49 videoChannelId = data[0].id 49 videoChannelId = data[0].id
50 } 50 }
51 51
@@ -59,7 +59,7 @@ describe('Test multiple servers', function () {
59 59
60 it('Should not have videos for all servers', async function () { 60 it('Should not have videos for all servers', async function () {
61 for (const server of servers) { 61 for (const server of servers) {
62 const { data } = await server.videosCommand.list() 62 const { data } = await server.videos.list()
63 expect(data).to.be.an('array') 63 expect(data).to.be.an('array')
64 expect(data.length).to.equal(0) 64 expect(data.length).to.equal(0)
65 } 65 }
@@ -82,7 +82,7 @@ describe('Test multiple servers', function () {
82 channelId: videoChannelId, 82 channelId: videoChannelId,
83 fixture: 'video_short1.webm' 83 fixture: 'video_short1.webm'
84 } 84 }
85 await servers[0].videosCommand.upload({ attributes }) 85 await servers[0].videos.upload({ attributes })
86 86
87 await waitJobs(servers) 87 await waitJobs(servers)
88 88
@@ -125,7 +125,7 @@ describe('Test multiple servers', function () {
125 ] 125 ]
126 } 126 }
127 127
128 const { data } = await server.videosCommand.list() 128 const { data } = await server.videos.list()
129 expect(data).to.be.an('array') 129 expect(data).to.be.an('array')
130 expect(data.length).to.equal(1) 130 expect(data.length).to.equal(1)
131 const video = data[0] 131 const video = data[0]
@@ -142,8 +142,8 @@ describe('Test multiple servers', function () {
142 username: 'user1', 142 username: 'user1',
143 password: 'super_password' 143 password: 'super_password'
144 } 144 }
145 await servers[1].usersCommand.create({ username: user.username, password: user.password }) 145 await servers[1].users.create({ username: user.username, password: user.password })
146 const userAccessToken = await servers[1].loginCommand.getAccessToken(user) 146 const userAccessToken = await servers[1].login.getAccessToken(user)
147 147
148 const attributes = { 148 const attributes = {
149 name: 'my super name for server 2', 149 name: 'my super name for server 2',
@@ -158,7 +158,7 @@ describe('Test multiple servers', function () {
158 thumbnailfile: 'thumbnail.jpg', 158 thumbnailfile: 'thumbnail.jpg',
159 previewfile: 'preview.jpg' 159 previewfile: 'preview.jpg'
160 } 160 }
161 await servers[1].videosCommand.upload({ token: userAccessToken, attributes, mode: 'resumable' }) 161 await servers[1].videos.upload({ token: userAccessToken, attributes, mode: 'resumable' })
162 162
163 // Transcoding 163 // Transcoding
164 await waitJobs(servers) 164 await waitJobs(servers)
@@ -213,7 +213,7 @@ describe('Test multiple servers', function () {
213 previewfile: 'preview' 213 previewfile: 'preview'
214 } 214 }
215 215
216 const { data } = await server.videosCommand.list() 216 const { data } = await server.videos.list()
217 expect(data).to.be.an('array') 217 expect(data).to.be.an('array')
218 expect(data.length).to.equal(2) 218 expect(data.length).to.equal(2)
219 const video = data[1] 219 const video = data[1]
@@ -237,7 +237,7 @@ describe('Test multiple servers', function () {
237 tags: [ 'tag1p3' ], 237 tags: [ 'tag1p3' ],
238 fixture: 'video_short3.webm' 238 fixture: 'video_short3.webm'
239 } 239 }
240 await servers[2].videosCommand.upload({ attributes }) 240 await servers[2].videos.upload({ attributes })
241 } 241 }
242 242
243 { 243 {
@@ -252,7 +252,7 @@ describe('Test multiple servers', function () {
252 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ], 252 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
253 fixture: 'video_short.webm' 253 fixture: 'video_short.webm'
254 } 254 }
255 await servers[2].videosCommand.upload({ attributes }) 255 await servers[2].videos.upload({ attributes })
256 } 256 }
257 257
258 await waitJobs(servers) 258 await waitJobs(servers)
@@ -260,7 +260,7 @@ describe('Test multiple servers', function () {
260 // All servers should have this video 260 // All servers should have this video
261 for (const server of servers) { 261 for (const server of servers) {
262 const isLocal = server.url === 'http://localhost:' + servers[2].port 262 const isLocal = server.url === 'http://localhost:' + servers[2].port
263 const { data } = await server.videosCommand.list() 263 const { data } = await server.videos.list()
264 264
265 expect(data).to.be.an('array') 265 expect(data).to.be.an('array')
266 expect(data.length).to.equal(4) 266 expect(data.length).to.equal(4)
@@ -349,7 +349,7 @@ describe('Test multiple servers', function () {
349 349
350 describe('It should list local videos', function () { 350 describe('It should list local videos', function () {
351 it('Should list only local videos on server 1', async function () { 351 it('Should list only local videos on server 1', async function () {
352 const { data, total } = await servers[0].videosCommand.list({ filter: 'local' }) 352 const { data, total } = await servers[0].videos.list({ filter: 'local' })
353 353
354 expect(total).to.equal(1) 354 expect(total).to.equal(1)
355 expect(data).to.be.an('array') 355 expect(data).to.be.an('array')
@@ -358,7 +358,7 @@ describe('Test multiple servers', function () {
358 }) 358 })
359 359
360 it('Should list only local videos on server 2', async function () { 360 it('Should list only local videos on server 2', async function () {
361 const { data, total } = await servers[1].videosCommand.list({ filter: 'local' }) 361 const { data, total } = await servers[1].videos.list({ filter: 'local' })
362 362
363 expect(total).to.equal(1) 363 expect(total).to.equal(1)
364 expect(data).to.be.an('array') 364 expect(data).to.be.an('array')
@@ -367,7 +367,7 @@ describe('Test multiple servers', function () {
367 }) 367 })
368 368
369 it('Should list only local videos on server 3', async function () { 369 it('Should list only local videos on server 3', async function () {
370 const { data, total } = await servers[2].videosCommand.list({ filter: 'local' }) 370 const { data, total } = await servers[2].videos.list({ filter: 'local' })
371 371
372 expect(total).to.equal(2) 372 expect(total).to.equal(2)
373 expect(data).to.be.an('array') 373 expect(data).to.be.an('array')
@@ -381,13 +381,13 @@ describe('Test multiple servers', function () {
381 it('Should add the file 1 by asking server 3', async function () { 381 it('Should add the file 1 by asking server 3', async function () {
382 this.timeout(10000) 382 this.timeout(10000)
383 383
384 const { data } = await servers[2].videosCommand.list() 384 const { data } = await servers[2].videos.list()
385 385
386 const video = data[0] 386 const video = data[0]
387 toRemove.push(data[2]) 387 toRemove.push(data[2])
388 toRemove.push(data[3]) 388 toRemove.push(data[3])
389 389
390 const videoDetails = await servers[2].videosCommand.get({ id: video.id }) 390 const videoDetails = await servers[2].videos.get({ id: video.id })
391 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true) 391 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
392 expect(torrent.files).to.be.an('array') 392 expect(torrent.files).to.be.an('array')
393 expect(torrent.files.length).to.equal(1) 393 expect(torrent.files.length).to.equal(1)
@@ -397,10 +397,10 @@ describe('Test multiple servers', function () {
397 it('Should add the file 2 by asking server 1', async function () { 397 it('Should add the file 2 by asking server 1', async function () {
398 this.timeout(10000) 398 this.timeout(10000)
399 399
400 const { data } = await servers[0].videosCommand.list() 400 const { data } = await servers[0].videos.list()
401 401
402 const video = data[1] 402 const video = data[1]
403 const videoDetails = await servers[0].videosCommand.get({ id: video.id }) 403 const videoDetails = await servers[0].videos.get({ id: video.id })
404 404
405 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true) 405 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
406 expect(torrent.files).to.be.an('array') 406 expect(torrent.files).to.be.an('array')
@@ -411,10 +411,10 @@ describe('Test multiple servers', function () {
411 it('Should add the file 3 by asking server 2', async function () { 411 it('Should add the file 3 by asking server 2', async function () {
412 this.timeout(10000) 412 this.timeout(10000)
413 413
414 const { data } = await servers[1].videosCommand.list() 414 const { data } = await servers[1].videos.list()
415 415
416 const video = data[2] 416 const video = data[2]
417 const videoDetails = await servers[1].videosCommand.get({ id: video.id }) 417 const videoDetails = await servers[1].videos.get({ id: video.id })
418 418
419 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true) 419 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
420 expect(torrent.files).to.be.an('array') 420 expect(torrent.files).to.be.an('array')
@@ -425,10 +425,10 @@ describe('Test multiple servers', function () {
425 it('Should add the file 3-2 by asking server 1', async function () { 425 it('Should add the file 3-2 by asking server 1', async function () {
426 this.timeout(10000) 426 this.timeout(10000)
427 427
428 const { data } = await servers[0].videosCommand.list() 428 const { data } = await servers[0].videos.list()
429 429
430 const video = data[3] 430 const video = data[3]
431 const videoDetails = await servers[0].videosCommand.get({ id: video.id }) 431 const videoDetails = await servers[0].videos.get({ id: video.id })
432 432
433 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri) 433 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri)
434 expect(torrent.files).to.be.an('array') 434 expect(torrent.files).to.be.an('array')
@@ -439,10 +439,10 @@ describe('Test multiple servers', function () {
439 it('Should add the file 2 in 360p by asking server 1', async function () { 439 it('Should add the file 2 in 360p by asking server 1', async function () {
440 this.timeout(10000) 440 this.timeout(10000)
441 441
442 const { data } = await servers[0].videosCommand.list() 442 const { data } = await servers[0].videos.list()
443 443
444 const video = data.find(v => v.name === 'my super name for server 2') 444 const video = data.find(v => v.name === 'my super name for server 2')
445 const videoDetails = await servers[0].videosCommand.get({ id: video.id }) 445 const videoDetails = await servers[0].videos.get({ id: video.id })
446 446
447 const file = videoDetails.files.find(f => f.resolution.id === 360) 447 const file = videoDetails.files.find(f => f.resolution.id === 360)
448 expect(file).not.to.be.undefined 448 expect(file).not.to.be.undefined
@@ -462,17 +462,17 @@ describe('Test multiple servers', function () {
462 462
463 before(async function () { 463 before(async function () {
464 { 464 {
465 const { data } = await servers[0].videosCommand.list() 465 const { data } = await servers[0].videos.list()
466 remoteVideosServer1 = data.filter(video => video.isLocal === false).map(video => video.uuid) 466 remoteVideosServer1 = data.filter(video => video.isLocal === false).map(video => video.uuid)
467 } 467 }
468 468
469 { 469 {
470 const { data } = await servers[1].videosCommand.list() 470 const { data } = await servers[1].videos.list()
471 remoteVideosServer2 = data.filter(video => video.isLocal === false).map(video => video.uuid) 471 remoteVideosServer2 = data.filter(video => video.isLocal === false).map(video => video.uuid)
472 } 472 }
473 473
474 { 474 {
475 const { data } = await servers[2].videosCommand.list() 475 const { data } = await servers[2].videos.list()
476 localVideosServer3 = data.filter(video => video.isLocal === true).map(video => video.uuid) 476 localVideosServer3 = data.filter(video => video.isLocal === true).map(video => video.uuid)
477 remoteVideosServer3 = data.filter(video => video.isLocal === false).map(video => video.uuid) 477 remoteVideosServer3 = data.filter(video => video.isLocal === false).map(video => video.uuid)
478 } 478 }
@@ -481,16 +481,16 @@ describe('Test multiple servers', function () {
481 it('Should view multiple videos on owned servers', async function () { 481 it('Should view multiple videos on owned servers', async function () {
482 this.timeout(30000) 482 this.timeout(30000)
483 483
484 await servers[2].videosCommand.view({ id: localVideosServer3[0] }) 484 await servers[2].videos.view({ id: localVideosServer3[0] })
485 await wait(1000) 485 await wait(1000)
486 486
487 await servers[2].videosCommand.view({ id: localVideosServer3[0] }) 487 await servers[2].videos.view({ id: localVideosServer3[0] })
488 await servers[2].videosCommand.view({ id: localVideosServer3[1] }) 488 await servers[2].videos.view({ id: localVideosServer3[1] })
489 489
490 await wait(1000) 490 await wait(1000)
491 491
492 await servers[2].videosCommand.view({ id: localVideosServer3[0] }) 492 await servers[2].videos.view({ id: localVideosServer3[0] })
493 await servers[2].videosCommand.view({ id: localVideosServer3[0] }) 493 await servers[2].videos.view({ id: localVideosServer3[0] })
494 494
495 await waitJobs(servers) 495 await waitJobs(servers)
496 496
@@ -500,7 +500,7 @@ describe('Test multiple servers', function () {
500 await waitJobs(servers) 500 await waitJobs(servers)
501 501
502 for (const server of servers) { 502 for (const server of servers) {
503 const { data } = await server.videosCommand.list() 503 const { data } = await server.videos.list()
504 504
505 const video0 = data.find(v => v.uuid === localVideosServer3[0]) 505 const video0 = data.find(v => v.uuid === localVideosServer3[0])
506 const video1 = data.find(v => v.uuid === localVideosServer3[1]) 506 const video1 = data.find(v => v.uuid === localVideosServer3[1])
@@ -514,16 +514,16 @@ describe('Test multiple servers', function () {
514 this.timeout(45000) 514 this.timeout(45000)
515 515
516 const tasks: Promise<any>[] = [] 516 const tasks: Promise<any>[] = []
517 tasks.push(servers[0].videosCommand.view({ id: remoteVideosServer1[0] })) 517 tasks.push(servers[0].videos.view({ id: remoteVideosServer1[0] }))
518 tasks.push(servers[1].videosCommand.view({ id: remoteVideosServer2[0] })) 518 tasks.push(servers[1].videos.view({ id: remoteVideosServer2[0] }))
519 tasks.push(servers[1].videosCommand.view({ id: remoteVideosServer2[0] })) 519 tasks.push(servers[1].videos.view({ id: remoteVideosServer2[0] }))
520 tasks.push(servers[2].videosCommand.view({ id: remoteVideosServer3[0] })) 520 tasks.push(servers[2].videos.view({ id: remoteVideosServer3[0] }))
521 tasks.push(servers[2].videosCommand.view({ id: remoteVideosServer3[1] })) 521 tasks.push(servers[2].videos.view({ id: remoteVideosServer3[1] }))
522 tasks.push(servers[2].videosCommand.view({ id: remoteVideosServer3[1] })) 522 tasks.push(servers[2].videos.view({ id: remoteVideosServer3[1] }))
523 tasks.push(servers[2].videosCommand.view({ id: remoteVideosServer3[1] })) 523 tasks.push(servers[2].videos.view({ id: remoteVideosServer3[1] }))
524 tasks.push(servers[2].videosCommand.view({ id: localVideosServer3[1] })) 524 tasks.push(servers[2].videos.view({ id: localVideosServer3[1] }))
525 tasks.push(servers[2].videosCommand.view({ id: localVideosServer3[1] })) 525 tasks.push(servers[2].videos.view({ id: localVideosServer3[1] }))
526 tasks.push(servers[2].videosCommand.view({ id: localVideosServer3[1] })) 526 tasks.push(servers[2].videos.view({ id: localVideosServer3[1] }))
527 527
528 await Promise.all(tasks) 528 await Promise.all(tasks)
529 529
@@ -537,7 +537,7 @@ describe('Test multiple servers', function () {
537 let baseVideos = null 537 let baseVideos = null
538 538
539 for (const server of servers) { 539 for (const server of servers) {
540 const { data } = await server.videosCommand.list() 540 const { data } = await server.videos.list()
541 541
542 // Initialize base videos for future comparisons 542 // Initialize base videos for future comparisons
543 if (baseVideos === null) { 543 if (baseVideos === null) {
@@ -555,17 +555,17 @@ describe('Test multiple servers', function () {
555 it('Should like and dislikes videos on different services', async function () { 555 it('Should like and dislikes videos on different services', async function () {
556 this.timeout(50000) 556 this.timeout(50000)
557 557
558 await servers[0].videosCommand.rate({ id: remoteVideosServer1[0], rating: 'like' }) 558 await servers[0].videos.rate({ id: remoteVideosServer1[0], rating: 'like' })
559 await wait(500) 559 await wait(500)
560 await servers[0].videosCommand.rate({ id: remoteVideosServer1[0], rating: 'dislike' }) 560 await servers[0].videos.rate({ id: remoteVideosServer1[0], rating: 'dislike' })
561 await wait(500) 561 await wait(500)
562 await servers[0].videosCommand.rate({ id: remoteVideosServer1[0], rating: 'like' }) 562 await servers[0].videos.rate({ id: remoteVideosServer1[0], rating: 'like' })
563 await servers[2].videosCommand.rate({ id: localVideosServer3[1], rating: 'like' }) 563 await servers[2].videos.rate({ id: localVideosServer3[1], rating: 'like' })
564 await wait(500) 564 await wait(500)
565 await servers[2].videosCommand.rate({ id: localVideosServer3[1], rating: 'dislike' }) 565 await servers[2].videos.rate({ id: localVideosServer3[1], rating: 'dislike' })
566 await servers[2].videosCommand.rate({ id: remoteVideosServer3[1], rating: 'dislike' }) 566 await servers[2].videos.rate({ id: remoteVideosServer3[1], rating: 'dislike' })
567 await wait(500) 567 await wait(500)
568 await servers[2].videosCommand.rate({ id: remoteVideosServer3[0], rating: 'like' }) 568 await servers[2].videos.rate({ id: remoteVideosServer3[0], rating: 'like' })
569 569
570 await waitJobs(servers) 570 await waitJobs(servers)
571 await wait(5000) 571 await wait(5000)
@@ -573,7 +573,7 @@ describe('Test multiple servers', function () {
573 573
574 let baseVideos = null 574 let baseVideos = null
575 for (const server of servers) { 575 for (const server of servers) {
576 const { data } = await server.videosCommand.list() 576 const { data } = await server.videos.list()
577 577
578 // Initialize base videos for future comparisons 578 // Initialize base videos for future comparisons
579 if (baseVideos === null) { 579 if (baseVideos === null) {
@@ -608,7 +608,7 @@ describe('Test multiple servers', function () {
608 previewfile: 'preview.jpg' 608 previewfile: 'preview.jpg'
609 } 609 }
610 610
611 await servers[2].videosCommand.update({ id: toRemove[0].id, attributes }) 611 await servers[2].videos.update({ id: toRemove[0].id, attributes })
612 612
613 await waitJobs(servers) 613 await waitJobs(servers)
614 }) 614 })
@@ -617,7 +617,7 @@ describe('Test multiple servers', function () {
617 this.timeout(10000) 617 this.timeout(10000)
618 618
619 for (const server of servers) { 619 for (const server of servers) {
620 const { data } = await server.videosCommand.list() 620 const { data } = await server.videos.list()
621 621
622 const videoUpdated = data.find(video => video.name === 'my super video updated') 622 const videoUpdated = data.find(video => video.name === 'my super video updated')
623 expect(!!videoUpdated).to.be.true 623 expect(!!videoUpdated).to.be.true
@@ -665,8 +665,8 @@ describe('Test multiple servers', function () {
665 it('Should remove the videos 3 and 3-2 by asking server 3', async function () { 665 it('Should remove the videos 3 and 3-2 by asking server 3', async function () {
666 this.timeout(10000) 666 this.timeout(10000)
667 667
668 await servers[2].videosCommand.remove({ id: toRemove[0].id }) 668 await servers[2].videos.remove({ id: toRemove[0].id })
669 await servers[2].videosCommand.remove({ id: toRemove[1].id }) 669 await servers[2].videos.remove({ id: toRemove[1].id })
670 670
671 await waitJobs(servers) 671 await waitJobs(servers)
672 }) 672 })
@@ -680,7 +680,7 @@ describe('Test multiple servers', function () {
680 680
681 it('Should have videos 1 and 3 on each server', async function () { 681 it('Should have videos 1 and 3 on each server', async function () {
682 for (const server of servers) { 682 for (const server of servers) {
683 const { data } = await server.videosCommand.list() 683 const { data } = await server.videos.list()
684 684
685 expect(data).to.be.an('array') 685 expect(data).to.be.an('array')
686 expect(data.length).to.equal(2) 686 expect(data.length).to.equal(2)
@@ -697,7 +697,7 @@ describe('Test multiple servers', function () {
697 it('Should get the same video by UUID on each server', async function () { 697 it('Should get the same video by UUID on each server', async function () {
698 let baseVideo = null 698 let baseVideo = null
699 for (const server of servers) { 699 for (const server of servers) {
700 const video = await server.videosCommand.get({ id: videoUUID }) 700 const video = await server.videos.get({ id: videoUUID })
701 701
702 if (baseVideo === null) { 702 if (baseVideo === null) {
703 baseVideo = video 703 baseVideo = video
@@ -720,7 +720,7 @@ describe('Test multiple servers', function () {
720 720
721 it('Should get the preview from each server', async function () { 721 it('Should get the preview from each server', async function () {
722 for (const server of servers) { 722 for (const server of servers) {
723 const video = await server.videosCommand.get({ id: videoUUID }) 723 const video = await server.videos.get({ id: videoUUID })
724 724
725 await testImage(server.url, 'video_short1-preview.webm', video.previewPath) 725 await testImage(server.url, 'video_short1-preview.webm', video.previewPath)
726 } 726 }
@@ -735,36 +735,36 @@ describe('Test multiple servers', function () {
735 735
736 { 736 {
737 const text = 'my super first comment' 737 const text = 'my super first comment'
738 await servers[0].commentsCommand.createThread({ videoId: videoUUID, text }) 738 await servers[0].comments.createThread({ videoId: videoUUID, text })
739 } 739 }
740 740
741 { 741 {
742 const text = 'my super second comment' 742 const text = 'my super second comment'
743 await servers[2].commentsCommand.createThread({ videoId: videoUUID, text }) 743 await servers[2].comments.createThread({ videoId: videoUUID, text })
744 } 744 }
745 745
746 await waitJobs(servers) 746 await waitJobs(servers)
747 747
748 { 748 {
749 const threadId = await servers[1].commentsCommand.findCommentId({ videoId: videoUUID, text: 'my super first comment' }) 749 const threadId = await servers[1].comments.findCommentId({ videoId: videoUUID, text: 'my super first comment' })
750 750
751 const text = 'my super answer to thread 1' 751 const text = 'my super answer to thread 1'
752 await servers[1].commentsCommand.addReply({ videoId: videoUUID, toCommentId: threadId, text }) 752 await servers[1].comments.addReply({ videoId: videoUUID, toCommentId: threadId, text })
753 } 753 }
754 754
755 await waitJobs(servers) 755 await waitJobs(servers)
756 756
757 { 757 {
758 const threadId = await servers[2].commentsCommand.findCommentId({ videoId: videoUUID, text: 'my super first comment' }) 758 const threadId = await servers[2].comments.findCommentId({ videoId: videoUUID, text: 'my super first comment' })
759 759
760 const body = await servers[2].commentsCommand.getThread({ videoId: videoUUID, threadId }) 760 const body = await servers[2].comments.getThread({ videoId: videoUUID, threadId })
761 const childCommentId = body.children[0].comment.id 761 const childCommentId = body.children[0].comment.id
762 762
763 const text3 = 'my second answer to thread 1' 763 const text3 = 'my second answer to thread 1'
764 await servers[2].commentsCommand.addReply({ videoId: videoUUID, toCommentId: threadId, text: text3 }) 764 await servers[2].comments.addReply({ videoId: videoUUID, toCommentId: threadId, text: text3 })
765 765
766 const text2 = 'my super answer to answer of thread 1' 766 const text2 = 'my super answer to answer of thread 1'
767 await servers[2].commentsCommand.addReply({ videoId: videoUUID, toCommentId: childCommentId, text: text2 }) 767 await servers[2].comments.addReply({ videoId: videoUUID, toCommentId: childCommentId, text: text2 })
768 } 768 }
769 769
770 await waitJobs(servers) 770 await waitJobs(servers)
@@ -772,7 +772,7 @@ describe('Test multiple servers', function () {
772 772
773 it('Should have these threads', async function () { 773 it('Should have these threads', async function () {
774 for (const server of servers) { 774 for (const server of servers) {
775 const body = await server.commentsCommand.listThreads({ videoId: videoUUID }) 775 const body = await server.comments.listThreads({ videoId: videoUUID })
776 776
777 expect(body.total).to.equal(2) 777 expect(body.total).to.equal(2)
778 expect(body.data).to.be.an('array') 778 expect(body.data).to.be.an('array')
@@ -804,10 +804,10 @@ describe('Test multiple servers', function () {
804 804
805 it('Should have these comments', async function () { 805 it('Should have these comments', async function () {
806 for (const server of servers) { 806 for (const server of servers) {
807 const body = await server.commentsCommand.listThreads({ videoId: videoUUID }) 807 const body = await server.comments.listThreads({ videoId: videoUUID })
808 const threadId = body.data.find(c => c.text === 'my super first comment').id 808 const threadId = body.data.find(c => c.text === 'my super first comment').id
809 809
810 const tree = await server.commentsCommand.getThread({ videoId: videoUUID, threadId }) 810 const tree = await server.comments.getThread({ videoId: videoUUID, threadId })
811 811
812 expect(tree.comment.text).equal('my super first comment') 812 expect(tree.comment.text).equal('my super first comment')
813 expect(tree.comment.account.name).equal('root') 813 expect(tree.comment.account.name).equal('root')
@@ -837,17 +837,17 @@ describe('Test multiple servers', function () {
837 it('Should delete a reply', async function () { 837 it('Should delete a reply', async function () {
838 this.timeout(10000) 838 this.timeout(10000)
839 839
840 await servers[2].commentsCommand.delete({ videoId: videoUUID, commentId: childOfFirstChild.comment.id }) 840 await servers[2].comments.delete({ videoId: videoUUID, commentId: childOfFirstChild.comment.id })
841 841
842 await waitJobs(servers) 842 await waitJobs(servers)
843 }) 843 })
844 844
845 it('Should have this comment marked as deleted', async function () { 845 it('Should have this comment marked as deleted', async function () {
846 for (const server of servers) { 846 for (const server of servers) {
847 const { data } = await server.commentsCommand.listThreads({ videoId: videoUUID }) 847 const { data } = await server.comments.listThreads({ videoId: videoUUID })
848 const threadId = data.find(c => c.text === 'my super first comment').id 848 const threadId = data.find(c => c.text === 'my super first comment').id
849 849
850 const tree = await server.commentsCommand.getThread({ videoId: videoUUID, threadId }) 850 const tree = await server.comments.getThread({ videoId: videoUUID, threadId })
851 expect(tree.comment.text).equal('my super first comment') 851 expect(tree.comment.text).equal('my super first comment')
852 852
853 const firstChild = tree.children[0] 853 const firstChild = tree.children[0]
@@ -868,16 +868,16 @@ describe('Test multiple servers', function () {
868 it('Should delete the thread comments', async function () { 868 it('Should delete the thread comments', async function () {
869 this.timeout(10000) 869 this.timeout(10000)
870 870
871 const { data } = await servers[0].commentsCommand.listThreads({ videoId: videoUUID }) 871 const { data } = await servers[0].comments.listThreads({ videoId: videoUUID })
872 const commentId = data.find(c => c.text === 'my super first comment').id 872 const commentId = data.find(c => c.text === 'my super first comment').id
873 await servers[0].commentsCommand.delete({ videoId: videoUUID, commentId }) 873 await servers[0].comments.delete({ videoId: videoUUID, commentId })
874 874
875 await waitJobs(servers) 875 await waitJobs(servers)
876 }) 876 })
877 877
878 it('Should have the threads marked as deleted on other servers too', async function () { 878 it('Should have the threads marked as deleted on other servers too', async function () {
879 for (const server of servers) { 879 for (const server of servers) {
880 const body = await server.commentsCommand.listThreads({ videoId: videoUUID }) 880 const body = await server.comments.listThreads({ videoId: videoUUID })
881 881
882 expect(body.total).to.equal(2) 882 expect(body.total).to.equal(2)
883 expect(body.data).to.be.an('array') 883 expect(body.data).to.be.an('array')
@@ -913,16 +913,16 @@ describe('Test multiple servers', function () {
913 it('Should delete a remote thread by the origin server', async function () { 913 it('Should delete a remote thread by the origin server', async function () {
914 this.timeout(5000) 914 this.timeout(5000)
915 915
916 const { data } = await servers[0].commentsCommand.listThreads({ videoId: videoUUID }) 916 const { data } = await servers[0].comments.listThreads({ videoId: videoUUID })
917 const commentId = data.find(c => c.text === 'my super second comment').id 917 const commentId = data.find(c => c.text === 'my super second comment').id
918 await servers[0].commentsCommand.delete({ videoId: videoUUID, commentId }) 918 await servers[0].comments.delete({ videoId: videoUUID, commentId })
919 919
920 await waitJobs(servers) 920 await waitJobs(servers)
921 }) 921 })
922 922
923 it('Should have the threads marked as deleted on other servers too', async function () { 923 it('Should have the threads marked as deleted on other servers too', async function () {
924 for (const server of servers) { 924 for (const server of servers) {
925 const body = await server.commentsCommand.listThreads({ videoId: videoUUID }) 925 const body = await server.comments.listThreads({ videoId: videoUUID })
926 926
927 expect(body.total).to.equal(2) 927 expect(body.total).to.equal(2)
928 expect(body.data).to.have.lengthOf(2) 928 expect(body.data).to.have.lengthOf(2)
@@ -957,17 +957,17 @@ describe('Test multiple servers', function () {
957 downloadEnabled: false 957 downloadEnabled: false
958 } 958 }
959 959
960 await servers[0].videosCommand.update({ id: videoUUID, attributes }) 960 await servers[0].videos.update({ id: videoUUID, attributes })
961 961
962 await waitJobs(servers) 962 await waitJobs(servers)
963 963
964 for (const server of servers) { 964 for (const server of servers) {
965 const video = await server.videosCommand.get({ id: videoUUID }) 965 const video = await server.videos.get({ id: videoUUID })
966 expect(video.commentsEnabled).to.be.false 966 expect(video.commentsEnabled).to.be.false
967 expect(video.downloadEnabled).to.be.false 967 expect(video.downloadEnabled).to.be.false
968 968
969 const text = 'my super forbidden comment' 969 const text = 'my super forbidden comment'
970 await server.commentsCommand.createThread({ videoId: videoUUID, text, expectedStatus: HttpStatusCode.CONFLICT_409 }) 970 await server.comments.createThread({ videoId: videoUUID, text, expectedStatus: HttpStatusCode.CONFLICT_409 })
971 } 971 }
972 }) 972 })
973 }) 973 })
@@ -992,7 +992,7 @@ describe('Test multiple servers', function () {
992 await waitJobs(servers) 992 await waitJobs(servers)
993 993
994 for (const server of servers) { 994 for (const server of servers) {
995 const { data } = await server.videosCommand.list() 995 const { data } = await server.videos.list()
996 const video = data.find(v => v.name === 'minimum parameters') 996 const video = data.find(v => v.name === 'minimum parameters')
997 997
998 const isLocal = server.url === 'http://localhost:' + servers[1].port 998 const isLocal = server.url === 'http://localhost:' + servers[1].port
diff --git a/server/tests/api/videos/resumable-upload.ts b/server/tests/api/videos/resumable-upload.ts
index b7756a4a8..2f1cf8a55 100644
--- a/server/tests/api/videos/resumable-upload.ts
+++ b/server/tests/api/videos/resumable-upload.ts
@@ -36,14 +36,14 @@ describe('Test resumable upload', function () {
36 36
37 const attributes = { 37 const attributes = {
38 name: 'video', 38 name: 'video',
39 channelId: server.videoChannel.id, 39 channelId: server.store.channel.id,
40 privacy: VideoPrivacy.PUBLIC, 40 privacy: VideoPrivacy.PUBLIC,
41 fixture: defaultFixture 41 fixture: defaultFixture
42 } 42 }
43 43
44 const mimetype = 'video/mp4' 44 const mimetype = 'video/mp4'
45 45
46 const res = await server.videosCommand.prepareResumableUpload({ attributes, size, mimetype }) 46 const res = await server.videos.prepareResumableUpload({ attributes, size, mimetype })
47 47
48 return res.header['location'].split('?')[1] 48 return res.header['location'].split('?')[1]
49 } 49 }
@@ -61,7 +61,7 @@ describe('Test resumable upload', function () {
61 const size = await buildSize(defaultFixture, options.size) 61 const size = await buildSize(defaultFixture, options.size)
62 const absoluteFilePath = buildAbsoluteFixturePath(defaultFixture) 62 const absoluteFilePath = buildAbsoluteFixturePath(defaultFixture)
63 63
64 return server.videosCommand.sendResumableChunks({ 64 return server.videos.sendResumableChunks({
65 pathUploadId, 65 pathUploadId,
66 videoFilePath: absoluteFilePath, 66 videoFilePath: absoluteFilePath,
67 size, 67 size,
@@ -75,7 +75,7 @@ describe('Test resumable upload', function () {
75 const uploadId = uploadIdArg.replace(/^upload_id=/, '') 75 const uploadId = uploadIdArg.replace(/^upload_id=/, '')
76 76
77 const subPath = join('tmp', 'resumable-uploads', uploadId) 77 const subPath = join('tmp', 'resumable-uploads', uploadId)
78 const filePath = server.serversCommand.buildDirectory(subPath) 78 const filePath = server.servers.buildDirectory(subPath)
79 const exists = await pathExists(filePath) 79 const exists = await pathExists(filePath)
80 80
81 if (expectedSize === null) { 81 if (expectedSize === null) {
@@ -90,7 +90,7 @@ describe('Test resumable upload', function () {
90 90
91 async function countResumableUploads () { 91 async function countResumableUploads () {
92 const subPath = join('tmp', 'resumable-uploads') 92 const subPath = join('tmp', 'resumable-uploads')
93 const filePath = server.serversCommand.buildDirectory(subPath) 93 const filePath = server.servers.buildDirectory(subPath)
94 94
95 const files = await readdir(filePath) 95 const files = await readdir(filePath)
96 return files.length 96 return files.length
@@ -103,10 +103,10 @@ describe('Test resumable upload', function () {
103 await setAccessTokensToServers([ server ]) 103 await setAccessTokensToServers([ server ])
104 await setDefaultVideoChannel([ server ]) 104 await setDefaultVideoChannel([ server ])
105 105
106 const body = await server.usersCommand.getMyInfo() 106 const body = await server.users.getMyInfo()
107 rootId = body.id 107 rootId = body.id
108 108
109 await server.usersCommand.update({ userId: rootId, videoQuota: 10_000_000 }) 109 await server.users.update({ userId: rootId, videoQuota: 10_000_000 })
110 }) 110 })
111 111
112 describe('Directory cleaning', function () { 112 describe('Directory cleaning', function () {
@@ -125,13 +125,13 @@ describe('Test resumable upload', function () {
125 }) 125 })
126 126
127 it('Should not delete recent uploads', async function () { 127 it('Should not delete recent uploads', async function () {
128 await server.debugCommand.sendCommand({ body: { command: 'remove-dandling-resumable-uploads' } }) 128 await server.debug.sendCommand({ body: { command: 'remove-dandling-resumable-uploads' } })
129 129
130 expect(await countResumableUploads()).to.equal(2) 130 expect(await countResumableUploads()).to.equal(2)
131 }) 131 })
132 132
133 it('Should delete old uploads', async function () { 133 it('Should delete old uploads', async function () {
134 await server.debugCommand.sendCommand({ body: { command: 'remove-dandling-resumable-uploads' } }) 134 await server.debug.sendCommand({ body: { command: 'remove-dandling-resumable-uploads' } })
135 135
136 expect(await countResumableUploads()).to.equal(0) 136 expect(await countResumableUploads()).to.equal(0)
137 }) 137 })
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index da0b2011e..12c1f7b2f 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -100,35 +100,35 @@ describe('Test a single server', function () {
100 }) 100 })
101 101
102 it('Should list video categories', async function () { 102 it('Should list video categories', async function () {
103 const categories = await server.videosCommand.getCategories() 103 const categories = await server.videos.getCategories()
104 expect(Object.keys(categories)).to.have.length.above(10) 104 expect(Object.keys(categories)).to.have.length.above(10)
105 105
106 expect(categories[11]).to.equal('News & Politics') 106 expect(categories[11]).to.equal('News & Politics')
107 }) 107 })
108 108
109 it('Should list video licences', async function () { 109 it('Should list video licences', async function () {
110 const licences = await server.videosCommand.getLicences() 110 const licences = await server.videos.getLicences()
111 expect(Object.keys(licences)).to.have.length.above(5) 111 expect(Object.keys(licences)).to.have.length.above(5)
112 112
113 expect(licences[3]).to.equal('Attribution - No Derivatives') 113 expect(licences[3]).to.equal('Attribution - No Derivatives')
114 }) 114 })
115 115
116 it('Should list video languages', async function () { 116 it('Should list video languages', async function () {
117 const languages = await server.videosCommand.getLanguages() 117 const languages = await server.videos.getLanguages()
118 expect(Object.keys(languages)).to.have.length.above(5) 118 expect(Object.keys(languages)).to.have.length.above(5)
119 119
120 expect(languages['ru']).to.equal('Russian') 120 expect(languages['ru']).to.equal('Russian')
121 }) 121 })
122 122
123 it('Should list video privacies', async function () { 123 it('Should list video privacies', async function () {
124 const privacies = await server.videosCommand.getPrivacies() 124 const privacies = await server.videos.getPrivacies()
125 expect(Object.keys(privacies)).to.have.length.at.least(3) 125 expect(Object.keys(privacies)).to.have.length.at.least(3)
126 126
127 expect(privacies[3]).to.equal('Private') 127 expect(privacies[3]).to.equal('Private')
128 }) 128 })
129 129
130 it('Should not have videos', async function () { 130 it('Should not have videos', async function () {
131 const { data, total } = await server.videosCommand.list() 131 const { data, total } = await server.videos.list()
132 132
133 expect(total).to.equal(0) 133 expect(total).to.equal(0)
134 expect(data).to.be.an('array') 134 expect(data).to.be.an('array')
@@ -145,7 +145,7 @@ describe('Test a single server', function () {
145 licence: 6, 145 licence: 6,
146 tags: [ 'tag1', 'tag2', 'tag3' ] 146 tags: [ 'tag1', 'tag2', 'tag3' ]
147 } 147 }
148 const video = await server.videosCommand.upload({ attributes, mode }) 148 const video = await server.videos.upload({ attributes, mode })
149 expect(video).to.not.be.undefined 149 expect(video).to.not.be.undefined
150 expect(video.id).to.equal(1) 150 expect(video.id).to.equal(1)
151 expect(video.uuid).to.have.length.above(5) 151 expect(video.uuid).to.have.length.above(5)
@@ -157,7 +157,7 @@ describe('Test a single server', function () {
157 it('Should get and seed the uploaded video', async function () { 157 it('Should get and seed the uploaded video', async function () {
158 this.timeout(5000) 158 this.timeout(5000)
159 159
160 const { data, total } = await server.videosCommand.list() 160 const { data, total } = await server.videos.list()
161 161
162 expect(total).to.equal(1) 162 expect(total).to.equal(1)
163 expect(data).to.be.an('array') 163 expect(data).to.be.an('array')
@@ -170,42 +170,42 @@ describe('Test a single server', function () {
170 it('Should get the video by UUID', async function () { 170 it('Should get the video by UUID', async function () {
171 this.timeout(5000) 171 this.timeout(5000)
172 172
173 const video = await server.videosCommand.get({ id: videoUUID }) 173 const video = await server.videos.get({ id: videoUUID })
174 await completeVideoCheck(server, video, getCheckAttributes()) 174 await completeVideoCheck(server, video, getCheckAttributes())
175 }) 175 })
176 176
177 it('Should have the views updated', async function () { 177 it('Should have the views updated', async function () {
178 this.timeout(20000) 178 this.timeout(20000)
179 179
180 await server.videosCommand.view({ id: videoId }) 180 await server.videos.view({ id: videoId })
181 await server.videosCommand.view({ id: videoId }) 181 await server.videos.view({ id: videoId })
182 await server.videosCommand.view({ id: videoId }) 182 await server.videos.view({ id: videoId })
183 183
184 await wait(1500) 184 await wait(1500)
185 185
186 await server.videosCommand.view({ id: videoId }) 186 await server.videos.view({ id: videoId })
187 await server.videosCommand.view({ id: videoId }) 187 await server.videos.view({ id: videoId })
188 188
189 await wait(1500) 189 await wait(1500)
190 190
191 await server.videosCommand.view({ id: videoId }) 191 await server.videos.view({ id: videoId })
192 await server.videosCommand.view({ id: videoId }) 192 await server.videos.view({ id: videoId })
193 193
194 // Wait the repeatable job 194 // Wait the repeatable job
195 await wait(8000) 195 await wait(8000)
196 196
197 const video = await server.videosCommand.get({ id: videoId }) 197 const video = await server.videos.get({ id: videoId })
198 expect(video.views).to.equal(3) 198 expect(video.views).to.equal(3)
199 }) 199 })
200 200
201 it('Should remove the video', async function () { 201 it('Should remove the video', async function () {
202 await server.videosCommand.remove({ id: videoId }) 202 await server.videos.remove({ id: videoId })
203 203
204 await checkVideoFilesWereRemoved(videoUUID, server) 204 await checkVideoFilesWereRemoved(videoUUID, server)
205 }) 205 })
206 206
207 it('Should not have videos', async function () { 207 it('Should not have videos', async function () {
208 const { total, data } = await server.videosCommand.list() 208 const { total, data } = await server.videos.list()
209 209
210 expect(total).to.equal(0) 210 expect(total).to.equal(0)
211 expect(data).to.be.an('array') 211 expect(data).to.be.an('array')
@@ -232,12 +232,12 @@ describe('Test a single server', function () {
232 fixture: video 232 fixture: video
233 } 233 }
234 234
235 await server.videosCommand.upload({ attributes, mode }) 235 await server.videos.upload({ attributes, mode })
236 } 236 }
237 }) 237 })
238 238
239 it('Should have the correct durations', async function () { 239 it('Should have the correct durations', async function () {
240 const { total, data } = await server.videosCommand.list() 240 const { total, data } = await server.videos.list()
241 241
242 expect(total).to.equal(6) 242 expect(total).to.equal(6)
243 expect(data).to.be.an('array') 243 expect(data).to.be.an('array')
@@ -255,7 +255,7 @@ describe('Test a single server', function () {
255 }) 255 })
256 256
257 it('Should have the correct thumbnails', async function () { 257 it('Should have the correct thumbnails', async function () {
258 const { data } = await server.videosCommand.list() 258 const { data } = await server.videos.list()
259 259
260 // For the next test 260 // For the next test
261 videosListBase = data 261 videosListBase = data
@@ -267,7 +267,7 @@ describe('Test a single server', function () {
267 }) 267 })
268 268
269 it('Should list only the two first videos', async function () { 269 it('Should list only the two first videos', async function () {
270 const { total, data } = await server.videosCommand.list({ start: 0, count: 2, sort: 'name' }) 270 const { total, data } = await server.videos.list({ start: 0, count: 2, sort: 'name' })
271 271
272 expect(total).to.equal(6) 272 expect(total).to.equal(6)
273 expect(data.length).to.equal(2) 273 expect(data.length).to.equal(2)
@@ -276,7 +276,7 @@ describe('Test a single server', function () {
276 }) 276 })
277 277
278 it('Should list only the next three videos', async function () { 278 it('Should list only the next three videos', async function () {
279 const { total, data } = await server.videosCommand.list({ start: 2, count: 3, sort: 'name' }) 279 const { total, data } = await server.videos.list({ start: 2, count: 3, sort: 'name' })
280 280
281 expect(total).to.equal(6) 281 expect(total).to.equal(6)
282 expect(data.length).to.equal(3) 282 expect(data.length).to.equal(3)
@@ -286,7 +286,7 @@ describe('Test a single server', function () {
286 }) 286 })
287 287
288 it('Should list the last video', async function () { 288 it('Should list the last video', async function () {
289 const { total, data } = await server.videosCommand.list({ start: 5, count: 6, sort: 'name' }) 289 const { total, data } = await server.videos.list({ start: 5, count: 6, sort: 'name' })
290 290
291 expect(total).to.equal(6) 291 expect(total).to.equal(6)
292 expect(data.length).to.equal(1) 292 expect(data.length).to.equal(1)
@@ -294,7 +294,7 @@ describe('Test a single server', function () {
294 }) 294 })
295 295
296 it('Should not have the total field', async function () { 296 it('Should not have the total field', async function () {
297 const { total, data } = await server.videosCommand.list({ start: 5, count: 6, sort: 'name', skipCount: true }) 297 const { total, data } = await server.videos.list({ start: 5, count: 6, sort: 'name', skipCount: true })
298 298
299 expect(total).to.not.exist 299 expect(total).to.not.exist
300 expect(data.length).to.equal(1) 300 expect(data.length).to.equal(1)
@@ -302,7 +302,7 @@ describe('Test a single server', function () {
302 }) 302 })
303 303
304 it('Should list and sort by name in descending order', async function () { 304 it('Should list and sort by name in descending order', async function () {
305 const { total, data } = await server.videosCommand.list({ sort: '-name' }) 305 const { total, data } = await server.videos.list({ sort: '-name' })
306 306
307 expect(total).to.equal(6) 307 expect(total).to.equal(6)
308 expect(data.length).to.equal(6) 308 expect(data.length).to.equal(6)
@@ -318,21 +318,21 @@ describe('Test a single server', function () {
318 }) 318 })
319 319
320 it('Should list and sort by trending in descending order', async function () { 320 it('Should list and sort by trending in descending order', async function () {
321 const { total, data } = await server.videosCommand.list({ start: 0, count: 2, sort: '-trending' }) 321 const { total, data } = await server.videos.list({ start: 0, count: 2, sort: '-trending' })
322 322
323 expect(total).to.equal(6) 323 expect(total).to.equal(6)
324 expect(data.length).to.equal(2) 324 expect(data.length).to.equal(2)
325 }) 325 })
326 326
327 it('Should list and sort by hotness in descending order', async function () { 327 it('Should list and sort by hotness in descending order', async function () {
328 const { total, data } = await server.videosCommand.list({ start: 0, count: 2, sort: '-hot' }) 328 const { total, data } = await server.videos.list({ start: 0, count: 2, sort: '-hot' })
329 329
330 expect(total).to.equal(6) 330 expect(total).to.equal(6)
331 expect(data.length).to.equal(2) 331 expect(data.length).to.equal(2)
332 }) 332 })
333 333
334 it('Should list and sort by best in descending order', async function () { 334 it('Should list and sort by best in descending order', async function () {
335 const { total, data } = await server.videosCommand.list({ start: 0, count: 2, sort: '-best' }) 335 const { total, data } = await server.videos.list({ start: 0, count: 2, sort: '-best' })
336 336
337 expect(total).to.equal(6) 337 expect(total).to.equal(6)
338 expect(data.length).to.equal(2) 338 expect(data.length).to.equal(2)
@@ -350,18 +350,18 @@ describe('Test a single server', function () {
350 downloadEnabled: false, 350 downloadEnabled: false,
351 tags: [ 'tagup1', 'tagup2' ] 351 tags: [ 'tagup1', 'tagup2' ]
352 } 352 }
353 await server.videosCommand.update({ id: videoId, attributes }) 353 await server.videos.update({ id: videoId, attributes })
354 }) 354 })
355 355
356 it('Should filter by tags and category', async function () { 356 it('Should filter by tags and category', async function () {
357 { 357 {
358 const { data, total } = await server.videosCommand.list({ tagsAllOf: [ 'tagup1', 'tagup2' ], categoryOneOf: [ 4 ] }) 358 const { data, total } = await server.videos.list({ tagsAllOf: [ 'tagup1', 'tagup2' ], categoryOneOf: [ 4 ] })
359 expect(total).to.equal(1) 359 expect(total).to.equal(1)
360 expect(data[0].name).to.equal('my super video updated') 360 expect(data[0].name).to.equal('my super video updated')
361 } 361 }
362 362
363 { 363 {
364 const { total } = await server.videosCommand.list({ tagsAllOf: [ 'tagup1', 'tagup2' ], categoryOneOf: [ 3 ] }) 364 const { total } = await server.videos.list({ tagsAllOf: [ 'tagup1', 'tagup2' ], categoryOneOf: [ 3 ] })
365 expect(total).to.equal(0) 365 expect(total).to.equal(0)
366 } 366 }
367 }) 367 })
@@ -369,7 +369,7 @@ describe('Test a single server', function () {
369 it('Should have the video updated', async function () { 369 it('Should have the video updated', async function () {
370 this.timeout(60000) 370 this.timeout(60000)
371 371
372 const video = await server.videosCommand.get({ id: videoId }) 372 const video = await server.videos.get({ id: videoId })
373 373
374 await completeVideoCheck(server, video, updateCheckAttributes()) 374 await completeVideoCheck(server, video, updateCheckAttributes())
375 }) 375 })
@@ -378,9 +378,9 @@ describe('Test a single server', function () {
378 const attributes = { 378 const attributes = {
379 tags: [ 'supertag', 'tag1', 'tag2' ] 379 tags: [ 'supertag', 'tag1', 'tag2' ]
380 } 380 }
381 await server.videosCommand.update({ id: videoId, attributes }) 381 await server.videos.update({ id: videoId, attributes })
382 382
383 const video = await server.videosCommand.get({ id: videoId }) 383 const video = await server.videos.get({ id: videoId })
384 384
385 await completeVideoCheck(server, video, Object.assign(updateCheckAttributes(), attributes)) 385 await completeVideoCheck(server, video, Object.assign(updateCheckAttributes(), attributes))
386 }) 386 })
@@ -389,27 +389,27 @@ describe('Test a single server', function () {
389 const attributes = { 389 const attributes = {
390 description: 'hello everybody' 390 description: 'hello everybody'
391 } 391 }
392 await server.videosCommand.update({ id: videoId, attributes }) 392 await server.videos.update({ id: videoId, attributes })
393 393
394 const video = await server.videosCommand.get({ id: videoId }) 394 const video = await server.videos.get({ id: videoId })
395 395
396 const expectedAttributes = Object.assign(updateCheckAttributes(), { tags: [ 'supertag', 'tag1', 'tag2' ] }, attributes) 396 const expectedAttributes = Object.assign(updateCheckAttributes(), { tags: [ 'supertag', 'tag1', 'tag2' ] }, attributes)
397 await completeVideoCheck(server, video, expectedAttributes) 397 await completeVideoCheck(server, video, expectedAttributes)
398 }) 398 })
399 399
400 it('Should like a video', async function () { 400 it('Should like a video', async function () {
401 await server.videosCommand.rate({ id: videoId, rating: 'like' }) 401 await server.videos.rate({ id: videoId, rating: 'like' })
402 402
403 const video = await server.videosCommand.get({ id: videoId }) 403 const video = await server.videos.get({ id: videoId })
404 404
405 expect(video.likes).to.equal(1) 405 expect(video.likes).to.equal(1)
406 expect(video.dislikes).to.equal(0) 406 expect(video.dislikes).to.equal(0)
407 }) 407 })
408 408
409 it('Should dislike the same video', async function () { 409 it('Should dislike the same video', async function () {
410 await server.videosCommand.rate({ id: videoId, rating: 'dislike' }) 410 await server.videos.rate({ id: videoId, rating: 'dislike' })
411 411
412 const video = await server.videosCommand.get({ id: videoId }) 412 const video = await server.videos.get({ id: videoId })
413 413
414 expect(video.likes).to.equal(0) 414 expect(video.likes).to.equal(0)
415 expect(video.dislikes).to.equal(1) 415 expect(video.dislikes).to.equal(1)
@@ -419,9 +419,9 @@ describe('Test a single server', function () {
419 { 419 {
420 const now = new Date() 420 const now = new Date()
421 const attributes = { originallyPublishedAt: now.toISOString() } 421 const attributes = { originallyPublishedAt: now.toISOString() }
422 await server.videosCommand.update({ id: videoId, attributes }) 422 await server.videos.update({ id: videoId, attributes })
423 423
424 const { data } = await server.videosCommand.list({ sort: '-originallyPublishedAt' }) 424 const { data } = await server.videos.list({ sort: '-originallyPublishedAt' })
425 const names = data.map(v => v.name) 425 const names = data.map(v => v.name)
426 426
427 expect(names[0]).to.equal('my super video updated') 427 expect(names[0]).to.equal('my super video updated')
@@ -435,9 +435,9 @@ describe('Test a single server', function () {
435 { 435 {
436 const now = new Date() 436 const now = new Date()
437 const attributes = { originallyPublishedAt: now.toISOString() } 437 const attributes = { originallyPublishedAt: now.toISOString() }
438 await server.videosCommand.update({ id: videoId2, attributes }) 438 await server.videos.update({ id: videoId2, attributes })
439 439
440 const { data } = await server.videosCommand.list({ sort: '-originallyPublishedAt' }) 440 const { data } = await server.videos.list({ sort: '-originallyPublishedAt' })
441 const names = data.map(v => v.name) 441 const names = data.map(v => v.name)
442 442
443 expect(names[0]).to.equal('video_short1.webm name') 443 expect(names[0]).to.equal('video_short1.webm name')
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts
index 4c67e96f7..abc07194d 100644
--- a/server/tests/api/videos/video-captions.ts
+++ b/server/tests/api/videos/video-captions.ts
@@ -32,7 +32,7 @@ describe('Test video captions', function () {
32 32
33 await waitJobs(servers) 33 await waitJobs(servers)
34 34
35 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'my video name' } }) 35 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'my video name' } })
36 videoUUID = uuid 36 videoUUID = uuid
37 37
38 await waitJobs(servers) 38 await waitJobs(servers)
@@ -40,7 +40,7 @@ describe('Test video captions', function () {
40 40
41 it('Should list the captions and return an empty list', async function () { 41 it('Should list the captions and return an empty list', async function () {
42 for (const server of servers) { 42 for (const server of servers) {
43 const body = await server.captionsCommand.listVideoCaptions({ videoId: videoUUID }) 43 const body = await server.captions.listVideoCaptions({ videoId: videoUUID })
44 expect(body.total).to.equal(0) 44 expect(body.total).to.equal(0)
45 expect(body.data).to.have.lengthOf(0) 45 expect(body.data).to.have.lengthOf(0)
46 } 46 }
@@ -49,13 +49,13 @@ describe('Test video captions', function () {
49 it('Should create two new captions', async function () { 49 it('Should create two new captions', async function () {
50 this.timeout(30000) 50 this.timeout(30000)
51 51
52 await servers[0].captionsCommand.createVideoCaption({ 52 await servers[0].captions.createVideoCaption({
53 language: 'ar', 53 language: 'ar',
54 videoId: videoUUID, 54 videoId: videoUUID,
55 fixture: 'subtitle-good1.vtt' 55 fixture: 'subtitle-good1.vtt'
56 }) 56 })
57 57
58 await servers[0].captionsCommand.createVideoCaption({ 58 await servers[0].captions.createVideoCaption({
59 language: 'zh', 59 language: 'zh',
60 videoId: videoUUID, 60 videoId: videoUUID,
61 fixture: 'subtitle-good2.vtt', 61 fixture: 'subtitle-good2.vtt',
@@ -67,7 +67,7 @@ describe('Test video captions', function () {
67 67
68 it('Should list these uploaded captions', async function () { 68 it('Should list these uploaded captions', async function () {
69 for (const server of servers) { 69 for (const server of servers) {
70 const body = await server.captionsCommand.listVideoCaptions({ videoId: videoUUID }) 70 const body = await server.captions.listVideoCaptions({ videoId: videoUUID })
71 expect(body.total).to.equal(2) 71 expect(body.total).to.equal(2)
72 expect(body.data).to.have.lengthOf(2) 72 expect(body.data).to.have.lengthOf(2)
73 73
@@ -88,7 +88,7 @@ describe('Test video captions', function () {
88 it('Should replace an existing caption', async function () { 88 it('Should replace an existing caption', async function () {
89 this.timeout(30000) 89 this.timeout(30000)
90 90
91 await servers[0].captionsCommand.createVideoCaption({ 91 await servers[0].captions.createVideoCaption({
92 language: 'ar', 92 language: 'ar',
93 videoId: videoUUID, 93 videoId: videoUUID,
94 fixture: 'subtitle-good2.vtt' 94 fixture: 'subtitle-good2.vtt'
@@ -99,7 +99,7 @@ describe('Test video captions', function () {
99 99
100 it('Should have this caption updated', async function () { 100 it('Should have this caption updated', async function () {
101 for (const server of servers) { 101 for (const server of servers) {
102 const body = await server.captionsCommand.listVideoCaptions({ videoId: videoUUID }) 102 const body = await server.captions.listVideoCaptions({ videoId: videoUUID })
103 expect(body.total).to.equal(2) 103 expect(body.total).to.equal(2)
104 expect(body.data).to.have.lengthOf(2) 104 expect(body.data).to.have.lengthOf(2)
105 105
@@ -114,7 +114,7 @@ describe('Test video captions', function () {
114 it('Should replace an existing caption with a srt file and convert it', async function () { 114 it('Should replace an existing caption with a srt file and convert it', async function () {
115 this.timeout(30000) 115 this.timeout(30000)
116 116
117 await servers[0].captionsCommand.createVideoCaption({ 117 await servers[0].captions.createVideoCaption({
118 language: 'ar', 118 language: 'ar',
119 videoId: videoUUID, 119 videoId: videoUUID,
120 fixture: 'subtitle-good.srt' 120 fixture: 'subtitle-good.srt'
@@ -128,7 +128,7 @@ describe('Test video captions', function () {
128 128
129 it('Should have this caption updated and converted', async function () { 129 it('Should have this caption updated and converted', async function () {
130 for (const server of servers) { 130 for (const server of servers) {
131 const body = await server.captionsCommand.listVideoCaptions({ videoId: videoUUID }) 131 const body = await server.captions.listVideoCaptions({ videoId: videoUUID })
132 expect(body.total).to.equal(2) 132 expect(body.total).to.equal(2)
133 expect(body.data).to.have.lengthOf(2) 133 expect(body.data).to.have.lengthOf(2)
134 134
@@ -157,14 +157,14 @@ describe('Test video captions', function () {
157 it('Should remove one caption', async function () { 157 it('Should remove one caption', async function () {
158 this.timeout(30000) 158 this.timeout(30000)
159 159
160 await servers[0].captionsCommand.deleteVideoCaption({ videoId: videoUUID, language: 'ar' }) 160 await servers[0].captions.deleteVideoCaption({ videoId: videoUUID, language: 'ar' })
161 161
162 await waitJobs(servers) 162 await waitJobs(servers)
163 }) 163 })
164 164
165 it('Should only list the caption that was not deleted', async function () { 165 it('Should only list the caption that was not deleted', async function () {
166 for (const server of servers) { 166 for (const server of servers) {
167 const body = await server.captionsCommand.listVideoCaptions({ videoId: videoUUID }) 167 const body = await server.captions.listVideoCaptions({ videoId: videoUUID })
168 expect(body.total).to.equal(1) 168 expect(body.total).to.equal(1)
169 expect(body.data).to.have.lengthOf(1) 169 expect(body.data).to.have.lengthOf(1)
170 170
@@ -178,7 +178,7 @@ describe('Test video captions', function () {
178 }) 178 })
179 179
180 it('Should remove the video, and thus all video captions', async function () { 180 it('Should remove the video, and thus all video captions', async function () {
181 await servers[0].videosCommand.remove({ id: videoUUID }) 181 await servers[0].videos.remove({ id: videoUUID })
182 182
183 await checkVideoFilesWereRemoved(videoUUID, servers[0]) 183 await checkVideoFilesWereRemoved(videoUUID, servers[0])
184 }) 184 })
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts
index b85edd920..352eb5ea3 100644
--- a/server/tests/api/videos/video-change-ownership.ts
+++ b/server/tests/api/videos/video-change-ownership.ts
@@ -43,7 +43,7 @@ describe('Test video change ownership - nominal', function () {
43 await setAccessTokensToServers(servers) 43 await setAccessTokensToServers(servers)
44 await setDefaultVideoChannel(servers) 44 await setDefaultVideoChannel(servers)
45 45
46 await servers[0].configCommand.updateCustomSubConfig({ 46 await servers[0].config.updateCustomSubConfig({
47 newConfig: { 47 newConfig: {
48 transcoding: { 48 transcoding: {
49 enabled: false 49 enabled: false
@@ -54,16 +54,16 @@ describe('Test video change ownership - nominal', function () {
54 } 54 }
55 }) 55 })
56 56
57 firstUserToken = await servers[0].usersCommand.generateUserAndToken(firstUser) 57 firstUserToken = await servers[0].users.generateUserAndToken(firstUser)
58 secondUserToken = await servers[0].usersCommand.generateUserAndToken(secondUser) 58 secondUserToken = await servers[0].users.generateUserAndToken(secondUser)
59 59
60 { 60 {
61 const { videoChannels } = await servers[0].usersCommand.getMyInfo({ token: firstUserToken }) 61 const { videoChannels } = await servers[0].users.getMyInfo({ token: firstUserToken })
62 firstUserChannelId = videoChannels[0].id 62 firstUserChannelId = videoChannels[0].id
63 } 63 }
64 64
65 { 65 {
66 const { videoChannels } = await servers[0].usersCommand.getMyInfo({ token: secondUserToken }) 66 const { videoChannels } = await servers[0].users.getMyInfo({ token: secondUserToken })
67 secondUserChannelId = videoChannels[0].id 67 secondUserChannelId = videoChannels[0].id
68 } 68 }
69 69
@@ -72,19 +72,19 @@ describe('Test video change ownership - nominal', function () {
72 name: 'my super name', 72 name: 'my super name',
73 description: 'my super description' 73 description: 'my super description'
74 } 74 }
75 const { id } = await servers[0].videosCommand.upload({ token: firstUserToken, attributes }) 75 const { id } = await servers[0].videos.upload({ token: firstUserToken, attributes })
76 76
77 servers[0].video = await servers[0].videosCommand.get({ id }) 77 servers[0].store.video = await servers[0].videos.get({ id })
78 } 78 }
79 79
80 { 80 {
81 const attributes = { name: 'live', channelId: firstUserChannelId, privacy: VideoPrivacy.PUBLIC } 81 const attributes = { name: 'live', channelId: firstUserChannelId, privacy: VideoPrivacy.PUBLIC }
82 const video = await servers[0].liveCommand.create({ token: firstUserToken, fields: attributes }) 82 const video = await servers[0].live.create({ token: firstUserToken, fields: attributes })
83 83
84 liveId = video.id 84 liveId = video.id
85 } 85 }
86 86
87 command = servers[0].changeOwnershipCommand 87 command = servers[0].changeOwnership
88 88
89 await doubleFollow(servers[0], servers[1]) 89 await doubleFollow(servers[0], servers[1])
90 }) 90 })
@@ -110,7 +110,7 @@ describe('Test video change ownership - nominal', function () {
110 it('Should send a request to change ownership of a video', async function () { 110 it('Should send a request to change ownership of a video', async function () {
111 this.timeout(15000) 111 this.timeout(15000)
112 112
113 await command.create({ token: firstUserToken, videoId: servers[0].video.id, username: secondUser }) 113 await command.create({ token: firstUserToken, videoId: servers[0].store.video.id, username: secondUser })
114 }) 114 })
115 115
116 it('Should only return a request to change ownership for the second user', async function () { 116 it('Should only return a request to change ownership for the second user', async function () {
@@ -136,7 +136,7 @@ describe('Test video change ownership - nominal', function () {
136 it('Should accept the same change ownership request without crashing', async function () { 136 it('Should accept the same change ownership request without crashing', async function () {
137 this.timeout(10000) 137 this.timeout(10000)
138 138
139 await command.create({ token: firstUserToken, videoId: servers[0].video.id, username: secondUser }) 139 await command.create({ token: firstUserToken, videoId: servers[0].store.video.id, username: secondUser })
140 }) 140 })
141 141
142 it('Should not create multiple change ownership requests while one is waiting', async function () { 142 it('Should not create multiple change ownership requests while one is waiting', async function () {
@@ -164,7 +164,7 @@ describe('Test video change ownership - nominal', function () {
164 it('Should send a new request to change ownership of a video', async function () { 164 it('Should send a new request to change ownership of a video', async function () {
165 this.timeout(15000) 165 this.timeout(15000)
166 166
167 await command.create({ token: firstUserToken, videoId: servers[0].video.id, username: secondUser }) 167 await command.create({ token: firstUserToken, videoId: servers[0].store.video.id, username: secondUser })
168 }) 168 })
169 169
170 it('Should return two requests to change ownership for the second user', async function () { 170 it('Should return two requests to change ownership for the second user', async function () {
@@ -208,7 +208,7 @@ describe('Test video change ownership - nominal', function () {
208 208
209 it('Should have the channel of the video updated', async function () { 209 it('Should have the channel of the video updated', async function () {
210 for (const server of servers) { 210 for (const server of servers) {
211 const video = await server.videosCommand.get({ id: servers[0].video.uuid }) 211 const video = await server.videos.get({ id: servers[0].store.video.uuid })
212 212
213 expect(video.name).to.equal('my super name') 213 expect(video.name).to.equal('my super name')
214 expect(video.channel.displayName).to.equal('Main second channel') 214 expect(video.channel.displayName).to.equal('Main second channel')
@@ -237,7 +237,7 @@ describe('Test video change ownership - nominal', function () {
237 await waitJobs(servers) 237 await waitJobs(servers)
238 238
239 for (const server of servers) { 239 for (const server of servers) {
240 const video = await server.videosCommand.get({ id: servers[0].video.uuid }) 240 const video = await server.videos.get({ id: servers[0].store.video.uuid })
241 241
242 expect(video.name).to.equal('my super name') 242 expect(video.name).to.equal('my super name')
243 expect(video.channel.displayName).to.equal('Main second channel') 243 expect(video.channel.displayName).to.equal('Main second channel')
@@ -266,35 +266,35 @@ describe('Test video change ownership - quota too small', function () {
266 server = await flushAndRunServer(1) 266 server = await flushAndRunServer(1)
267 await setAccessTokensToServers([ server ]) 267 await setAccessTokensToServers([ server ])
268 268
269 await server.usersCommand.create({ username: secondUser, videoQuota: 10 }) 269 await server.users.create({ username: secondUser, videoQuota: 10 })
270 270
271 firstUserToken = await server.usersCommand.generateUserAndToken(firstUser) 271 firstUserToken = await server.users.generateUserAndToken(firstUser)
272 secondUserToken = await server.loginCommand.getAccessToken(secondUser) 272 secondUserToken = await server.login.getAccessToken(secondUser)
273 273
274 // Upload some videos on the server 274 // Upload some videos on the server
275 const attributes = { 275 const attributes = {
276 name: 'my super name', 276 name: 'my super name',
277 description: 'my super description' 277 description: 'my super description'
278 } 278 }
279 await server.videosCommand.upload({ token: firstUserToken, attributes }) 279 await server.videos.upload({ token: firstUserToken, attributes })
280 280
281 await waitJobs(server) 281 await waitJobs(server)
282 282
283 const { data } = await server.videosCommand.list() 283 const { data } = await server.videos.list()
284 expect(data.length).to.equal(1) 284 expect(data.length).to.equal(1)
285 285
286 server.video = data.find(video => video.name === 'my super name') 286 server.store.video = data.find(video => video.name === 'my super name')
287 }) 287 })
288 288
289 it('Should send a request to change ownership of a video', async function () { 289 it('Should send a request to change ownership of a video', async function () {
290 this.timeout(15000) 290 this.timeout(15000)
291 291
292 await server.changeOwnershipCommand.create({ token: firstUserToken, videoId: server.video.id, username: secondUser }) 292 await server.changeOwnership.create({ token: firstUserToken, videoId: server.store.video.id, username: secondUser })
293 }) 293 })
294 294
295 it('Should only return a request to change ownership for the second user', async function () { 295 it('Should only return a request to change ownership for the second user', async function () {
296 { 296 {
297 const body = await server.changeOwnershipCommand.list({ token: firstUserToken }) 297 const body = await server.changeOwnership.list({ token: firstUserToken })
298 298
299 expect(body.total).to.equal(0) 299 expect(body.total).to.equal(0)
300 expect(body.data).to.be.an('array') 300 expect(body.data).to.be.an('array')
@@ -302,7 +302,7 @@ describe('Test video change ownership - quota too small', function () {
302 } 302 }
303 303
304 { 304 {
305 const body = await server.changeOwnershipCommand.list({ token: secondUserToken }) 305 const body = await server.changeOwnership.list({ token: secondUserToken })
306 306
307 expect(body.total).to.equal(1) 307 expect(body.total).to.equal(1)
308 expect(body.data).to.be.an('array') 308 expect(body.data).to.be.an('array')
@@ -315,10 +315,10 @@ describe('Test video change ownership - quota too small', function () {
315 it('Should not be possible to accept the change of ownership from second user because of exceeded quota', async function () { 315 it('Should not be possible to accept the change of ownership from second user because of exceeded quota', async function () {
316 this.timeout(10000) 316 this.timeout(10000)
317 317
318 const { videoChannels } = await server.usersCommand.getMyInfo({ token: secondUserToken }) 318 const { videoChannels } = await server.users.getMyInfo({ token: secondUserToken })
319 const channelId = videoChannels[0].id 319 const channelId = videoChannels[0].id
320 320
321 await server.changeOwnershipCommand.accept({ 321 await server.changeOwnership.accept({
322 token: secondUserToken, 322 token: secondUserToken,
323 ownershipId: lastRequestId, 323 ownershipId: lastRequestId,
324 channelId, 324 channelId,
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 170cc942e..1efef932c 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -21,7 +21,7 @@ import { User, VideoChannel } from '@shared/models'
21const expect = chai.expect 21const expect = chai.expect
22 22
23async function findChannel (server: ServerInfo, channelId: number) { 23async function findChannel (server: ServerInfo, channelId: number) {
24 const body = await server.channelsCommand.list({ sort: '-name' }) 24 const body = await server.channels.list({ sort: '-name' })
25 25
26 return body.data.find(c => c.id === channelId) 26 return body.data.find(c => c.id === channelId)
27} 27}
@@ -49,7 +49,7 @@ describe('Test video channels', function () {
49 }) 49 })
50 50
51 it('Should have one video channel (created with root)', async () => { 51 it('Should have one video channel (created with root)', async () => {
52 const body = await servers[0].channelsCommand.list({ start: 0, count: 2 }) 52 const body = await servers[0].channels.list({ start: 0, count: 2 })
53 53
54 expect(body.total).to.equal(1) 54 expect(body.total).to.equal(1)
55 expect(body.data).to.be.an('array') 55 expect(body.data).to.be.an('array')
@@ -66,14 +66,14 @@ describe('Test video channels', function () {
66 description: 'super video channel description', 66 description: 'super video channel description',
67 support: 'super video channel support text' 67 support: 'super video channel support text'
68 } 68 }
69 const created = await servers[0].channelsCommand.create({ attributes: videoChannel }) 69 const created = await servers[0].channels.create({ attributes: videoChannel })
70 secondVideoChannelId = created.id 70 secondVideoChannelId = created.id
71 } 71 }
72 72
73 // The channel is 1 is propagated to servers 2 73 // The channel is 1 is propagated to servers 2
74 { 74 {
75 const attributes = { name: 'my video name', channelId: secondVideoChannelId, support: 'video support field' } 75 const attributes = { name: 'my video name', channelId: secondVideoChannelId, support: 'video support field' }
76 const { uuid } = await servers[0].videosCommand.upload({ attributes }) 76 const { uuid } = await servers[0].videos.upload({ attributes })
77 videoUUID = uuid 77 videoUUID = uuid
78 } 78 }
79 79
@@ -81,7 +81,7 @@ describe('Test video channels', function () {
81 }) 81 })
82 82
83 it('Should have two video channels when getting my information', async () => { 83 it('Should have two video channels when getting my information', async () => {
84 userInfo = await servers[0].usersCommand.getMyInfo() 84 userInfo = await servers[0].users.getMyInfo()
85 85
86 expect(userInfo.videoChannels).to.be.an('array') 86 expect(userInfo.videoChannels).to.be.an('array')
87 expect(userInfo.videoChannels).to.have.lengthOf(2) 87 expect(userInfo.videoChannels).to.have.lengthOf(2)
@@ -99,7 +99,7 @@ describe('Test video channels', function () {
99 }) 99 })
100 100
101 it('Should have two video channels when getting account channels on server 1', async function () { 101 it('Should have two video channels when getting account channels on server 1', async function () {
102 const body = await servers[0].channelsCommand.listByAccount({ accountName }) 102 const body = await servers[0].channels.listByAccount({ accountName })
103 expect(body.total).to.equal(2) 103 expect(body.total).to.equal(2)
104 104
105 const videoChannels = body.data 105 const videoChannels = body.data
@@ -118,7 +118,7 @@ describe('Test video channels', function () {
118 118
119 it('Should paginate and sort account channels', async function () { 119 it('Should paginate and sort account channels', async function () {
120 { 120 {
121 const body = await servers[0].channelsCommand.listByAccount({ 121 const body = await servers[0].channels.listByAccount({
122 accountName, 122 accountName,
123 start: 0, 123 start: 0,
124 count: 1, 124 count: 1,
@@ -133,7 +133,7 @@ describe('Test video channels', function () {
133 } 133 }
134 134
135 { 135 {
136 const body = await servers[0].channelsCommand.listByAccount({ 136 const body = await servers[0].channels.listByAccount({
137 accountName, 137 accountName,
138 start: 0, 138 start: 0,
139 count: 1, 139 count: 1,
@@ -146,7 +146,7 @@ describe('Test video channels', function () {
146 } 146 }
147 147
148 { 148 {
149 const body = await servers[0].channelsCommand.listByAccount({ 149 const body = await servers[0].channels.listByAccount({
150 accountName, 150 accountName,
151 start: 1, 151 start: 1,
152 count: 1, 152 count: 1,
@@ -160,7 +160,7 @@ describe('Test video channels', function () {
160 }) 160 })
161 161
162 it('Should have one video channel when getting account channels on server 2', async function () { 162 it('Should have one video channel when getting account channels on server 2', async function () {
163 const body = await servers[1].channelsCommand.listByAccount({ accountName }) 163 const body = await servers[1].channels.listByAccount({ accountName })
164 164
165 expect(body.total).to.equal(1) 165 expect(body.total).to.equal(1)
166 expect(body.data).to.be.an('array') 166 expect(body.data).to.be.an('array')
@@ -174,7 +174,7 @@ describe('Test video channels', function () {
174 }) 174 })
175 175
176 it('Should list video channels', async function () { 176 it('Should list video channels', async function () {
177 const body = await servers[0].channelsCommand.list({ start: 1, count: 1, sort: '-name' }) 177 const body = await servers[0].channels.list({ start: 1, count: 1, sort: '-name' })
178 178
179 expect(body.total).to.equal(2) 179 expect(body.total).to.equal(2)
180 expect(body.data).to.be.an('array') 180 expect(body.data).to.be.an('array')
@@ -192,14 +192,14 @@ describe('Test video channels', function () {
192 support: 'support updated' 192 support: 'support updated'
193 } 193 }
194 194
195 await servers[0].channelsCommand.update({ channelName: 'second_video_channel', attributes: videoChannelAttributes }) 195 await servers[0].channels.update({ channelName: 'second_video_channel', attributes: videoChannelAttributes })
196 196
197 await waitJobs(servers) 197 await waitJobs(servers)
198 }) 198 })
199 199
200 it('Should have video channel updated', async function () { 200 it('Should have video channel updated', async function () {
201 for (const server of servers) { 201 for (const server of servers) {
202 const body = await server.channelsCommand.list({ start: 0, count: 1, sort: '-name' }) 202 const body = await server.channels.list({ start: 0, count: 1, sort: '-name' })
203 203
204 expect(body.total).to.equal(2) 204 expect(body.total).to.equal(2)
205 expect(body.data).to.be.an('array') 205 expect(body.data).to.be.an('array')
@@ -214,7 +214,7 @@ describe('Test video channels', function () {
214 214
215 it('Should not have updated the video support field', async function () { 215 it('Should not have updated the video support field', async function () {
216 for (const server of servers) { 216 for (const server of servers) {
217 const video = await server.videosCommand.get({ id: videoUUID }) 217 const video = await server.videos.get({ id: videoUUID })
218 expect(video.support).to.equal('video support field') 218 expect(video.support).to.equal('video support field')
219 } 219 }
220 }) 220 })
@@ -227,12 +227,12 @@ describe('Test video channels', function () {
227 bulkVideosSupportUpdate: true 227 bulkVideosSupportUpdate: true
228 } 228 }
229 229
230 await servers[0].channelsCommand.update({ channelName: 'second_video_channel', attributes: videoChannelAttributes }) 230 await servers[0].channels.update({ channelName: 'second_video_channel', attributes: videoChannelAttributes })
231 231
232 await waitJobs(servers) 232 await waitJobs(servers)
233 233
234 for (const server of servers) { 234 for (const server of servers) {
235 const video = await server.videosCommand.get({ id: videoUUID }) 235 const video = await server.videos.get({ id: videoUUID })
236 expect(video.support).to.equal(videoChannelAttributes.support) 236 expect(video.support).to.equal(videoChannelAttributes.support)
237 } 237 }
238 }) 238 })
@@ -242,7 +242,7 @@ describe('Test video channels', function () {
242 242
243 const fixture = 'avatar.png' 243 const fixture = 'avatar.png'
244 244
245 await servers[0].channelsCommand.updateImage({ 245 await servers[0].channels.updateImage({
246 channelName: 'second_video_channel', 246 channelName: 'second_video_channel',
247 fixture, 247 fixture,
248 type: 'avatar' 248 type: 'avatar'
@@ -257,7 +257,7 @@ describe('Test video channels', function () {
257 await testImage(server.url, 'avatar-resized', avatarPaths[server.port], '.png') 257 await testImage(server.url, 'avatar-resized', avatarPaths[server.port], '.png')
258 await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), true) 258 await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), true)
259 259
260 const row = await server.sqlCommand.getActorImage(basename(avatarPaths[server.port])) 260 const row = await server.sql.getActorImage(basename(avatarPaths[server.port]))
261 expect(row.height).to.equal(ACTOR_IMAGES_SIZE.AVATARS.height) 261 expect(row.height).to.equal(ACTOR_IMAGES_SIZE.AVATARS.height)
262 expect(row.width).to.equal(ACTOR_IMAGES_SIZE.AVATARS.width) 262 expect(row.width).to.equal(ACTOR_IMAGES_SIZE.AVATARS.width)
263 } 263 }
@@ -268,7 +268,7 @@ describe('Test video channels', function () {
268 268
269 const fixture = 'banner.jpg' 269 const fixture = 'banner.jpg'
270 270
271 await servers[0].channelsCommand.updateImage({ 271 await servers[0].channels.updateImage({
272 channelName: 'second_video_channel', 272 channelName: 'second_video_channel',
273 fixture, 273 fixture,
274 type: 'banner' 274 type: 'banner'
@@ -277,13 +277,13 @@ describe('Test video channels', function () {
277 await waitJobs(servers) 277 await waitJobs(servers)
278 278
279 for (const server of servers) { 279 for (const server of servers) {
280 const videoChannel = await server.channelsCommand.get({ channelName: 'second_video_channel@' + servers[0].host }) 280 const videoChannel = await server.channels.get({ channelName: 'second_video_channel@' + servers[0].host })
281 281
282 bannerPaths[server.port] = videoChannel.banner.path 282 bannerPaths[server.port] = videoChannel.banner.path
283 await testImage(server.url, 'banner-resized', bannerPaths[server.port]) 283 await testImage(server.url, 'banner-resized', bannerPaths[server.port])
284 await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), true) 284 await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), true)
285 285
286 const row = await server.sqlCommand.getActorImage(basename(bannerPaths[server.port])) 286 const row = await server.sql.getActorImage(basename(bannerPaths[server.port]))
287 expect(row.height).to.equal(ACTOR_IMAGES_SIZE.BANNERS.height) 287 expect(row.height).to.equal(ACTOR_IMAGES_SIZE.BANNERS.height)
288 expect(row.width).to.equal(ACTOR_IMAGES_SIZE.BANNERS.width) 288 expect(row.width).to.equal(ACTOR_IMAGES_SIZE.BANNERS.width)
289 } 289 }
@@ -292,7 +292,7 @@ describe('Test video channels', function () {
292 it('Should delete the video channel avatar', async function () { 292 it('Should delete the video channel avatar', async function () {
293 this.timeout(15000) 293 this.timeout(15000)
294 294
295 await servers[0].channelsCommand.deleteImage({ channelName: 'second_video_channel', type: 'avatar' }) 295 await servers[0].channels.deleteImage({ channelName: 'second_video_channel', type: 'avatar' })
296 296
297 await waitJobs(servers) 297 await waitJobs(servers)
298 298
@@ -307,7 +307,7 @@ describe('Test video channels', function () {
307 it('Should delete the video channel banner', async function () { 307 it('Should delete the video channel banner', async function () {
308 this.timeout(15000) 308 this.timeout(15000)
309 309
310 await servers[0].channelsCommand.deleteImage({ channelName: 'second_video_channel', type: 'banner' }) 310 await servers[0].channels.deleteImage({ channelName: 'second_video_channel', type: 'banner' })
311 311
312 await waitJobs(servers) 312 await waitJobs(servers)
313 313
@@ -324,7 +324,7 @@ describe('Test video channels', function () {
324 324
325 for (const server of servers) { 325 for (const server of servers) {
326 const channelURI = 'second_video_channel@localhost:' + servers[0].port 326 const channelURI = 'second_video_channel@localhost:' + servers[0].port
327 const { total, data } = await server.videosCommand.listByChannel({ videoChannelName: channelURI }) 327 const { total, data } = await server.videos.listByChannel({ videoChannelName: channelURI })
328 328
329 expect(total).to.equal(1) 329 expect(total).to.equal(1)
330 expect(data).to.be.an('array') 330 expect(data).to.be.an('array')
@@ -336,7 +336,7 @@ describe('Test video channels', function () {
336 it('Should change the video channel of a video', async function () { 336 it('Should change the video channel of a video', async function () {
337 this.timeout(10000) 337 this.timeout(10000)
338 338
339 await servers[0].videosCommand.update({ id: videoUUID, attributes: { channelId: servers[0].videoChannel.id } }) 339 await servers[0].videos.update({ id: videoUUID, attributes: { channelId: servers[0].store.channel.id } })
340 340
341 await waitJobs(servers) 341 await waitJobs(servers)
342 }) 342 })
@@ -347,13 +347,13 @@ describe('Test video channels', function () {
347 for (const server of servers) { 347 for (const server of servers) {
348 { 348 {
349 const secondChannelURI = 'second_video_channel@localhost:' + servers[0].port 349 const secondChannelURI = 'second_video_channel@localhost:' + servers[0].port
350 const { total } = await server.videosCommand.listByChannel({ videoChannelName: secondChannelURI }) 350 const { total } = await server.videos.listByChannel({ videoChannelName: secondChannelURI })
351 expect(total).to.equal(0) 351 expect(total).to.equal(0)
352 } 352 }
353 353
354 { 354 {
355 const channelURI = 'root_channel@localhost:' + servers[0].port 355 const channelURI = 'root_channel@localhost:' + servers[0].port
356 const { total, data } = await server.videosCommand.listByChannel({ videoChannelName: channelURI }) 356 const { total, data } = await server.videos.listByChannel({ videoChannelName: channelURI })
357 expect(total).to.equal(1) 357 expect(total).to.equal(1)
358 358
359 expect(data).to.be.an('array') 359 expect(data).to.be.an('array')
@@ -364,11 +364,11 @@ describe('Test video channels', function () {
364 }) 364 })
365 365
366 it('Should delete video channel', async function () { 366 it('Should delete video channel', async function () {
367 await servers[0].channelsCommand.delete({ channelName: 'second_video_channel' }) 367 await servers[0].channels.delete({ channelName: 'second_video_channel' })
368 }) 368 })
369 369
370 it('Should have video channel deleted', async function () { 370 it('Should have video channel deleted', async function () {
371 const body = await servers[0].channelsCommand.list({ start: 0, count: 10 }) 371 const body = await servers[0].channels.list({ start: 0, count: 10 })
372 372
373 expect(body.total).to.equal(1) 373 expect(body.total).to.equal(1)
374 expect(body.data).to.be.an('array') 374 expect(body.data).to.be.an('array')
@@ -379,15 +379,15 @@ describe('Test video channels', function () {
379 it('Should create the main channel with an uuid if there is a conflict', async function () { 379 it('Should create the main channel with an uuid if there is a conflict', async function () {
380 { 380 {
381 const videoChannel = { name: 'toto_channel', displayName: 'My toto channel' } 381 const videoChannel = { name: 'toto_channel', displayName: 'My toto channel' }
382 const created = await servers[0].channelsCommand.create({ attributes: videoChannel }) 382 const created = await servers[0].channels.create({ attributes: videoChannel })
383 totoChannel = created.id 383 totoChannel = created.id
384 } 384 }
385 385
386 { 386 {
387 await servers[0].usersCommand.create({ username: 'toto', password: 'password' }) 387 await servers[0].users.create({ username: 'toto', password: 'password' })
388 const accessToken = await servers[0].loginCommand.getAccessToken({ username: 'toto', password: 'password' }) 388 const accessToken = await servers[0].login.getAccessToken({ username: 'toto', password: 'password' })
389 389
390 const { videoChannels } = await servers[0].usersCommand.getMyInfo({ token: accessToken }) 390 const { videoChannels } = await servers[0].users.getMyInfo({ token: accessToken })
391 const videoChannel = videoChannels[0] 391 const videoChannel = videoChannels[0]
392 expect(videoChannel.name).to.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/) 392 expect(videoChannel.name).to.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/)
393 } 393 }
@@ -397,7 +397,7 @@ describe('Test video channels', function () {
397 this.timeout(10000) 397 this.timeout(10000)
398 398
399 { 399 {
400 const { data } = await servers[0].channelsCommand.listByAccount({ accountName, withStats: true }) 400 const { data } = await servers[0].channels.listByAccount({ accountName, withStats: true })
401 401
402 for (const channel of data) { 402 for (const channel of data) {
403 expect(channel).to.haveOwnProperty('viewsPerDay') 403 expect(channel).to.haveOwnProperty('viewsPerDay')
@@ -411,21 +411,21 @@ describe('Test video channels', function () {
411 } 411 }
412 412
413 { 413 {
414 // video has been posted on channel servers[0].videoChannel.id since last update 414 // video has been posted on channel servers[0].store.videoChannel.id since last update
415 await servers[0].videosCommand.view({ id: videoUUID, xForwardedFor: '0.0.0.1,127.0.0.1' }) 415 await servers[0].videos.view({ id: videoUUID, xForwardedFor: '0.0.0.1,127.0.0.1' })
416 await servers[0].videosCommand.view({ id: videoUUID, xForwardedFor: '0.0.0.2,127.0.0.1' }) 416 await servers[0].videos.view({ id: videoUUID, xForwardedFor: '0.0.0.2,127.0.0.1' })
417 417
418 // Wait the repeatable job 418 // Wait the repeatable job
419 await wait(8000) 419 await wait(8000)
420 420
421 const { data } = await servers[0].channelsCommand.listByAccount({ accountName, withStats: true }) 421 const { data } = await servers[0].channels.listByAccount({ accountName, withStats: true })
422 const channelWithView = data.find(channel => channel.id === servers[0].videoChannel.id) 422 const channelWithView = data.find(channel => channel.id === servers[0].store.channel.id)
423 expect(channelWithView.viewsPerDay.slice(-1)[0].views).to.equal(2) 423 expect(channelWithView.viewsPerDay.slice(-1)[0].views).to.equal(2)
424 } 424 }
425 }) 425 })
426 426
427 it('Should report correct videos count', async function () { 427 it('Should report correct videos count', async function () {
428 const { data } = await servers[0].channelsCommand.listByAccount({ accountName, withStats: true }) 428 const { data } = await servers[0].channels.listByAccount({ accountName, withStats: true })
429 429
430 const totoChannel = data.find(c => c.name === 'toto_channel') 430 const totoChannel = data.find(c => c.name === 'toto_channel')
431 const rootChannel = data.find(c => c.name === 'root_channel') 431 const rootChannel = data.find(c => c.name === 'root_channel')
@@ -436,7 +436,7 @@ describe('Test video channels', function () {
436 436
437 it('Should search among account video channels', async function () { 437 it('Should search among account video channels', async function () {
438 { 438 {
439 const body = await servers[0].channelsCommand.listByAccount({ accountName, search: 'root' }) 439 const body = await servers[0].channels.listByAccount({ accountName, search: 'root' })
440 expect(body.total).to.equal(1) 440 expect(body.total).to.equal(1)
441 441
442 const channels = body.data 442 const channels = body.data
@@ -444,7 +444,7 @@ describe('Test video channels', function () {
444 } 444 }
445 445
446 { 446 {
447 const body = await servers[0].channelsCommand.listByAccount({ accountName, search: 'does not exist' }) 447 const body = await servers[0].channels.listByAccount({ accountName, search: 'does not exist' })
448 expect(body.total).to.equal(0) 448 expect(body.total).to.equal(0)
449 449
450 const channels = body.data 450 const channels = body.data
@@ -455,21 +455,21 @@ describe('Test video channels', function () {
455 it('Should list channels by updatedAt desc if a video has been uploaded', async function () { 455 it('Should list channels by updatedAt desc if a video has been uploaded', async function () {
456 this.timeout(30000) 456 this.timeout(30000)
457 457
458 await servers[0].videosCommand.upload({ attributes: { channelId: totoChannel } }) 458 await servers[0].videos.upload({ attributes: { channelId: totoChannel } })
459 await waitJobs(servers) 459 await waitJobs(servers)
460 460
461 for (const server of servers) { 461 for (const server of servers) {
462 const { data } = await server.channelsCommand.listByAccount({ accountName, sort: '-updatedAt' }) 462 const { data } = await server.channels.listByAccount({ accountName, sort: '-updatedAt' })
463 463
464 expect(data[0].name).to.equal('toto_channel') 464 expect(data[0].name).to.equal('toto_channel')
465 expect(data[1].name).to.equal('root_channel') 465 expect(data[1].name).to.equal('root_channel')
466 } 466 }
467 467
468 await servers[0].videosCommand.upload({ attributes: { channelId: servers[0].videoChannel.id } }) 468 await servers[0].videos.upload({ attributes: { channelId: servers[0].store.channel.id } })
469 await waitJobs(servers) 469 await waitJobs(servers)
470 470
471 for (const server of servers) { 471 for (const server of servers) {
472 const { data } = await server.channelsCommand.listByAccount({ accountName, sort: '-updatedAt' }) 472 const { data } = await server.channels.listByAccount({ accountName, sort: '-updatedAt' })
473 473
474 expect(data[0].name).to.equal('root_channel') 474 expect(data[0].name).to.equal('root_channel')
475 expect(data[1].name).to.equal('toto_channel') 475 expect(data[1].name).to.equal('toto_channel')
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts
index 41be54c81..adb59bd74 100644
--- a/server/tests/api/videos/video-comments.ts
+++ b/server/tests/api/videos/video-comments.ts
@@ -32,15 +32,15 @@ describe('Test video comments', function () {
32 32
33 await setAccessTokensToServers([ server ]) 33 await setAccessTokensToServers([ server ])
34 34
35 const { id, uuid } = await server.videosCommand.upload() 35 const { id, uuid } = await server.videos.upload()
36 videoUUID = uuid 36 videoUUID = uuid
37 videoId = id 37 videoId = id
38 38
39 await server.usersCommand.updateMyAvatar({ fixture: 'avatar.png' }) 39 await server.users.updateMyAvatar({ fixture: 'avatar.png' })
40 40
41 userAccessTokenServer1 = await server.usersCommand.generateUserAndToken('user1') 41 userAccessTokenServer1 = await server.users.generateUserAndToken('user1')
42 42
43 command = server.commentsCommand 43 command = server.comments
44 }) 44 })
45 45
46 describe('User comments', function () { 46 describe('User comments', function () {
diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.ts
index 6ac9206f5..b89247288 100644
--- a/server/tests/api/videos/video-description.ts
+++ b/server/tests/api/videos/video-description.ts
@@ -31,11 +31,11 @@ describe('Test video description', function () {
31 const attributes = { 31 const attributes = {
32 description: longDescription 32 description: longDescription
33 } 33 }
34 await servers[0].videosCommand.upload({ attributes }) 34 await servers[0].videos.upload({ attributes })
35 35
36 await waitJobs(servers) 36 await waitJobs(servers)
37 37
38 const { data } = await servers[0].videosCommand.list() 38 const { data } = await servers[0].videos.list()
39 39
40 videoId = data[0].id 40 videoId = data[0].id
41 videoUUID = data[0].uuid 41 videoUUID = data[0].uuid
@@ -43,7 +43,7 @@ describe('Test video description', function () {
43 43
44 it('Should have a truncated description on each server', async function () { 44 it('Should have a truncated description on each server', async function () {
45 for (const server of servers) { 45 for (const server of servers) {
46 const video = await server.videosCommand.get({ id: videoUUID }) 46 const video = await server.videos.get({ id: videoUUID })
47 47
48 // 30 characters * 6 -> 240 characters 48 // 30 characters * 6 -> 240 characters
49 const truncatedDescription = 'my super description for server 1'.repeat(7) + 49 const truncatedDescription = 'my super description for server 1'.repeat(7) +
@@ -55,9 +55,9 @@ describe('Test video description', function () {
55 55
56 it('Should fetch long description on each server', async function () { 56 it('Should fetch long description on each server', async function () {
57 for (const server of servers) { 57 for (const server of servers) {
58 const video = await server.videosCommand.get({ id: videoUUID }) 58 const video = await server.videos.get({ id: videoUUID })
59 59
60 const { description } = await server.videosCommand.getDescription({ descriptionPath: video.descriptionPath }) 60 const { description } = await server.videos.getDescription({ descriptionPath: video.descriptionPath })
61 expect(description).to.equal(longDescription) 61 expect(description).to.equal(longDescription)
62 } 62 }
63 }) 63 })
@@ -68,18 +68,18 @@ describe('Test video description', function () {
68 const attributes = { 68 const attributes = {
69 description: 'short description' 69 description: 'short description'
70 } 70 }
71 await servers[0].videosCommand.update({ id: videoId, attributes }) 71 await servers[0].videos.update({ id: videoId, attributes })
72 72
73 await waitJobs(servers) 73 await waitJobs(servers)
74 }) 74 })
75 75
76 it('Should have a small description on each server', async function () { 76 it('Should have a small description on each server', async function () {
77 for (const server of servers) { 77 for (const server of servers) {
78 const video = await server.videosCommand.get({ id: videoUUID }) 78 const video = await server.videos.get({ id: videoUUID })
79 79
80 expect(video.description).to.equal('short description') 80 expect(video.description).to.equal('short description')
81 81
82 const { description } = await server.videosCommand.getDescription({ descriptionPath: video.descriptionPath }) 82 const { description } = await server.videos.getDescription({ descriptionPath: video.descriptionPath })
83 expect(description).to.equal('short description') 83 expect(description).to.equal('short description')
84 } 84 }
85 }) 85 })
diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts
index d63b81694..9d79f2683 100644
--- a/server/tests/api/videos/video-hls.ts
+++ b/server/tests/api/videos/video-hls.ts
@@ -25,7 +25,7 @@ const expect = chai.expect
25 25
26async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOnly: boolean, resolutions = [ 240, 360, 480, 720 ]) { 26async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOnly: boolean, resolutions = [ 240, 360, 480, 720 ]) {
27 for (const server of servers) { 27 for (const server of servers) {
28 const videoDetails = await server.videosCommand.get({ id: videoUUID }) 28 const videoDetails = await server.videos.get({ id: videoUUID })
29 const baseUrl = `http://${videoDetails.account.host}` 29 const baseUrl = `http://${videoDetails.account.host}`
30 30
31 expect(videoDetails.streamingPlaylists).to.have.lengthOf(1) 31 expect(videoDetails.streamingPlaylists).to.have.lengthOf(1)
@@ -62,7 +62,7 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOn
62 { 62 {
63 await checkResolutionsInMasterPlaylist({ server, playlistUrl: hlsPlaylist.playlistUrl, resolutions }) 63 await checkResolutionsInMasterPlaylist({ server, playlistUrl: hlsPlaylist.playlistUrl, resolutions })
64 64
65 const masterPlaylist = await server.streamingPlaylistsCommand.get({ url: hlsPlaylist.playlistUrl }) 65 const masterPlaylist = await server.streamingPlaylists.get({ url: hlsPlaylist.playlistUrl })
66 66
67 for (const resolution of resolutions) { 67 for (const resolution of resolutions) {
68 expect(masterPlaylist).to.contain(`${resolution}.m3u8`) 68 expect(masterPlaylist).to.contain(`${resolution}.m3u8`)
@@ -72,7 +72,7 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOn
72 72
73 { 73 {
74 for (const resolution of resolutions) { 74 for (const resolution of resolutions) {
75 const subPlaylist = await server.streamingPlaylistsCommand.get({ 75 const subPlaylist = await server.streamingPlaylists.get({
76 url: `${baseUrl}/static/streaming-playlists/hls/${videoUUID}/${resolution}.m3u8` 76 url: `${baseUrl}/static/streaming-playlists/hls/${videoUUID}/${resolution}.m3u8`
77 }) 77 })
78 78
@@ -107,7 +107,7 @@ describe('Test HLS videos', function () {
107 it('Should upload a video and transcode it to HLS', async function () { 107 it('Should upload a video and transcode it to HLS', async function () {
108 this.timeout(120000) 108 this.timeout(120000)
109 109
110 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video 1', fixture: 'video_short.webm' } }) 110 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video 1', fixture: 'video_short.webm' } })
111 videoUUID = uuid 111 videoUUID = uuid
112 112
113 await waitJobs(servers) 113 await waitJobs(servers)
@@ -118,7 +118,7 @@ describe('Test HLS videos', function () {
118 it('Should upload an audio file and transcode it to HLS', async function () { 118 it('Should upload an audio file and transcode it to HLS', async function () {
119 this.timeout(120000) 119 this.timeout(120000)
120 120
121 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video audio', fixture: 'sample.ogg' } }) 121 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video audio', fixture: 'sample.ogg' } })
122 videoAudioUUID = uuid 122 videoAudioUUID = uuid
123 123
124 await waitJobs(servers) 124 await waitJobs(servers)
@@ -129,7 +129,7 @@ describe('Test HLS videos', function () {
129 it('Should update the video', async function () { 129 it('Should update the video', async function () {
130 this.timeout(10000) 130 this.timeout(10000)
131 131
132 await servers[0].videosCommand.update({ id: videoUUID, attributes: { name: 'video 1 updated' } }) 132 await servers[0].videos.update({ id: videoUUID, attributes: { name: 'video 1 updated' } })
133 133
134 await waitJobs(servers) 134 await waitJobs(servers)
135 135
@@ -139,14 +139,14 @@ describe('Test HLS videos', function () {
139 it('Should delete videos', async function () { 139 it('Should delete videos', async function () {
140 this.timeout(10000) 140 this.timeout(10000)
141 141
142 await servers[0].videosCommand.remove({ id: videoUUID }) 142 await servers[0].videos.remove({ id: videoUUID })
143 await servers[0].videosCommand.remove({ id: videoAudioUUID }) 143 await servers[0].videos.remove({ id: videoAudioUUID })
144 144
145 await waitJobs(servers) 145 await waitJobs(servers)
146 146
147 for (const server of servers) { 147 for (const server of servers) {
148 await server.videosCommand.get({ id: videoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 148 await server.videos.get({ id: videoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
149 await server.videosCommand.get({ id: videoAudioUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 149 await server.videos.get({ id: videoAudioUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
150 } 150 }
151 }) 151 })
152 152
@@ -192,7 +192,7 @@ describe('Test HLS videos', function () {
192 describe('With only HLS enabled', function () { 192 describe('With only HLS enabled', function () {
193 193
194 before(async function () { 194 before(async function () {
195 await servers[0].configCommand.updateCustomSubConfig({ 195 await servers[0].config.updateCustomSubConfig({
196 newConfig: { 196 newConfig: {
197 transcoding: { 197 transcoding: {
198 enabled: true, 198 enabled: true,
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts
index 31fdfe12e..8b6542aa4 100644
--- a/server/tests/api/videos/video-imports.ts
+++ b/server/tests/api/videos/video-imports.ts
@@ -26,7 +26,7 @@ describe('Test video imports', function () {
26 if (areHttpImportTestsDisabled()) return 26 if (areHttpImportTestsDisabled()) return
27 27
28 async function checkVideosServer1 (server: ServerInfo, idHttp: string, idMagnet: string, idTorrent: string) { 28 async function checkVideosServer1 (server: ServerInfo, idHttp: string, idMagnet: string, idTorrent: string) {
29 const videoHttp = await server.videosCommand.get({ id: idHttp }) 29 const videoHttp = await server.videos.get({ id: idHttp })
30 30
31 expect(videoHttp.name).to.equal('small video - youtube') 31 expect(videoHttp.name).to.equal('small video - youtube')
32 // FIXME: youtube-dl seems broken 32 // FIXME: youtube-dl seems broken
@@ -43,8 +43,8 @@ describe('Test video imports', function () {
43 expect(originallyPublishedAt.getMonth()).to.equal(0) 43 expect(originallyPublishedAt.getMonth()).to.equal(0)
44 expect(originallyPublishedAt.getFullYear()).to.equal(2019) 44 expect(originallyPublishedAt.getFullYear()).to.equal(2019)
45 45
46 const videoMagnet = await server.videosCommand.get({ id: idMagnet }) 46 const videoMagnet = await server.videos.get({ id: idMagnet })
47 const videoTorrent = await server.videosCommand.get({ id: idTorrent }) 47 const videoTorrent = await server.videos.get({ id: idTorrent })
48 48
49 for (const video of [ videoMagnet, videoTorrent ]) { 49 for (const video of [ videoMagnet, videoTorrent ]) {
50 expect(video.category.label).to.equal('Misc') 50 expect(video.category.label).to.equal('Misc')
@@ -59,12 +59,12 @@ describe('Test video imports', function () {
59 expect(videoTorrent.name).to.contain('你好 世界 720p.mp4') 59 expect(videoTorrent.name).to.contain('你好 世界 720p.mp4')
60 expect(videoMagnet.name).to.contain('super peertube2 video') 60 expect(videoMagnet.name).to.contain('super peertube2 video')
61 61
62 const bodyCaptions = await server.captionsCommand.listVideoCaptions({ videoId: idHttp }) 62 const bodyCaptions = await server.captions.listVideoCaptions({ videoId: idHttp })
63 expect(bodyCaptions.total).to.equal(2) 63 expect(bodyCaptions.total).to.equal(2)
64 } 64 }
65 65
66 async function checkVideoServer2 (server: ServerInfo, id: number | string) { 66 async function checkVideoServer2 (server: ServerInfo, id: number | string) {
67 const video = await server.videosCommand.get({ id }) 67 const video = await server.videos.get({ id })
68 68
69 expect(video.name).to.equal('my super name') 69 expect(video.name).to.equal('my super name')
70 expect(video.category.label).to.equal('Entertainment') 70 expect(video.category.label).to.equal('Entertainment')
@@ -76,7 +76,7 @@ describe('Test video imports', function () {
76 76
77 expect(video.files).to.have.lengthOf(1) 77 expect(video.files).to.have.lengthOf(1)
78 78
79 const bodyCaptions = await server.captionsCommand.listVideoCaptions({ videoId: id }) 79 const bodyCaptions = await server.captions.listVideoCaptions({ videoId: id })
80 expect(bodyCaptions.total).to.equal(2) 80 expect(bodyCaptions.total).to.equal(2)
81 } 81 }
82 82
@@ -89,12 +89,12 @@ describe('Test video imports', function () {
89 await setAccessTokensToServers(servers) 89 await setAccessTokensToServers(servers)
90 90
91 { 91 {
92 const { videoChannels } = await servers[0].usersCommand.getMyInfo() 92 const { videoChannels } = await servers[0].users.getMyInfo()
93 channelIdServer1 = videoChannels[0].id 93 channelIdServer1 = videoChannels[0].id
94 } 94 }
95 95
96 { 96 {
97 const { videoChannels } = await servers[1].usersCommand.getMyInfo() 97 const { videoChannels } = await servers[1].users.getMyInfo()
98 channelIdServer2 = videoChannels[0].id 98 channelIdServer2 = videoChannels[0].id
99 } 99 }
100 100
@@ -111,7 +111,7 @@ describe('Test video imports', function () {
111 111
112 { 112 {
113 const attributes = { ...baseAttributes, targetUrl: ImportsCommand.getYoutubeVideoUrl() } 113 const attributes = { ...baseAttributes, targetUrl: ImportsCommand.getYoutubeVideoUrl() }
114 const { video } = await servers[0].importsCommand.importVideo({ attributes }) 114 const { video } = await servers[0].imports.importVideo({ attributes })
115 expect(video.name).to.equal('small video - youtube') 115 expect(video.name).to.equal('small video - youtube')
116 116
117 expect(video.thumbnailPath).to.match(new RegExp(`^/static/thumbnails/.+.jpg$`)) 117 expect(video.thumbnailPath).to.match(new RegExp(`^/static/thumbnails/.+.jpg$`))
@@ -120,7 +120,7 @@ describe('Test video imports', function () {
120 await testImage(servers[0].url, 'video_import_thumbnail', video.thumbnailPath) 120 await testImage(servers[0].url, 'video_import_thumbnail', video.thumbnailPath)
121 await testImage(servers[0].url, 'video_import_preview', video.previewPath) 121 await testImage(servers[0].url, 'video_import_preview', video.previewPath)
122 122
123 const bodyCaptions = await servers[0].captionsCommand.listVideoCaptions({ videoId: video.id }) 123 const bodyCaptions = await servers[0].captions.listVideoCaptions({ videoId: video.id })
124 const videoCaptions = bodyCaptions.data 124 const videoCaptions = bodyCaptions.data
125 expect(videoCaptions).to.have.lengthOf(2) 125 expect(videoCaptions).to.have.lengthOf(2)
126 126
@@ -166,7 +166,7 @@ Ajouter un sous-titre est vraiment facile`)
166 description: 'this is a super torrent description', 166 description: 'this is a super torrent description',
167 tags: [ 'tag_torrent1', 'tag_torrent2' ] 167 tags: [ 'tag_torrent1', 'tag_torrent2' ]
168 } 168 }
169 const { video } = await servers[0].importsCommand.importVideo({ attributes }) 169 const { video } = await servers[0].imports.importVideo({ attributes })
170 expect(video.name).to.equal('super peertube2 video') 170 expect(video.name).to.equal('super peertube2 video')
171 } 171 }
172 172
@@ -177,13 +177,13 @@ Ajouter un sous-titre est vraiment facile`)
177 description: 'this is a super torrent description', 177 description: 'this is a super torrent description',
178 tags: [ 'tag_torrent1', 'tag_torrent2' ] 178 tags: [ 'tag_torrent1', 'tag_torrent2' ]
179 } 179 }
180 const { video } = await servers[0].importsCommand.importVideo({ attributes }) 180 const { video } = await servers[0].imports.importVideo({ attributes })
181 expect(video.name).to.equal('你好 世界 720p.mp4') 181 expect(video.name).to.equal('你好 世界 720p.mp4')
182 } 182 }
183 }) 183 })
184 184
185 it('Should list the videos to import in my videos on server 1', async function () { 185 it('Should list the videos to import in my videos on server 1', async function () {
186 const { total, data } = await servers[0].videosCommand.listMyVideos({ sort: 'createdAt' }) 186 const { total, data } = await servers[0].videos.listMyVideos({ sort: 'createdAt' })
187 187
188 expect(total).to.equal(3) 188 expect(total).to.equal(3)
189 189
@@ -194,7 +194,7 @@ Ajouter un sous-titre est vraiment facile`)
194 }) 194 })
195 195
196 it('Should list the videos to import in my imports on server 1', async function () { 196 it('Should list the videos to import in my imports on server 1', async function () {
197 const { total, data: videoImports } = await servers[0].importsCommand.getMyVideoImports({ sort: '-createdAt' }) 197 const { total, data: videoImports } = await servers[0].imports.getMyVideoImports({ sort: '-createdAt' })
198 expect(total).to.equal(3) 198 expect(total).to.equal(3)
199 199
200 expect(videoImports).to.have.lengthOf(3) 200 expect(videoImports).to.have.lengthOf(3)
@@ -221,7 +221,7 @@ Ajouter un sous-titre est vraiment facile`)
221 await waitJobs(servers) 221 await waitJobs(servers)
222 222
223 for (const server of servers) { 223 for (const server of servers) {
224 const { total, data } = await server.videosCommand.list() 224 const { total, data } = await server.videos.list()
225 expect(total).to.equal(3) 225 expect(total).to.equal(3)
226 expect(data).to.have.lengthOf(3) 226 expect(data).to.have.lengthOf(3)
227 227
@@ -244,7 +244,7 @@ Ajouter un sous-titre est vraiment facile`)
244 description: 'my super description', 244 description: 'my super description',
245 tags: [ 'supertag1', 'supertag2' ] 245 tags: [ 'supertag1', 'supertag2' ]
246 } 246 }
247 const { video } = await servers[1].importsCommand.importVideo({ attributes }) 247 const { video } = await servers[1].imports.importVideo({ attributes })
248 expect(video.name).to.equal('my super name') 248 expect(video.name).to.equal('my super name')
249 }) 249 })
250 250
@@ -254,7 +254,7 @@ Ajouter un sous-titre est vraiment facile`)
254 await waitJobs(servers) 254 await waitJobs(servers)
255 255
256 for (const server of servers) { 256 for (const server of servers) {
257 const { total, data } = await server.videosCommand.list() 257 const { total, data } = await server.videos.list()
258 expect(total).to.equal(4) 258 expect(total).to.equal(4)
259 expect(data).to.have.lengthOf(4) 259 expect(data).to.have.lengthOf(4)
260 260
@@ -274,13 +274,13 @@ Ajouter un sous-titre est vraiment facile`)
274 channelId: channelIdServer2, 274 channelId: channelIdServer2,
275 privacy: VideoPrivacy.PUBLIC 275 privacy: VideoPrivacy.PUBLIC
276 } 276 }
277 const { video } = await servers[1].importsCommand.importVideo({ attributes }) 277 const { video } = await servers[1].imports.importVideo({ attributes })
278 const videoUUID = video.uuid 278 const videoUUID = video.uuid
279 279
280 await waitJobs(servers) 280 await waitJobs(servers)
281 281
282 for (const server of servers) { 282 for (const server of servers) {
283 const video = await server.videosCommand.get({ id: videoUUID }) 283 const video = await server.videos.get({ id: videoUUID })
284 284
285 expect(video.name).to.equal('transcoded video') 285 expect(video.name).to.equal('transcoded video')
286 expect(video.files).to.have.lengthOf(4) 286 expect(video.files).to.have.lengthOf(4)
@@ -316,7 +316,7 @@ Ajouter un sous-titre est vraiment facile`)
316 } 316 }
317 } 317 }
318 } 318 }
319 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config }) 319 await servers[0].config.updateCustomSubConfig({ newConfig: config })
320 320
321 const attributes = { 321 const attributes = {
322 name: 'hdr video', 322 name: 'hdr video',
@@ -324,13 +324,13 @@ Ajouter un sous-titre est vraiment facile`)
324 channelId: channelIdServer1, 324 channelId: channelIdServer1,
325 privacy: VideoPrivacy.PUBLIC 325 privacy: VideoPrivacy.PUBLIC
326 } 326 }
327 const { video: videoImported } = await servers[0].importsCommand.importVideo({ attributes }) 327 const { video: videoImported } = await servers[0].imports.importVideo({ attributes })
328 const videoUUID = videoImported.uuid 328 const videoUUID = videoImported.uuid
329 329
330 await waitJobs(servers) 330 await waitJobs(servers)
331 331
332 // test resolution 332 // test resolution
333 const video = await servers[0].videosCommand.get({ id: videoUUID }) 333 const video = await servers[0].videos.get({ id: videoUUID })
334 expect(video.name).to.equal('hdr video') 334 expect(video.name).to.equal('hdr video')
335 const maxResolution = Math.max.apply(Math, video.files.map(function (o) { return o.resolution.id })) 335 const maxResolution = Math.max.apply(Math, video.files.map(function (o) { return o.resolution.id }))
336 expect(maxResolution, 'expected max resolution not met').to.equals(VideoResolution.H_1080P) 336 expect(maxResolution, 'expected max resolution not met').to.equals(VideoResolution.H_1080P)
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index b8fff096d..95395a582 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -18,7 +18,7 @@ describe('Test video NSFW policy', function () {
18 let customConfig: CustomConfig 18 let customConfig: CustomConfig
19 19
20 async function getVideosFunctions (token?: string, query: { nsfw?: BooleanBothQuery } = {}) { 20 async function getVideosFunctions (token?: string, query: { nsfw?: BooleanBothQuery } = {}) {
21 const user = await server.usersCommand.getMyInfo() 21 const user = await server.users.getMyInfo()
22 const videoChannelName = user.videoChannels[0].name 22 const videoChannelName = user.videoChannels[0].name
23 const accountName = user.account.name + '@' + user.account.host 23 const accountName = user.account.name + '@' + user.account.host
24 const hasQuery = Object.keys(query).length !== 0 24 const hasQuery = Object.keys(query).length !== 0
@@ -26,15 +26,15 @@ describe('Test video NSFW policy', function () {
26 26
27 if (token) { 27 if (token) {
28 promises = [ 28 promises = [
29 server.searchCommand.advancedVideoSearch({ token, search: { search: 'n', sort: '-publishedAt', ...query } }), 29 server.search.advancedVideoSearch({ token, search: { search: 'n', sort: '-publishedAt', ...query } }),
30 server.videosCommand.listWithToken({ token, ...query }), 30 server.videos.listWithToken({ token, ...query }),
31 server.videosCommand.listByAccount({ token, accountName, ...query }), 31 server.videos.listByAccount({ token, accountName, ...query }),
32 server.videosCommand.listByChannel({ token, videoChannelName, ...query }) 32 server.videos.listByChannel({ token, videoChannelName, ...query })
33 ] 33 ]
34 34
35 // Overviews do not support video filters 35 // Overviews do not support video filters
36 if (!hasQuery) { 36 if (!hasQuery) {
37 const p = server.overviewsCommand.getVideos({ page: 1, token }) 37 const p = server.overviews.getVideos({ page: 1, token })
38 .then(res => createOverviewRes(res)) 38 .then(res => createOverviewRes(res))
39 promises.push(p) 39 promises.push(p)
40 } 40 }
@@ -43,15 +43,15 @@ describe('Test video NSFW policy', function () {
43 } 43 }
44 44
45 promises = [ 45 promises = [
46 server.searchCommand.searchVideos({ search: 'n', sort: '-publishedAt' }), 46 server.search.searchVideos({ search: 'n', sort: '-publishedAt' }),
47 server.videosCommand.list(), 47 server.videos.list(),
48 server.videosCommand.listByAccount({ accountName }), 48 server.videos.listByAccount({ accountName }),
49 server.videosCommand.listByChannel({ videoChannelName }) 49 server.videos.listByChannel({ videoChannelName })
50 ] 50 ]
51 51
52 // Overviews do not support video filters 52 // Overviews do not support video filters
53 if (!hasQuery) { 53 if (!hasQuery) {
54 const p = server.overviewsCommand.getVideos({ page: 1 }) 54 const p = server.overviews.getVideos({ page: 1 })
55 .then(res => createOverviewRes(res)) 55 .then(res => createOverviewRes(res))
56 promises.push(p) 56 promises.push(p)
57 } 57 }
@@ -68,20 +68,20 @@ describe('Test video NSFW policy', function () {
68 68
69 { 69 {
70 const attributes = { name: 'nsfw', nsfw: true, category: 1 } 70 const attributes = { name: 'nsfw', nsfw: true, category: 1 }
71 await server.videosCommand.upload({ attributes }) 71 await server.videos.upload({ attributes })
72 } 72 }
73 73
74 { 74 {
75 const attributes = { name: 'normal', nsfw: false, category: 1 } 75 const attributes = { name: 'normal', nsfw: false, category: 1 }
76 await server.videosCommand.upload({ attributes }) 76 await server.videos.upload({ attributes })
77 } 77 }
78 78
79 customConfig = await server.configCommand.getCustomConfig() 79 customConfig = await server.config.getCustomConfig()
80 }) 80 })
81 81
82 describe('Instance default NSFW policy', function () { 82 describe('Instance default NSFW policy', function () {
83 it('Should display NSFW videos with display default NSFW policy', async function () { 83 it('Should display NSFW videos with display default NSFW policy', async function () {
84 const serverConfig = await server.configCommand.getConfig() 84 const serverConfig = await server.config.getConfig()
85 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display') 85 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display')
86 86
87 for (const body of await getVideosFunctions()) { 87 for (const body of await getVideosFunctions()) {
@@ -96,9 +96,9 @@ describe('Test video NSFW policy', function () {
96 96
97 it('Should not display NSFW videos with do_not_list default NSFW policy', async function () { 97 it('Should not display NSFW videos with do_not_list default NSFW policy', async function () {
98 customConfig.instance.defaultNSFWPolicy = 'do_not_list' 98 customConfig.instance.defaultNSFWPolicy = 'do_not_list'
99 await server.configCommand.updateCustomConfig({ newCustomConfig: customConfig }) 99 await server.config.updateCustomConfig({ newCustomConfig: customConfig })
100 100
101 const serverConfig = await server.configCommand.getConfig() 101 const serverConfig = await server.config.getConfig()
102 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('do_not_list') 102 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('do_not_list')
103 103
104 for (const body of await getVideosFunctions()) { 104 for (const body of await getVideosFunctions()) {
@@ -112,9 +112,9 @@ describe('Test video NSFW policy', function () {
112 112
113 it('Should display NSFW videos with blur default NSFW policy', async function () { 113 it('Should display NSFW videos with blur default NSFW policy', async function () {
114 customConfig.instance.defaultNSFWPolicy = 'blur' 114 customConfig.instance.defaultNSFWPolicy = 'blur'
115 await server.configCommand.updateCustomConfig({ newCustomConfig: customConfig }) 115 await server.config.updateCustomConfig({ newCustomConfig: customConfig })
116 116
117 const serverConfig = await server.configCommand.getConfig() 117 const serverConfig = await server.config.getConfig()
118 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('blur') 118 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('blur')
119 119
120 for (const body of await getVideosFunctions()) { 120 for (const body of await getVideosFunctions()) {
@@ -133,17 +133,17 @@ describe('Test video NSFW policy', function () {
133 it('Should create a user having the default nsfw policy', async function () { 133 it('Should create a user having the default nsfw policy', async function () {
134 const username = 'user1' 134 const username = 'user1'
135 const password = 'my super password' 135 const password = 'my super password'
136 await server.usersCommand.create({ username: username, password: password }) 136 await server.users.create({ username: username, password: password })
137 137
138 userAccessToken = await server.loginCommand.getAccessToken({ username, password }) 138 userAccessToken = await server.login.getAccessToken({ username, password })
139 139
140 const user = await server.usersCommand.getMyInfo({ token: userAccessToken }) 140 const user = await server.users.getMyInfo({ token: userAccessToken })
141 expect(user.nsfwPolicy).to.equal('blur') 141 expect(user.nsfwPolicy).to.equal('blur')
142 }) 142 })
143 143
144 it('Should display NSFW videos with blur user NSFW policy', async function () { 144 it('Should display NSFW videos with blur user NSFW policy', async function () {
145 customConfig.instance.defaultNSFWPolicy = 'do_not_list' 145 customConfig.instance.defaultNSFWPolicy = 'do_not_list'
146 await server.configCommand.updateCustomConfig({ newCustomConfig: customConfig }) 146 await server.config.updateCustomConfig({ newCustomConfig: customConfig })
147 147
148 for (const body of await getVideosFunctions(userAccessToken)) { 148 for (const body of await getVideosFunctions(userAccessToken)) {
149 expect(body.total).to.equal(2) 149 expect(body.total).to.equal(2)
@@ -156,7 +156,7 @@ describe('Test video NSFW policy', function () {
156 }) 156 })
157 157
158 it('Should display NSFW videos with display user NSFW policy', async function () { 158 it('Should display NSFW videos with display user NSFW policy', async function () {
159 await server.usersCommand.updateMe({ nsfwPolicy: 'display' }) 159 await server.users.updateMe({ nsfwPolicy: 'display' })
160 160
161 for (const body of await getVideosFunctions(server.accessToken)) { 161 for (const body of await getVideosFunctions(server.accessToken)) {
162 expect(body.total).to.equal(2) 162 expect(body.total).to.equal(2)
@@ -169,7 +169,7 @@ describe('Test video NSFW policy', function () {
169 }) 169 })
170 170
171 it('Should not display NSFW videos with do_not_list user NSFW policy', async function () { 171 it('Should not display NSFW videos with do_not_list user NSFW policy', async function () {
172 await server.usersCommand.updateMe({ nsfwPolicy: 'do_not_list' }) 172 await server.users.updateMe({ nsfwPolicy: 'do_not_list' })
173 173
174 for (const body of await getVideosFunctions(server.accessToken)) { 174 for (const body of await getVideosFunctions(server.accessToken)) {
175 expect(body.total).to.equal(1) 175 expect(body.total).to.equal(1)
@@ -181,7 +181,7 @@ describe('Test video NSFW policy', function () {
181 }) 181 })
182 182
183 it('Should be able to see my NSFW videos even with do_not_list user NSFW policy', async function () { 183 it('Should be able to see my NSFW videos even with do_not_list user NSFW policy', async function () {
184 const { total, data } = await server.videosCommand.listMyVideos() 184 const { total, data } = await server.videos.listMyVideos()
185 expect(total).to.equal(2) 185 expect(total).to.equal(2)
186 186
187 expect(data).to.have.lengthOf(2) 187 expect(data).to.have.lengthOf(2)
diff --git a/server/tests/api/videos/video-playlist-thumbnails.ts b/server/tests/api/videos/video-playlist-thumbnails.ts
index 14739af20..709f64c4d 100644
--- a/server/tests/api/videos/video-playlist-thumbnails.ts
+++ b/server/tests/api/videos/video-playlist-thumbnails.ts
@@ -31,13 +31,13 @@ describe('Playlist thumbnail', function () {
31 let video2: number 31 let video2: number
32 32
33 async function getPlaylistWithoutThumbnail (server: ServerInfo) { 33 async function getPlaylistWithoutThumbnail (server: ServerInfo) {
34 const body = await server.playlistsCommand.list({ start: 0, count: 10 }) 34 const body = await server.playlists.list({ start: 0, count: 10 })
35 35
36 return body.data.find(p => p.displayName === 'playlist without thumbnail') 36 return body.data.find(p => p.displayName === 'playlist without thumbnail')
37 } 37 }
38 38
39 async function getPlaylistWithThumbnail (server: ServerInfo) { 39 async function getPlaylistWithThumbnail (server: ServerInfo) {
40 const body = await server.playlistsCommand.list({ start: 0, count: 10 }) 40 const body = await server.playlists.list({ start: 0, count: 10 })
41 41
42 return body.data.find(p => p.displayName === 'playlist with thumbnail') 42 return body.data.find(p => p.displayName === 'playlist with thumbnail')
43 } 43 }
@@ -54,8 +54,8 @@ describe('Playlist thumbnail', function () {
54 // Server 1 and server 2 follow each other 54 // Server 1 and server 2 follow each other
55 await doubleFollow(servers[0], servers[1]) 55 await doubleFollow(servers[0], servers[1])
56 56
57 video1 = (await servers[0].videosCommand.quickUpload({ name: 'video 1' })).id 57 video1 = (await servers[0].videos.quickUpload({ name: 'video 1' })).id
58 video2 = (await servers[0].videosCommand.quickUpload({ name: 'video 2' })).id 58 video2 = (await servers[0].videos.quickUpload({ name: 'video 2' })).id
59 59
60 await waitJobs(servers) 60 await waitJobs(servers)
61 }) 61 })
@@ -63,16 +63,16 @@ describe('Playlist thumbnail', function () {
63 it('Should automatically update the thumbnail when adding an element', async function () { 63 it('Should automatically update the thumbnail when adding an element', async function () {
64 this.timeout(30000) 64 this.timeout(30000)
65 65
66 const created = await servers[1].playlistsCommand.create({ 66 const created = await servers[1].playlists.create({
67 attributes: { 67 attributes: {
68 displayName: 'playlist without thumbnail', 68 displayName: 'playlist without thumbnail',
69 privacy: VideoPlaylistPrivacy.PUBLIC, 69 privacy: VideoPlaylistPrivacy.PUBLIC,
70 videoChannelId: servers[1].videoChannel.id 70 videoChannelId: servers[1].store.channel.id
71 } 71 }
72 }) 72 })
73 playlistWithoutThumbnailId = created.id 73 playlistWithoutThumbnailId = created.id
74 74
75 const added = await servers[1].playlistsCommand.addElement({ 75 const added = await servers[1].playlists.addElement({
76 playlistId: playlistWithoutThumbnailId, 76 playlistId: playlistWithoutThumbnailId,
77 attributes: { videoId: video1 } 77 attributes: { videoId: video1 }
78 }) 78 })
@@ -89,17 +89,17 @@ describe('Playlist thumbnail', function () {
89 it('Should not update the thumbnail if we explicitly uploaded a thumbnail', async function () { 89 it('Should not update the thumbnail if we explicitly uploaded a thumbnail', async function () {
90 this.timeout(30000) 90 this.timeout(30000)
91 91
92 const created = await servers[1].playlistsCommand.create({ 92 const created = await servers[1].playlists.create({
93 attributes: { 93 attributes: {
94 displayName: 'playlist with thumbnail', 94 displayName: 'playlist with thumbnail',
95 privacy: VideoPlaylistPrivacy.PUBLIC, 95 privacy: VideoPlaylistPrivacy.PUBLIC,
96 videoChannelId: servers[1].videoChannel.id, 96 videoChannelId: servers[1].store.channel.id,
97 thumbnailfile: 'thumbnail.jpg' 97 thumbnailfile: 'thumbnail.jpg'
98 } 98 }
99 }) 99 })
100 playlistWithThumbnailId = created.id 100 playlistWithThumbnailId = created.id
101 101
102 const added = await servers[1].playlistsCommand.addElement({ 102 const added = await servers[1].playlists.addElement({
103 playlistId: playlistWithThumbnailId, 103 playlistId: playlistWithThumbnailId,
104 attributes: { videoId: video1 } 104 attributes: { videoId: video1 }
105 }) 105 })
@@ -116,13 +116,13 @@ describe('Playlist thumbnail', function () {
116 it('Should automatically update the thumbnail when moving the first element', async function () { 116 it('Should automatically update the thumbnail when moving the first element', async function () {
117 this.timeout(30000) 117 this.timeout(30000)
118 118
119 const added = await servers[1].playlistsCommand.addElement({ 119 const added = await servers[1].playlists.addElement({
120 playlistId: playlistWithoutThumbnailId, 120 playlistId: playlistWithoutThumbnailId,
121 attributes: { videoId: video2 } 121 attributes: { videoId: video2 }
122 }) 122 })
123 withoutThumbnailE2 = added.id 123 withoutThumbnailE2 = added.id
124 124
125 await servers[1].playlistsCommand.reorderElements({ 125 await servers[1].playlists.reorderElements({
126 playlistId: playlistWithoutThumbnailId, 126 playlistId: playlistWithoutThumbnailId,
127 attributes: { 127 attributes: {
128 startPosition: 1, 128 startPosition: 1,
@@ -141,13 +141,13 @@ describe('Playlist thumbnail', function () {
141 it('Should not update the thumbnail when moving the first element if we explicitly uploaded a thumbnail', async function () { 141 it('Should not update the thumbnail when moving the first element if we explicitly uploaded a thumbnail', async function () {
142 this.timeout(30000) 142 this.timeout(30000)
143 143
144 const added = await servers[1].playlistsCommand.addElement({ 144 const added = await servers[1].playlists.addElement({
145 playlistId: playlistWithThumbnailId, 145 playlistId: playlistWithThumbnailId,
146 attributes: { videoId: video2 } 146 attributes: { videoId: video2 }
147 }) 147 })
148 withThumbnailE2 = added.id 148 withThumbnailE2 = added.id
149 149
150 await servers[1].playlistsCommand.reorderElements({ 150 await servers[1].playlists.reorderElements({
151 playlistId: playlistWithThumbnailId, 151 playlistId: playlistWithThumbnailId,
152 attributes: { 152 attributes: {
153 startPosition: 1, 153 startPosition: 1,
@@ -166,7 +166,7 @@ describe('Playlist thumbnail', function () {
166 it('Should automatically update the thumbnail when deleting the first element', async function () { 166 it('Should automatically update the thumbnail when deleting the first element', async function () {
167 this.timeout(30000) 167 this.timeout(30000)
168 168
169 await servers[1].playlistsCommand.removeElement({ 169 await servers[1].playlists.removeElement({
170 playlistId: playlistWithoutThumbnailId, 170 playlistId: playlistWithoutThumbnailId,
171 elementId: withoutThumbnailE1 171 elementId: withoutThumbnailE1
172 }) 172 })
@@ -182,7 +182,7 @@ describe('Playlist thumbnail', function () {
182 it('Should not update the thumbnail when deleting the first element if we explicitly uploaded a thumbnail', async function () { 182 it('Should not update the thumbnail when deleting the first element if we explicitly uploaded a thumbnail', async function () {
183 this.timeout(30000) 183 this.timeout(30000)
184 184
185 await servers[1].playlistsCommand.removeElement({ 185 await servers[1].playlists.removeElement({
186 playlistId: playlistWithThumbnailId, 186 playlistId: playlistWithThumbnailId,
187 elementId: withThumbnailE1 187 elementId: withThumbnailE1
188 }) 188 })
@@ -198,7 +198,7 @@ describe('Playlist thumbnail', function () {
198 it('Should the thumbnail when we delete the last element', async function () { 198 it('Should the thumbnail when we delete the last element', async function () {
199 this.timeout(30000) 199 this.timeout(30000)
200 200
201 await servers[1].playlistsCommand.removeElement({ 201 await servers[1].playlists.removeElement({
202 playlistId: playlistWithoutThumbnailId, 202 playlistId: playlistWithoutThumbnailId,
203 elementId: withoutThumbnailE2 203 elementId: withoutThumbnailE2
204 }) 204 })
@@ -214,7 +214,7 @@ describe('Playlist thumbnail', function () {
214 it('Should not update the thumbnail when we delete the last element if we explicitly uploaded a thumbnail', async function () { 214 it('Should not update the thumbnail when we delete the last element if we explicitly uploaded a thumbnail', async function () {
215 this.timeout(30000) 215 this.timeout(30000)
216 216
217 await servers[1].playlistsCommand.removeElement({ 217 await servers[1].playlists.removeElement({
218 playlistId: playlistWithThumbnailId, 218 playlistId: playlistWithThumbnailId,
219 elementId: withThumbnailE2 219 elementId: withThumbnailE2
220 }) 220 })
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts
index 40f61ca19..0dc53d4c0 100644
--- a/server/tests/api/videos/video-playlists.ts
+++ b/server/tests/api/videos/video-playlists.ts
@@ -36,7 +36,7 @@ async function checkPlaylistElementType (
36 total: number 36 total: number
37) { 37) {
38 for (const server of servers) { 38 for (const server of servers) {
39 const body = await server.playlistsCommand.listVideos({ token: server.accessToken, playlistId, start: 0, count: 10 }) 39 const body = await server.playlists.listVideos({ token: server.accessToken, playlistId, start: 0, count: 10 })
40 expect(body.total).to.equal(total) 40 expect(body.total).to.equal(total)
41 41
42 const videoElement = body.data.find(e => e.position === position) 42 const videoElement = body.data.find(e => e.position === position)
@@ -86,26 +86,26 @@ describe('Test video playlists', function () {
86 // Server 1 and server 3 follow each other 86 // Server 1 and server 3 follow each other
87 await doubleFollow(servers[0], servers[2]) 87 await doubleFollow(servers[0], servers[2])
88 88
89 commands = servers.map(s => s.playlistsCommand) 89 commands = servers.map(s => s.playlists)
90 90
91 { 91 {
92 servers[0].videos = [] 92 servers[0].store.videos = []
93 servers[1].videos = [] 93 servers[1].store.videos = []
94 servers[2].videos = [] 94 servers[2].store.videos = []
95 95
96 for (const server of servers) { 96 for (const server of servers) {
97 for (let i = 0; i < 7; i++) { 97 for (let i = 0; i < 7; i++) {
98 const name = `video ${i} server ${server.serverNumber}` 98 const name = `video ${i} server ${server.serverNumber}`
99 const video = await server.videosCommand.upload({ attributes: { name, nsfw: false } }) 99 const video = await server.videos.upload({ attributes: { name, nsfw: false } })
100 100
101 server.videos.push(video) 101 server.store.videos.push(video)
102 } 102 }
103 } 103 }
104 } 104 }
105 105
106 nsfwVideoServer1 = (await servers[0].videosCommand.quickUpload({ name: 'NSFW video', nsfw: true })).id 106 nsfwVideoServer1 = (await servers[0].videos.quickUpload({ name: 'NSFW video', nsfw: true })).id
107 107
108 userTokenServer1 = await servers[0].usersCommand.generateUserAndToken('user1') 108 userTokenServer1 = await servers[0].users.generateUserAndToken('user1')
109 109
110 await waitJobs(servers) 110 await waitJobs(servers)
111 }) 111 })
@@ -149,7 +149,7 @@ describe('Test video playlists', function () {
149 }) 149 })
150 150
151 it('Should get private playlist for a classic user', async function () { 151 it('Should get private playlist for a classic user', async function () {
152 const token = await servers[0].usersCommand.generateUserAndToken('toto') 152 const token = await servers[0].users.generateUserAndToken('toto')
153 153
154 const body = await commands[0].listByAccount({ token, handle: 'toto' }) 154 const body = await commands[0].listByAccount({ token, handle: 'toto' })
155 155
@@ -172,7 +172,7 @@ describe('Test video playlists', function () {
172 privacy: VideoPlaylistPrivacy.PUBLIC, 172 privacy: VideoPlaylistPrivacy.PUBLIC,
173 description: 'my super description', 173 description: 'my super description',
174 thumbnailfile: 'thumbnail.jpg', 174 thumbnailfile: 'thumbnail.jpg',
175 videoChannelId: servers[0].videoChannel.id 175 videoChannelId: servers[0].store.channel.id
176 } 176 }
177 }) 177 })
178 178
@@ -181,13 +181,13 @@ describe('Test video playlists', function () {
181 await wait(3000) 181 await wait(3000)
182 182
183 for (const server of servers) { 183 for (const server of servers) {
184 const body = await server.playlistsCommand.list({ start: 0, count: 5 }) 184 const body = await server.playlists.list({ start: 0, count: 5 })
185 expect(body.total).to.equal(1) 185 expect(body.total).to.equal(1)
186 expect(body.data).to.have.lengthOf(1) 186 expect(body.data).to.have.lengthOf(1)
187 187
188 const playlistFromList = body.data[0] 188 const playlistFromList = body.data[0]
189 189
190 const playlistFromGet = await server.playlistsCommand.get({ playlistId: playlistFromList.uuid }) 190 const playlistFromGet = await server.playlists.get({ playlistId: playlistFromList.uuid })
191 191
192 for (const playlist of [ playlistFromGet, playlistFromList ]) { 192 for (const playlist of [ playlistFromGet, playlistFromList ]) {
193 expect(playlist.id).to.be.a('number') 193 expect(playlist.id).to.be.a('number')
@@ -217,23 +217,23 @@ describe('Test video playlists', function () {
217 this.timeout(30000) 217 this.timeout(30000)
218 218
219 { 219 {
220 const playlist = await servers[1].playlistsCommand.create({ 220 const playlist = await servers[1].playlists.create({
221 attributes: { 221 attributes: {
222 displayName: 'playlist 2', 222 displayName: 'playlist 2',
223 privacy: VideoPlaylistPrivacy.PUBLIC, 223 privacy: VideoPlaylistPrivacy.PUBLIC,
224 videoChannelId: servers[1].videoChannel.id 224 videoChannelId: servers[1].store.channel.id
225 } 225 }
226 }) 226 })
227 playlistServer2Id1 = playlist.id 227 playlistServer2Id1 = playlist.id
228 } 228 }
229 229
230 { 230 {
231 const playlist = await servers[1].playlistsCommand.create({ 231 const playlist = await servers[1].playlists.create({
232 attributes: { 232 attributes: {
233 displayName: 'playlist 3', 233 displayName: 'playlist 3',
234 privacy: VideoPlaylistPrivacy.PUBLIC, 234 privacy: VideoPlaylistPrivacy.PUBLIC,
235 thumbnailfile: 'thumbnail.jpg', 235 thumbnailfile: 'thumbnail.jpg',
236 videoChannelId: servers[1].videoChannel.id 236 videoChannelId: servers[1].store.channel.id
237 } 237 }
238 }) 238 })
239 239
@@ -242,13 +242,13 @@ describe('Test video playlists', function () {
242 } 242 }
243 243
244 for (const id of [ playlistServer2Id1, playlistServer2Id2 ]) { 244 for (const id of [ playlistServer2Id1, playlistServer2Id2 ]) {
245 await servers[1].playlistsCommand.addElement({ 245 await servers[1].playlists.addElement({
246 playlistId: id, 246 playlistId: id,
247 attributes: { videoId: servers[1].videos[0].id, startTimestamp: 1, stopTimestamp: 2 } 247 attributes: { videoId: servers[1].store.videos[0].id, startTimestamp: 1, stopTimestamp: 2 }
248 }) 248 })
249 await servers[1].playlistsCommand.addElement({ 249 await servers[1].playlists.addElement({
250 playlistId: id, 250 playlistId: id,
251 attributes: { videoId: servers[1].videos[1].id } 251 attributes: { videoId: servers[1].store.videos[1].id }
252 }) 252 })
253 } 253 }
254 254
@@ -256,7 +256,7 @@ describe('Test video playlists', function () {
256 await wait(3000) 256 await wait(3000)
257 257
258 for (const server of [ servers[0], servers[1] ]) { 258 for (const server of [ servers[0], servers[1] ]) {
259 const body = await server.playlistsCommand.list({ start: 0, count: 5 }) 259 const body = await server.playlists.list({ start: 0, count: 5 })
260 260
261 const playlist2 = body.data.find(p => p.displayName === 'playlist 2') 261 const playlist2 = body.data.find(p => p.displayName === 'playlist 2')
262 expect(playlist2).to.not.be.undefined 262 expect(playlist2).to.not.be.undefined
@@ -267,7 +267,7 @@ describe('Test video playlists', function () {
267 await testImage(server.url, 'thumbnail', playlist3.thumbnailPath) 267 await testImage(server.url, 'thumbnail', playlist3.thumbnailPath)
268 } 268 }
269 269
270 const body = await servers[2].playlistsCommand.list({ start: 0, count: 5 }) 270 const body = await servers[2].playlists.list({ start: 0, count: 5 })
271 expect(body.data.find(p => p.displayName === 'playlist 2')).to.be.undefined 271 expect(body.data.find(p => p.displayName === 'playlist 2')).to.be.undefined
272 expect(body.data.find(p => p.displayName === 'playlist 3')).to.be.undefined 272 expect(body.data.find(p => p.displayName === 'playlist 3')).to.be.undefined
273 }) 273 })
@@ -278,7 +278,7 @@ describe('Test video playlists', function () {
278 // Server 2 and server 3 follow each other 278 // Server 2 and server 3 follow each other
279 await doubleFollow(servers[1], servers[2]) 279 await doubleFollow(servers[1], servers[2])
280 280
281 const body = await servers[2].playlistsCommand.list({ start: 0, count: 5 }) 281 const body = await servers[2].playlists.list({ start: 0, count: 5 })
282 282
283 const playlist2 = body.data.find(p => p.displayName === 'playlist 2') 283 const playlist2 = body.data.find(p => p.displayName === 'playlist 2')
284 expect(playlist2).to.not.be.undefined 284 expect(playlist2).to.not.be.undefined
@@ -294,7 +294,7 @@ describe('Test video playlists', function () {
294 this.timeout(30000) 294 this.timeout(30000)
295 295
296 { 296 {
297 const body = await servers[2].playlistsCommand.list({ start: 1, count: 2, sort: 'createdAt' }) 297 const body = await servers[2].playlists.list({ start: 1, count: 2, sort: 'createdAt' })
298 expect(body.total).to.equal(3) 298 expect(body.total).to.equal(3)
299 299
300 const data = body.data 300 const data = body.data
@@ -304,7 +304,7 @@ describe('Test video playlists', function () {
304 } 304 }
305 305
306 { 306 {
307 const body = await servers[2].playlistsCommand.list({ start: 1, count: 2, sort: '-createdAt' }) 307 const body = await servers[2].playlists.list({ start: 1, count: 2, sort: '-createdAt' })
308 expect(body.total).to.equal(3) 308 expect(body.total).to.equal(3)
309 309
310 const data = body.data 310 const data = body.data
@@ -331,7 +331,7 @@ describe('Test video playlists', function () {
331 this.timeout(30000) 331 this.timeout(30000)
332 332
333 { 333 {
334 const body = await servers[1].playlistsCommand.listByAccount({ handle: 'root', start: 1, count: 2, sort: '-createdAt' }) 334 const body = await servers[1].playlists.listByAccount({ handle: 'root', start: 1, count: 2, sort: '-createdAt' })
335 expect(body.total).to.equal(2) 335 expect(body.total).to.equal(2)
336 336
337 const data = body.data 337 const data = body.data
@@ -340,7 +340,7 @@ describe('Test video playlists', function () {
340 } 340 }
341 341
342 { 342 {
343 const body = await servers[1].playlistsCommand.listByAccount({ handle: 'root', start: 1, count: 2, sort: 'createdAt' }) 343 const body = await servers[1].playlists.listByAccount({ handle: 'root', start: 1, count: 2, sort: 'createdAt' })
344 expect(body.total).to.equal(2) 344 expect(body.total).to.equal(2)
345 345
346 const data = body.data 346 const data = body.data
@@ -349,7 +349,7 @@ describe('Test video playlists', function () {
349 } 349 }
350 350
351 { 351 {
352 const body = await servers[1].playlistsCommand.listByAccount({ handle: 'root', sort: 'createdAt', search: '3' }) 352 const body = await servers[1].playlists.listByAccount({ handle: 'root', sort: 'createdAt', search: '3' })
353 expect(body.total).to.equal(1) 353 expect(body.total).to.equal(1)
354 354
355 const data = body.data 355 const data = body.data
@@ -358,7 +358,7 @@ describe('Test video playlists', function () {
358 } 358 }
359 359
360 { 360 {
361 const body = await servers[1].playlistsCommand.listByAccount({ handle: 'root', sort: 'createdAt', search: '4' }) 361 const body = await servers[1].playlists.listByAccount({ handle: 'root', sort: 'createdAt', search: '4' })
362 expect(body.total).to.equal(0) 362 expect(body.total).to.equal(0)
363 363
364 const data = body.data 364 const data = body.data
@@ -375,17 +375,17 @@ describe('Test video playlists', function () {
375 this.timeout(30000) 375 this.timeout(30000)
376 376
377 { 377 {
378 unlistedPlaylist = await servers[1].playlistsCommand.create({ 378 unlistedPlaylist = await servers[1].playlists.create({
379 attributes: { 379 attributes: {
380 displayName: 'playlist unlisted', 380 displayName: 'playlist unlisted',
381 privacy: VideoPlaylistPrivacy.UNLISTED, 381 privacy: VideoPlaylistPrivacy.UNLISTED,
382 videoChannelId: servers[1].videoChannel.id 382 videoChannelId: servers[1].store.channel.id
383 } 383 }
384 }) 384 })
385 } 385 }
386 386
387 { 387 {
388 privatePlaylist = await servers[1].playlistsCommand.create({ 388 privatePlaylist = await servers[1].playlists.create({
389 attributes: { 389 attributes: {
390 displayName: 'playlist private', 390 displayName: 'playlist private',
391 privacy: VideoPlaylistPrivacy.PRIVATE 391 privacy: VideoPlaylistPrivacy.PRIVATE
@@ -400,8 +400,8 @@ describe('Test video playlists', function () {
400 it('Should not list unlisted or private playlists', async function () { 400 it('Should not list unlisted or private playlists', async function () {
401 for (const server of servers) { 401 for (const server of servers) {
402 const results = [ 402 const results = [
403 await server.playlistsCommand.listByAccount({ handle: 'root@localhost:' + servers[1].port, sort: '-createdAt' }), 403 await server.playlists.listByAccount({ handle: 'root@localhost:' + servers[1].port, sort: '-createdAt' }),
404 await server.playlistsCommand.list({ start: 0, count: 2, sort: '-createdAt' }) 404 await server.playlists.list({ start: 0, count: 2, sort: '-createdAt' })
405 ] 405 ]
406 406
407 expect(results[0].total).to.equal(2) 407 expect(results[0].total).to.equal(2)
@@ -417,23 +417,23 @@ describe('Test video playlists', function () {
417 }) 417 })
418 418
419 it('Should not get unlisted playlist using only the id', async function () { 419 it('Should not get unlisted playlist using only the id', async function () {
420 await servers[1].playlistsCommand.get({ playlistId: unlistedPlaylist.id, expectedStatus: 404 }) 420 await servers[1].playlists.get({ playlistId: unlistedPlaylist.id, expectedStatus: 404 })
421 }) 421 })
422 422
423 it('Should get unlisted plyaylist using uuid or shortUUID', async function () { 423 it('Should get unlisted plyaylist using uuid or shortUUID', async function () {
424 await servers[1].playlistsCommand.get({ playlistId: unlistedPlaylist.uuid }) 424 await servers[1].playlists.get({ playlistId: unlistedPlaylist.uuid })
425 await servers[1].playlistsCommand.get({ playlistId: unlistedPlaylist.shortUUID }) 425 await servers[1].playlists.get({ playlistId: unlistedPlaylist.shortUUID })
426 }) 426 })
427 427
428 it('Should not get private playlist without token', async function () { 428 it('Should not get private playlist without token', async function () {
429 for (const id of [ privatePlaylist.id, privatePlaylist.uuid, privatePlaylist.shortUUID ]) { 429 for (const id of [ privatePlaylist.id, privatePlaylist.uuid, privatePlaylist.shortUUID ]) {
430 await servers[1].playlistsCommand.get({ playlistId: id, expectedStatus: 401 }) 430 await servers[1].playlists.get({ playlistId: id, expectedStatus: 401 })
431 } 431 }
432 }) 432 })
433 433
434 it('Should get private playlist with a token', async function () { 434 it('Should get private playlist with a token', async function () {
435 for (const id of [ privatePlaylist.id, privatePlaylist.uuid, privatePlaylist.shortUUID ]) { 435 for (const id of [ privatePlaylist.id, privatePlaylist.uuid, privatePlaylist.shortUUID ]) {
436 await servers[1].playlistsCommand.get({ token: servers[1].accessToken, playlistId: id }) 436 await servers[1].playlists.get({ token: servers[1].accessToken, playlistId: id })
437 } 437 }
438 }) 438 })
439 }) 439 })
@@ -443,13 +443,13 @@ describe('Test video playlists', function () {
443 it('Should update a playlist', async function () { 443 it('Should update a playlist', async function () {
444 this.timeout(30000) 444 this.timeout(30000)
445 445
446 await servers[1].playlistsCommand.update({ 446 await servers[1].playlists.update({
447 attributes: { 447 attributes: {
448 displayName: 'playlist 3 updated', 448 displayName: 'playlist 3 updated',
449 description: 'description updated', 449 description: 'description updated',
450 privacy: VideoPlaylistPrivacy.UNLISTED, 450 privacy: VideoPlaylistPrivacy.UNLISTED,
451 thumbnailfile: 'thumbnail.jpg', 451 thumbnailfile: 'thumbnail.jpg',
452 videoChannelId: servers[1].videoChannel.id 452 videoChannelId: servers[1].store.channel.id
453 }, 453 },
454 playlistId: playlistServer2Id2 454 playlistId: playlistServer2Id2
455 }) 455 })
@@ -457,7 +457,7 @@ describe('Test video playlists', function () {
457 await waitJobs(servers) 457 await waitJobs(servers)
458 458
459 for (const server of servers) { 459 for (const server of servers) {
460 const playlist = await server.playlistsCommand.get({ playlistId: playlistServer2UUID2 }) 460 const playlist = await server.playlists.get({ playlistId: playlistServer2UUID2 })
461 461
462 expect(playlist.displayName).to.equal('playlist 3 updated') 462 expect(playlist.displayName).to.equal('playlist 3 updated')
463 expect(playlist.description).to.equal('description updated') 463 expect(playlist.description).to.equal('description updated')
@@ -491,23 +491,23 @@ describe('Test video playlists', function () {
491 attributes: { 491 attributes: {
492 displayName: 'playlist 4', 492 displayName: 'playlist 4',
493 privacy: VideoPlaylistPrivacy.PUBLIC, 493 privacy: VideoPlaylistPrivacy.PUBLIC,
494 videoChannelId: servers[0].videoChannel.id 494 videoChannelId: servers[0].store.channel.id
495 } 495 }
496 }) 496 })
497 497
498 playlistServer1Id = playlist.id 498 playlistServer1Id = playlist.id
499 playlistServer1UUID = playlist.uuid 499 playlistServer1UUID = playlist.uuid
500 500
501 await addVideo({ videoId: servers[0].videos[0].uuid, startTimestamp: 15, stopTimestamp: 28 }) 501 await addVideo({ videoId: servers[0].store.videos[0].uuid, startTimestamp: 15, stopTimestamp: 28 })
502 await addVideo({ videoId: servers[2].videos[1].uuid, startTimestamp: 35 }) 502 await addVideo({ videoId: servers[2].store.videos[1].uuid, startTimestamp: 35 })
503 await addVideo({ videoId: servers[2].videos[2].uuid }) 503 await addVideo({ videoId: servers[2].store.videos[2].uuid })
504 { 504 {
505 const element = await addVideo({ videoId: servers[0].videos[3].uuid, stopTimestamp: 35 }) 505 const element = await addVideo({ videoId: servers[0].store.videos[3].uuid, stopTimestamp: 35 })
506 playlistElementServer1Video4 = element.id 506 playlistElementServer1Video4 = element.id
507 } 507 }
508 508
509 { 509 {
510 const element = await addVideo({ videoId: servers[0].videos[4].uuid, startTimestamp: 45, stopTimestamp: 60 }) 510 const element = await addVideo({ videoId: servers[0].store.videos[4].uuid, startTimestamp: 45, stopTimestamp: 60 })
511 playlistElementServer1Video5 = element.id 511 playlistElementServer1Video5 = element.id
512 } 512 }
513 513
@@ -527,7 +527,7 @@ describe('Test video playlists', function () {
527 527
528 for (const server of servers) { 528 for (const server of servers) {
529 { 529 {
530 const body = await server.playlistsCommand.listVideos({ playlistId: playlistServer1UUID, start: 0, count: 10 }) 530 const body = await server.playlists.listVideos({ playlistId: playlistServer1UUID, start: 0, count: 10 })
531 531
532 expect(body.total).to.equal(8) 532 expect(body.total).to.equal(8)
533 533
@@ -576,7 +576,7 @@ describe('Test video playlists', function () {
576 } 576 }
577 577
578 { 578 {
579 const body = await server.playlistsCommand.listVideos({ playlistId: playlistServer1UUID, start: 0, count: 2 }) 579 const body = await server.playlists.listVideos({ playlistId: playlistServer1UUID, start: 0, count: 2 })
580 expect(body.data).to.have.lengthOf(2) 580 expect(body.data).to.have.lengthOf(2)
581 } 581 }
582 } 582 }
@@ -606,7 +606,7 @@ describe('Test video playlists', function () {
606 attributes: { 606 attributes: {
607 displayName: 'playlist 56', 607 displayName: 'playlist 56',
608 privacy: VideoPlaylistPrivacy.PUBLIC, 608 privacy: VideoPlaylistPrivacy.PUBLIC,
609 videoChannelId: servers[0].videoChannel.id 609 videoChannelId: servers[0].store.channel.id
610 } 610 }
611 }) 611 })
612 612
@@ -617,9 +617,9 @@ describe('Test video playlists', function () {
617 return commands[0].addElement({ token: userTokenServer1, playlistId: playlistServer1Id2, attributes }) 617 return commands[0].addElement({ token: userTokenServer1, playlistId: playlistServer1Id2, attributes })
618 } 618 }
619 619
620 video1 = (await servers[0].videosCommand.quickUpload({ name: 'video 89', token: userTokenServer1 })).uuid 620 video1 = (await servers[0].videos.quickUpload({ name: 'video 89', token: userTokenServer1 })).uuid
621 video2 = (await servers[1].videosCommand.quickUpload({ name: 'video 90' })).uuid 621 video2 = (await servers[1].videos.quickUpload({ name: 'video 90' })).uuid
622 video3 = (await servers[0].videosCommand.quickUpload({ name: 'video 91', nsfw: true })).uuid 622 video3 = (await servers[0].videos.quickUpload({ name: 'video 91', nsfw: true })).uuid
623 623
624 await waitJobs(servers) 624 await waitJobs(servers)
625 625
@@ -637,7 +637,7 @@ describe('Test video playlists', function () {
637 const position = 1 637 const position = 1
638 638
639 { 639 {
640 await servers[0].videosCommand.update({ id: video1, attributes: { privacy: VideoPrivacy.PRIVATE } }) 640 await servers[0].videos.update({ id: video1, attributes: { privacy: VideoPrivacy.PRIVATE } })
641 await waitJobs(servers) 641 await waitJobs(servers)
642 642
643 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 643 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
@@ -647,7 +647,7 @@ describe('Test video playlists', function () {
647 } 647 }
648 648
649 { 649 {
650 await servers[0].videosCommand.update({ id: video1, attributes: { privacy: VideoPrivacy.PUBLIC } }) 650 await servers[0].videos.update({ id: video1, attributes: { privacy: VideoPrivacy.PUBLIC } })
651 await waitJobs(servers) 651 await waitJobs(servers)
652 652
653 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 653 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
@@ -665,7 +665,7 @@ describe('Test video playlists', function () {
665 const position = 1 665 const position = 1
666 666
667 { 667 {
668 await servers[0].blacklistCommand.add({ videoId: video1, reason: 'reason', unfederate: true }) 668 await servers[0].blacklist.add({ videoId: video1, reason: 'reason', unfederate: true })
669 await waitJobs(servers) 669 await waitJobs(servers)
670 670
671 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 671 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
@@ -675,7 +675,7 @@ describe('Test video playlists', function () {
675 } 675 }
676 676
677 { 677 {
678 await servers[0].blacklistCommand.remove({ videoId: video1 }) 678 await servers[0].blacklist.remove({ videoId: video1 })
679 await waitJobs(servers) 679 await waitJobs(servers)
680 680
681 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 681 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
@@ -689,7 +689,7 @@ describe('Test video playlists', function () {
689 it('Should update the element type if the account or server of the video is blocked', async function () { 689 it('Should update the element type if the account or server of the video is blocked', async function () {
690 this.timeout(90000) 690 this.timeout(90000)
691 691
692 const command = servers[0].blocklistCommand 692 const command = servers[0].blocklist
693 693
694 const name = 'video 90' 694 const name = 'video 90'
695 const position = 2 695 const position = 2
@@ -778,7 +778,7 @@ describe('Test video playlists', function () {
778 await waitJobs(servers) 778 await waitJobs(servers)
779 779
780 for (const server of servers) { 780 for (const server of servers) {
781 const body = await server.playlistsCommand.listVideos({ playlistId: playlistServer1UUID, start: 0, count: 10 }) 781 const body = await server.playlists.listVideos({ playlistId: playlistServer1UUID, start: 0, count: 10 })
782 const names = body.data.map(v => v.video.name) 782 const names = body.data.map(v => v.video.name)
783 783
784 expect(names).to.deep.equal([ 784 expect(names).to.deep.equal([
@@ -807,7 +807,7 @@ describe('Test video playlists', function () {
807 await waitJobs(servers) 807 await waitJobs(servers)
808 808
809 for (const server of servers) { 809 for (const server of servers) {
810 const body = await server.playlistsCommand.listVideos({ playlistId: playlistServer1UUID, start: 0, count: 10 }) 810 const body = await server.playlists.listVideos({ playlistId: playlistServer1UUID, start: 0, count: 10 })
811 const names = body.data.map(v => v.video.name) 811 const names = body.data.map(v => v.video.name)
812 812
813 expect(names).to.deep.equal([ 813 expect(names).to.deep.equal([
@@ -835,7 +835,7 @@ describe('Test video playlists', function () {
835 await waitJobs(servers) 835 await waitJobs(servers)
836 836
837 for (const server of servers) { 837 for (const server of servers) {
838 const { data: elements } = await server.playlistsCommand.listVideos({ playlistId: playlistServer1UUID, start: 0, count: 10 }) 838 const { data: elements } = await server.playlists.listVideos({ playlistId: playlistServer1UUID, start: 0, count: 10 })
839 const names = elements.map(v => v.video.name) 839 const names = elements.map(v => v.video.name)
840 840
841 expect(names).to.deep.equal([ 841 expect(names).to.deep.equal([
@@ -878,7 +878,7 @@ describe('Test video playlists', function () {
878 await waitJobs(servers) 878 await waitJobs(servers)
879 879
880 for (const server of servers) { 880 for (const server of servers) {
881 const { data: elements } = await server.playlistsCommand.listVideos({ playlistId: playlistServer1UUID, start: 0, count: 10 }) 881 const { data: elements } = await server.playlists.listVideos({ playlistId: playlistServer1UUID, start: 0, count: 10 })
882 882
883 expect(elements[0].video.name).to.equal('video 3 server 1') 883 expect(elements[0].video.name).to.equal('video 3 server 1')
884 expect(elements[0].position).to.equal(1) 884 expect(elements[0].position).to.equal(1)
@@ -894,16 +894,16 @@ describe('Test video playlists', function () {
894 894
895 it('Should check videos existence in my playlist', async function () { 895 it('Should check videos existence in my playlist', async function () {
896 const videoIds = [ 896 const videoIds = [
897 servers[0].videos[0].id, 897 servers[0].store.videos[0].id,
898 42000, 898 42000,
899 servers[0].videos[3].id, 899 servers[0].store.videos[3].id,
900 43000, 900 43000,
901 servers[0].videos[4].id 901 servers[0].store.videos[4].id
902 ] 902 ]
903 const obj = await commands[0].videosExist({ videoIds }) 903 const obj = await commands[0].videosExist({ videoIds })
904 904
905 { 905 {
906 const elem = obj[servers[0].videos[0].id] 906 const elem = obj[servers[0].store.videos[0].id]
907 expect(elem).to.have.lengthOf(1) 907 expect(elem).to.have.lengthOf(1)
908 expect(elem[0].playlistElementId).to.exist 908 expect(elem[0].playlistElementId).to.exist
909 expect(elem[0].playlistId).to.equal(playlistServer1Id) 909 expect(elem[0].playlistId).to.equal(playlistServer1Id)
@@ -912,7 +912,7 @@ describe('Test video playlists', function () {
912 } 912 }
913 913
914 { 914 {
915 const elem = obj[servers[0].videos[3].id] 915 const elem = obj[servers[0].store.videos[3].id]
916 expect(elem).to.have.lengthOf(1) 916 expect(elem).to.have.lengthOf(1)
917 expect(elem[0].playlistElementId).to.equal(playlistElementServer1Video4) 917 expect(elem[0].playlistElementId).to.equal(playlistElementServer1Video4)
918 expect(elem[0].playlistId).to.equal(playlistServer1Id) 918 expect(elem[0].playlistId).to.equal(playlistServer1Id)
@@ -921,7 +921,7 @@ describe('Test video playlists', function () {
921 } 921 }
922 922
923 { 923 {
924 const elem = obj[servers[0].videos[4].id] 924 const elem = obj[servers[0].store.videos[4].id]
925 expect(elem).to.have.lengthOf(1) 925 expect(elem).to.have.lengthOf(1)
926 expect(elem[0].playlistId).to.equal(playlistServer1Id) 926 expect(elem[0].playlistId).to.equal(playlistServer1Id)
927 expect(elem[0].startTimestamp).to.equal(45) 927 expect(elem[0].startTimestamp).to.equal(45)
@@ -934,29 +934,29 @@ describe('Test video playlists', function () {
934 934
935 it('Should automatically update updatedAt field of playlists', async function () { 935 it('Should automatically update updatedAt field of playlists', async function () {
936 const server = servers[1] 936 const server = servers[1]
937 const videoId = servers[1].videos[5].id 937 const videoId = servers[1].store.videos[5].id
938 938
939 async function getPlaylistNames () { 939 async function getPlaylistNames () {
940 const { data } = await server.playlistsCommand.listByAccount({ token: server.accessToken, handle: 'root', sort: '-updatedAt' }) 940 const { data } = await server.playlists.listByAccount({ token: server.accessToken, handle: 'root', sort: '-updatedAt' })
941 941
942 return data.map(p => p.displayName) 942 return data.map(p => p.displayName)
943 } 943 }
944 944
945 const attributes = { videoId } 945 const attributes = { videoId }
946 const element1 = await server.playlistsCommand.addElement({ playlistId: playlistServer2Id1, attributes }) 946 const element1 = await server.playlists.addElement({ playlistId: playlistServer2Id1, attributes })
947 const element2 = await server.playlistsCommand.addElement({ playlistId: playlistServer2Id2, attributes }) 947 const element2 = await server.playlists.addElement({ playlistId: playlistServer2Id2, attributes })
948 948
949 const names1 = await getPlaylistNames() 949 const names1 = await getPlaylistNames()
950 expect(names1[0]).to.equal('playlist 3 updated') 950 expect(names1[0]).to.equal('playlist 3 updated')
951 expect(names1[1]).to.equal('playlist 2') 951 expect(names1[1]).to.equal('playlist 2')
952 952
953 await server.playlistsCommand.removeElement({ playlistId: playlistServer2Id1, elementId: element1.id }) 953 await server.playlists.removeElement({ playlistId: playlistServer2Id1, elementId: element1.id })
954 954
955 const names2 = await getPlaylistNames() 955 const names2 = await getPlaylistNames()
956 expect(names2[0]).to.equal('playlist 2') 956 expect(names2[0]).to.equal('playlist 2')
957 expect(names2[1]).to.equal('playlist 3 updated') 957 expect(names2[1]).to.equal('playlist 3 updated')
958 958
959 await server.playlistsCommand.removeElement({ playlistId: playlistServer2Id2, elementId: element2.id }) 959 await server.playlists.removeElement({ playlistId: playlistServer2Id2, elementId: element2.id })
960 960
961 const names3 = await getPlaylistNames() 961 const names3 = await getPlaylistNames()
962 expect(names3[0]).to.equal('playlist 3 updated') 962 expect(names3[0]).to.equal('playlist 3 updated')
@@ -972,7 +972,7 @@ describe('Test video playlists', function () {
972 await waitJobs(servers) 972 await waitJobs(servers)
973 973
974 for (const server of servers) { 974 for (const server of servers) {
975 const body = await server.playlistsCommand.listVideos({ playlistId: playlistServer1UUID, start: 0, count: 10 }) 975 const body = await server.playlists.listVideos({ playlistId: playlistServer1UUID, start: 0, count: 10 })
976 expect(body.total).to.equal(6) 976 expect(body.total).to.equal(6)
977 977
978 const elements = body.data 978 const elements = body.data
@@ -1005,14 +1005,14 @@ describe('Test video playlists', function () {
1005 attributes: { 1005 attributes: {
1006 displayName: 'my super public playlist', 1006 displayName: 'my super public playlist',
1007 privacy: VideoPlaylistPrivacy.PUBLIC, 1007 privacy: VideoPlaylistPrivacy.PUBLIC,
1008 videoChannelId: servers[0].videoChannel.id 1008 videoChannelId: servers[0].store.channel.id
1009 } 1009 }
1010 }) 1010 })
1011 1011
1012 await waitJobs(servers) 1012 await waitJobs(servers)
1013 1013
1014 for (const server of servers) { 1014 for (const server of servers) {
1015 await server.playlistsCommand.get({ playlistId: videoPlaylistIds.uuid, expectedStatus: HttpStatusCode.OK_200 }) 1015 await server.playlists.get({ playlistId: videoPlaylistIds.uuid, expectedStatus: HttpStatusCode.OK_200 })
1016 } 1016 }
1017 1017
1018 const attributes = { privacy: VideoPlaylistPrivacy.PRIVATE } 1018 const attributes = { privacy: VideoPlaylistPrivacy.PRIVATE }
@@ -1021,7 +1021,7 @@ describe('Test video playlists', function () {
1021 await waitJobs(servers) 1021 await waitJobs(servers)
1022 1022
1023 for (const server of [ servers[1], servers[2] ]) { 1023 for (const server of [ servers[1], servers[2] ]) {
1024 await server.playlistsCommand.get({ playlistId: videoPlaylistIds.uuid, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 1024 await server.playlists.get({ playlistId: videoPlaylistIds.uuid, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
1025 } 1025 }
1026 1026
1027 await commands[0].get({ playlistId: videoPlaylistIds.uuid, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 1027 await commands[0].get({ playlistId: videoPlaylistIds.uuid, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
@@ -1039,7 +1039,7 @@ describe('Test video playlists', function () {
1039 await waitJobs(servers) 1039 await waitJobs(servers)
1040 1040
1041 for (const server of servers) { 1041 for (const server of servers) {
1042 await server.playlistsCommand.get({ playlistId: playlistServer1UUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 1042 await server.playlists.get({ playlistId: playlistServer1UUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
1043 } 1043 }
1044 }) 1044 })
1045 1045
@@ -1057,16 +1057,16 @@ describe('Test video playlists', function () {
1057 const finder = (data: VideoPlaylist[]) => data.find(p => p.displayName === 'my super playlist') 1057 const finder = (data: VideoPlaylist[]) => data.find(p => p.displayName === 'my super playlist')
1058 1058
1059 { 1059 {
1060 const body = await servers[2].playlistsCommand.list({ start: 0, count: 5 }) 1060 const body = await servers[2].playlists.list({ start: 0, count: 5 })
1061 expect(body.total).to.equal(3) 1061 expect(body.total).to.equal(3)
1062 1062
1063 expect(finder(body.data)).to.not.be.undefined 1063 expect(finder(body.data)).to.not.be.undefined
1064 } 1064 }
1065 1065
1066 await servers[2].followsCommand.unfollow({ target: servers[0] }) 1066 await servers[2].follows.unfollow({ target: servers[0] })
1067 1067
1068 { 1068 {
1069 const body = await servers[2].playlistsCommand.list({ start: 0, count: 5 }) 1069 const body = await servers[2].playlists.list({ start: 0, count: 5 })
1070 expect(body.total).to.equal(1) 1070 expect(body.total).to.equal(1)
1071 1071
1072 expect(finder(body.data)).to.be.undefined 1072 expect(finder(body.data)).to.be.undefined
@@ -1076,7 +1076,7 @@ describe('Test video playlists', function () {
1076 it('Should delete a channel and put the associated playlist in private mode', async function () { 1076 it('Should delete a channel and put the associated playlist in private mode', async function () {
1077 this.timeout(30000) 1077 this.timeout(30000)
1078 1078
1079 const channel = await servers[0].channelsCommand.create({ attributes: { name: 'super_channel', displayName: 'super channel' } }) 1079 const channel = await servers[0].channels.create({ attributes: { name: 'super_channel', displayName: 'super channel' } })
1080 1080
1081 const playlistCreated = await commands[0].create({ 1081 const playlistCreated = await commands[0].create({
1082 attributes: { 1082 attributes: {
@@ -1088,7 +1088,7 @@ describe('Test video playlists', function () {
1088 1088
1089 await waitJobs(servers) 1089 await waitJobs(servers)
1090 1090
1091 await servers[0].channelsCommand.delete({ channelName: 'super_channel' }) 1091 await servers[0].channels.delete({ channelName: 'super_channel' })
1092 1092
1093 await waitJobs(servers) 1093 await waitJobs(servers)
1094 1094
@@ -1096,15 +1096,15 @@ describe('Test video playlists', function () {
1096 expect(body.displayName).to.equal('channel playlist') 1096 expect(body.displayName).to.equal('channel playlist')
1097 expect(body.privacy.id).to.equal(VideoPlaylistPrivacy.PRIVATE) 1097 expect(body.privacy.id).to.equal(VideoPlaylistPrivacy.PRIVATE)
1098 1098
1099 await servers[1].playlistsCommand.get({ playlistId: playlistCreated.uuid, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 1099 await servers[1].playlists.get({ playlistId: playlistCreated.uuid, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
1100 }) 1100 })
1101 1101
1102 it('Should delete an account and delete its playlists', async function () { 1102 it('Should delete an account and delete its playlists', async function () {
1103 this.timeout(30000) 1103 this.timeout(30000)
1104 1104
1105 const { userId, token } = await servers[0].usersCommand.generate('user_1') 1105 const { userId, token } = await servers[0].users.generate('user_1')
1106 1106
1107 const { videoChannels } = await servers[0].usersCommand.getMyInfo({ token }) 1107 const { videoChannels } = await servers[0].users.getMyInfo({ token })
1108 const userChannel = videoChannels[0] 1108 const userChannel = videoChannels[0]
1109 1109
1110 await commands[0].create({ 1110 await commands[0].create({
@@ -1121,18 +1121,18 @@ describe('Test video playlists', function () {
1121 1121
1122 { 1122 {
1123 for (const server of [ servers[0], servers[1] ]) { 1123 for (const server of [ servers[0], servers[1] ]) {
1124 const body = await server.playlistsCommand.list({ start: 0, count: 15 }) 1124 const body = await server.playlists.list({ start: 0, count: 15 })
1125 1125
1126 expect(finder(body.data)).to.not.be.undefined 1126 expect(finder(body.data)).to.not.be.undefined
1127 } 1127 }
1128 } 1128 }
1129 1129
1130 await servers[0].usersCommand.remove({ userId }) 1130 await servers[0].users.remove({ userId })
1131 await waitJobs(servers) 1131 await waitJobs(servers)
1132 1132
1133 { 1133 {
1134 for (const server of [ servers[0], servers[1] ]) { 1134 for (const server of [ servers[0], servers[1] ]) {
1135 const body = await server.playlistsCommand.list({ start: 0, count: 15 }) 1135 const body = await server.playlists.list({ start: 0, count: 15 })
1136 1136
1137 expect(finder(body.data)).to.be.undefined 1137 expect(finder(body.data)).to.be.undefined
1138 } 1138 }
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts
index bcf431edb..de08a9e7b 100644
--- a/server/tests/api/videos/video-privacy.ts
+++ b/server/tests/api/videos/video-privacy.ts
@@ -52,28 +52,28 @@ describe('Test video privacy', function () {
52 52
53 for (const privacy of [ VideoPrivacy.PRIVATE, VideoPrivacy.INTERNAL ]) { 53 for (const privacy of [ VideoPrivacy.PRIVATE, VideoPrivacy.INTERNAL ]) {
54 const attributes = { privacy } 54 const attributes = { privacy }
55 await servers[0].videosCommand.upload({ attributes }) 55 await servers[0].videos.upload({ attributes })
56 } 56 }
57 57
58 await waitJobs(servers) 58 await waitJobs(servers)
59 }) 59 })
60 60
61 it('Should not have these private and internal videos on server 2', async function () { 61 it('Should not have these private and internal videos on server 2', async function () {
62 const { total, data } = await servers[1].videosCommand.list() 62 const { total, data } = await servers[1].videos.list()
63 63
64 expect(total).to.equal(0) 64 expect(total).to.equal(0)
65 expect(data).to.have.lengthOf(0) 65 expect(data).to.have.lengthOf(0)
66 }) 66 })
67 67
68 it('Should not list the private and internal videos for an unauthenticated user on server 1', async function () { 68 it('Should not list the private and internal videos for an unauthenticated user on server 1', async function () {
69 const { total, data } = await servers[0].videosCommand.list() 69 const { total, data } = await servers[0].videos.list()
70 70
71 expect(total).to.equal(0) 71 expect(total).to.equal(0)
72 expect(data).to.have.lengthOf(0) 72 expect(data).to.have.lengthOf(0)
73 }) 73 })
74 74
75 it('Should not list the private video and list the internal video for an authenticated user on server 1', async function () { 75 it('Should not list the private video and list the internal video for an authenticated user on server 1', async function () {
76 const { total, data } = await servers[0].videosCommand.listWithToken() 76 const { total, data } = await servers[0].videos.listWithToken()
77 77
78 expect(total).to.equal(1) 78 expect(total).to.equal(1)
79 expect(data).to.have.lengthOf(1) 79 expect(data).to.have.lengthOf(1)
@@ -82,7 +82,7 @@ describe('Test video privacy', function () {
82 }) 82 })
83 83
84 it('Should list my (private and internal) videos', async function () { 84 it('Should list my (private and internal) videos', async function () {
85 const { total, data } = await servers[0].videosCommand.listMyVideos() 85 const { total, data } = await servers[0].videos.listMyVideos()
86 86
87 expect(total).to.equal(2) 87 expect(total).to.equal(2)
88 expect(data).to.have.lengthOf(2) 88 expect(data).to.have.lengthOf(2)
@@ -97,8 +97,8 @@ describe('Test video privacy', function () {
97 }) 97 })
98 98
99 it('Should not be able to watch the private/internal video with non authenticated user', async function () { 99 it('Should not be able to watch the private/internal video with non authenticated user', async function () {
100 await servers[0].videosCommand.get({ id: privateVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 100 await servers[0].videos.get({ id: privateVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
101 await servers[0].videosCommand.get({ id: internalVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 101 await servers[0].videos.get({ id: internalVideoUUID, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
102 }) 102 })
103 103
104 it('Should not be able to watch the private video with another user', async function () { 104 it('Should not be able to watch the private video with another user', async function () {
@@ -108,11 +108,11 @@ describe('Test video privacy', function () {
108 username: 'hello', 108 username: 'hello',
109 password: 'super password' 109 password: 'super password'
110 } 110 }
111 await servers[0].usersCommand.create({ username: user.username, password: user.password }) 111 await servers[0].users.create({ username: user.username, password: user.password })
112 112
113 anotherUserToken = await servers[0].loginCommand.getAccessToken(user) 113 anotherUserToken = await servers[0].login.getAccessToken(user)
114 114
115 await servers[0].videosCommand.getWithToken({ 115 await servers[0].videos.getWithToken({
116 token: anotherUserToken, 116 token: anotherUserToken,
117 id: privateVideoUUID, 117 id: privateVideoUUID,
118 expectedStatus: HttpStatusCode.FORBIDDEN_403 118 expectedStatus: HttpStatusCode.FORBIDDEN_403
@@ -120,11 +120,11 @@ describe('Test video privacy', function () {
120 }) 120 })
121 121
122 it('Should be able to watch the internal video with another user', async function () { 122 it('Should be able to watch the internal video with another user', async function () {
123 await servers[0].videosCommand.getWithToken({ token: anotherUserToken, id: internalVideoUUID }) 123 await servers[0].videos.getWithToken({ token: anotherUserToken, id: internalVideoUUID })
124 }) 124 })
125 125
126 it('Should be able to watch the private video with the correct user', async function () { 126 it('Should be able to watch the private video with the correct user', async function () {
127 await servers[0].videosCommand.getWithToken({ id: privateVideoUUID }) 127 await servers[0].videos.getWithToken({ id: privateVideoUUID })
128 }) 128 })
129 }) 129 })
130 130
@@ -137,7 +137,7 @@ describe('Test video privacy', function () {
137 name: 'unlisted video', 137 name: 'unlisted video',
138 privacy: VideoPrivacy.UNLISTED 138 privacy: VideoPrivacy.UNLISTED
139 } 139 }
140 await servers[1].videosCommand.upload({ attributes }) 140 await servers[1].videos.upload({ attributes })
141 141
142 // Server 2 has transcoding enabled 142 // Server 2 has transcoding enabled
143 await waitJobs(servers) 143 await waitJobs(servers)
@@ -145,7 +145,7 @@ describe('Test video privacy', function () {
145 145
146 it('Should not have this unlisted video listed on server 1 and 2', async function () { 146 it('Should not have this unlisted video listed on server 1 and 2', async function () {
147 for (const server of servers) { 147 for (const server of servers) {
148 const { total, data } = await server.videosCommand.list() 148 const { total, data } = await server.videos.list()
149 149
150 expect(total).to.equal(0) 150 expect(total).to.equal(0)
151 expect(data).to.have.lengthOf(0) 151 expect(data).to.have.lengthOf(0)
@@ -153,7 +153,7 @@ describe('Test video privacy', function () {
153 }) 153 })
154 154
155 it('Should list my (unlisted) videos', async function () { 155 it('Should list my (unlisted) videos', async function () {
156 const { total, data } = await servers[1].videosCommand.listMyVideos() 156 const { total, data } = await servers[1].videos.listMyVideos()
157 157
158 expect(total).to.equal(1) 158 expect(total).to.equal(1)
159 expect(data).to.have.lengthOf(1) 159 expect(data).to.have.lengthOf(1)
@@ -162,13 +162,13 @@ describe('Test video privacy', function () {
162 }) 162 })
163 163
164 it('Should not be able to get this unlisted video using its id', async function () { 164 it('Should not be able to get this unlisted video using its id', async function () {
165 await servers[1].videosCommand.get({ id: unlistedVideo.id, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 165 await servers[1].videos.get({ id: unlistedVideo.id, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
166 }) 166 })
167 167
168 it('Should be able to get this unlisted video using its uuid/shortUUID', async function () { 168 it('Should be able to get this unlisted video using its uuid/shortUUID', async function () {
169 for (const server of servers) { 169 for (const server of servers) {
170 for (const id of [ unlistedVideo.uuid, unlistedVideo.shortUUID ]) { 170 for (const id of [ unlistedVideo.uuid, unlistedVideo.shortUUID ]) {
171 const video = await server.videosCommand.get({ id }) 171 const video = await server.videos.get({ id })
172 172
173 expect(video.name).to.equal('unlisted video') 173 expect(video.name).to.equal('unlisted video')
174 } 174 }
@@ -182,13 +182,13 @@ describe('Test video privacy', function () {
182 name: 'unlisted video', 182 name: 'unlisted video',
183 privacy: VideoPrivacy.UNLISTED 183 privacy: VideoPrivacy.UNLISTED
184 } 184 }
185 await servers[0].videosCommand.upload({ attributes }) 185 await servers[0].videos.upload({ attributes })
186 186
187 await waitJobs(servers) 187 await waitJobs(servers)
188 }) 188 })
189 189
190 it('Should list my new unlisted video', async function () { 190 it('Should list my new unlisted video', async function () {
191 const { total, data } = await servers[0].videosCommand.listMyVideos() 191 const { total, data } = await servers[0].videos.listMyVideos()
192 192
193 expect(total).to.equal(3) 193 expect(total).to.equal(3)
194 expect(data).to.have.lengthOf(3) 194 expect(data).to.have.lengthOf(3)
@@ -197,13 +197,13 @@ describe('Test video privacy', function () {
197 }) 197 })
198 198
199 it('Should be able to get non-federated unlisted video from origin', async function () { 199 it('Should be able to get non-federated unlisted video from origin', async function () {
200 const video = await servers[0].videosCommand.get({ id: nonFederatedUnlistedVideoUUID }) 200 const video = await servers[0].videos.get({ id: nonFederatedUnlistedVideoUUID })
201 201
202 expect(video.name).to.equal('unlisted video') 202 expect(video.name).to.equal('unlisted video')
203 }) 203 })
204 204
205 it('Should not be able to get non-federated unlisted video from federated server', async function () { 205 it('Should not be able to get non-federated unlisted video from federated server', async function () {
206 await servers[1].videosCommand.get({ id: nonFederatedUnlistedVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 206 await servers[1].videos.get({ id: nonFederatedUnlistedVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
207 }) 207 })
208 }) 208 })
209 209
@@ -220,7 +220,7 @@ describe('Test video privacy', function () {
220 privacy: VideoPrivacy.PUBLIC 220 privacy: VideoPrivacy.PUBLIC
221 } 221 }
222 222
223 await servers[0].videosCommand.update({ id: privateVideoId, attributes }) 223 await servers[0].videos.update({ id: privateVideoId, attributes })
224 } 224 }
225 225
226 { 226 {
@@ -228,7 +228,7 @@ describe('Test video privacy', function () {
228 name: 'internal video becomes public', 228 name: 'internal video becomes public',
229 privacy: VideoPrivacy.PUBLIC 229 privacy: VideoPrivacy.PUBLIC
230 } 230 }
231 await servers[0].videosCommand.update({ id: internalVideoId, attributes }) 231 await servers[0].videos.update({ id: internalVideoId, attributes })
232 } 232 }
233 233
234 await waitJobs(servers) 234 await waitJobs(servers)
@@ -236,7 +236,7 @@ describe('Test video privacy', function () {
236 236
237 it('Should have this new public video listed on server 1 and 2', async function () { 237 it('Should have this new public video listed on server 1 and 2', async function () {
238 for (const server of servers) { 238 for (const server of servers) {
239 const { total, data } = await server.videosCommand.list() 239 const { total, data } = await server.videos.list()
240 expect(total).to.equal(2) 240 expect(total).to.equal(2)
241 expect(data).to.have.lengthOf(2) 241 expect(data).to.have.lengthOf(2)
242 242
@@ -258,20 +258,20 @@ describe('Test video privacy', function () {
258 it('Should set these videos as private and internal', async function () { 258 it('Should set these videos as private and internal', async function () {
259 this.timeout(10000) 259 this.timeout(10000)
260 260
261 await servers[0].videosCommand.update({ id: internalVideoId, attributes: { privacy: VideoPrivacy.PRIVATE } }) 261 await servers[0].videos.update({ id: internalVideoId, attributes: { privacy: VideoPrivacy.PRIVATE } })
262 await servers[0].videosCommand.update({ id: privateVideoId, attributes: { privacy: VideoPrivacy.INTERNAL } }) 262 await servers[0].videos.update({ id: privateVideoId, attributes: { privacy: VideoPrivacy.INTERNAL } })
263 263
264 await waitJobs(servers) 264 await waitJobs(servers)
265 265
266 for (const server of servers) { 266 for (const server of servers) {
267 const { total, data } = await server.videosCommand.list() 267 const { total, data } = await server.videos.list()
268 268
269 expect(total).to.equal(0) 269 expect(total).to.equal(0)
270 expect(data).to.have.lengthOf(0) 270 expect(data).to.have.lengthOf(0)
271 } 271 }
272 272
273 { 273 {
274 const { total, data } = await servers[0].videosCommand.listMyVideos() 274 const { total, data } = await servers[0].videos.listMyVideos()
275 expect(total).to.equal(3) 275 expect(total).to.equal(3)
276 expect(data).to.have.lengthOf(3) 276 expect(data).to.have.lengthOf(3)
277 277
diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts
index 635ae6ff1..3938b47c8 100644
--- a/server/tests/api/videos/video-schedule-update.ts
+++ b/server/tests/api/videos/video-schedule-update.ts
@@ -49,25 +49,25 @@ describe('Test video update scheduler', function () {
49 } 49 }
50 } 50 }
51 51
52 await servers[0].videosCommand.upload({ attributes }) 52 await servers[0].videos.upload({ attributes })
53 53
54 await waitJobs(servers) 54 await waitJobs(servers)
55 }) 55 })
56 56
57 it('Should not list the video (in privacy mode)', async function () { 57 it('Should not list the video (in privacy mode)', async function () {
58 for (const server of servers) { 58 for (const server of servers) {
59 const { total } = await server.videosCommand.list() 59 const { total } = await server.videos.list()
60 60
61 expect(total).to.equal(0) 61 expect(total).to.equal(0)
62 } 62 }
63 }) 63 })
64 64
65 it('Should have my scheduled video in my account videos', async function () { 65 it('Should have my scheduled video in my account videos', async function () {
66 const { total, data } = await servers[0].videosCommand.listMyVideos() 66 const { total, data } = await servers[0].videos.listMyVideos()
67 expect(total).to.equal(1) 67 expect(total).to.equal(1)
68 68
69 const videoFromList = data[0] 69 const videoFromList = data[0]
70 const videoFromGet = await servers[0].videosCommand.getWithToken({ id: videoFromList.uuid }) 70 const videoFromGet = await servers[0].videos.getWithToken({ id: videoFromList.uuid })
71 71
72 for (const video of [ videoFromList, videoFromGet ]) { 72 for (const video of [ videoFromList, videoFromGet ]) {
73 expect(video.name).to.equal('video 1') 73 expect(video.name).to.equal('video 1')
@@ -84,7 +84,7 @@ describe('Test video update scheduler', function () {
84 await waitJobs(servers) 84 await waitJobs(servers)
85 85
86 for (const server of servers) { 86 for (const server of servers) {
87 const { total, data } = await server.videosCommand.list() 87 const { total, data } = await server.videos.list()
88 88
89 expect(total).to.equal(1) 89 expect(total).to.equal(1)
90 expect(data[0].name).to.equal('video 1') 90 expect(data[0].name).to.equal('video 1')
@@ -99,7 +99,7 @@ describe('Test video update scheduler', function () {
99 privacy: VideoPrivacy.PRIVATE 99 privacy: VideoPrivacy.PRIVATE
100 } 100 }
101 101
102 const { uuid } = await servers[0].videosCommand.upload({ attributes }) 102 const { uuid } = await servers[0].videos.upload({ attributes })
103 video2UUID = uuid 103 video2UUID = uuid
104 104
105 await waitJobs(servers) 105 await waitJobs(servers)
@@ -116,20 +116,20 @@ describe('Test video update scheduler', function () {
116 } 116 }
117 } 117 }
118 118
119 await servers[0].videosCommand.update({ id: video2UUID, attributes }) 119 await servers[0].videos.update({ id: video2UUID, attributes })
120 await waitJobs(servers) 120 await waitJobs(servers)
121 }) 121 })
122 122
123 it('Should not display the updated video', async function () { 123 it('Should not display the updated video', async function () {
124 for (const server of servers) { 124 for (const server of servers) {
125 const { total } = await server.videosCommand.list() 125 const { total } = await server.videos.list()
126 126
127 expect(total).to.equal(1) 127 expect(total).to.equal(1)
128 } 128 }
129 }) 129 })
130 130
131 it('Should have my scheduled updated video in my account videos', async function () { 131 it('Should have my scheduled updated video in my account videos', async function () {
132 const { total, data } = await servers[0].videosCommand.listMyVideos() 132 const { total, data } = await servers[0].videos.listMyVideos()
133 expect(total).to.equal(2) 133 expect(total).to.equal(2)
134 134
135 const video = data.find(v => v.uuid === video2UUID) 135 const video = data.find(v => v.uuid === video2UUID)
@@ -149,7 +149,7 @@ describe('Test video update scheduler', function () {
149 await waitJobs(servers) 149 await waitJobs(servers)
150 150
151 for (const server of servers) { 151 for (const server of servers) {
152 const { total, data } = await server.videosCommand.list() 152 const { total, data } = await server.videos.list()
153 expect(total).to.equal(2) 153 expect(total).to.equal(2)
154 154
155 const video = data.find(v => v.uuid === video2UUID) 155 const video = data.find(v => v.uuid === video2UUID)
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts
index b41c68283..37450eeeb 100644
--- a/server/tests/api/videos/video-transcoder.ts
+++ b/server/tests/api/videos/video-transcoder.ts
@@ -32,7 +32,7 @@ import {
32const expect = chai.expect 32const expect = chai.expect
33 33
34function updateConfigForTranscoding (server: ServerInfo) { 34function updateConfigForTranscoding (server: ServerInfo) {
35 return server.configCommand.updateCustomSubConfig({ 35 return server.config.updateCustomSubConfig({
36 newConfig: { 36 newConfig: {
37 transcoding: { 37 transcoding: {
38 enabled: true, 38 enabled: true,
@@ -82,15 +82,15 @@ describe('Test video transcoding', function () {
82 description: 'my super description for server 1', 82 description: 'my super description for server 1',
83 fixture: 'video_short.webm' 83 fixture: 'video_short.webm'
84 } 84 }
85 await servers[0].videosCommand.upload({ attributes }) 85 await servers[0].videos.upload({ attributes })
86 86
87 await waitJobs(servers) 87 await waitJobs(servers)
88 88
89 for (const server of servers) { 89 for (const server of servers) {
90 const { data } = await server.videosCommand.list() 90 const { data } = await server.videos.list()
91 const video = data[0] 91 const video = data[0]
92 92
93 const videoDetails = await server.videosCommand.get({ id: video.id }) 93 const videoDetails = await server.videos.get({ id: video.id })
94 expect(videoDetails.files).to.have.lengthOf(1) 94 expect(videoDetails.files).to.have.lengthOf(1)
95 95
96 const magnetUri = videoDetails.files[0].magnetUri 96 const magnetUri = videoDetails.files[0].magnetUri
@@ -111,15 +111,15 @@ describe('Test video transcoding', function () {
111 description: 'my super description for server 2', 111 description: 'my super description for server 2',
112 fixture: 'video_short.webm' 112 fixture: 'video_short.webm'
113 } 113 }
114 await servers[1].videosCommand.upload({ attributes }) 114 await servers[1].videos.upload({ attributes })
115 115
116 await waitJobs(servers) 116 await waitJobs(servers)
117 117
118 for (const server of servers) { 118 for (const server of servers) {
119 const { data } = await server.videosCommand.list() 119 const { data } = await server.videos.list()
120 120
121 const video = data.find(v => v.name === attributes.name) 121 const video = data.find(v => v.name === attributes.name)
122 const videoDetails = await server.videosCommand.get({ id: video.id }) 122 const videoDetails = await server.videos.get({ id: video.id })
123 123
124 expect(videoDetails.files).to.have.lengthOf(4) 124 expect(videoDetails.files).to.have.lengthOf(4)
125 125
@@ -143,11 +143,11 @@ describe('Test video transcoding', function () {
143 fixture: 'video_short1.webm', 143 fixture: 'video_short1.webm',
144 waitTranscoding: true 144 waitTranscoding: true
145 } 145 }
146 const { uuid } = await servers[1].videosCommand.upload({ attributes }) 146 const { uuid } = await servers[1].videos.upload({ attributes })
147 const videoId = uuid 147 const videoId = uuid
148 148
149 // Should be in transcode state 149 // Should be in transcode state
150 const body = await servers[1].videosCommand.get({ id: videoId }) 150 const body = await servers[1].videos.get({ id: videoId })
151 expect(body.name).to.equal('waiting video') 151 expect(body.name).to.equal('waiting video')
152 expect(body.state.id).to.equal(VideoState.TO_TRANSCODE) 152 expect(body.state.id).to.equal(VideoState.TO_TRANSCODE)
153 expect(body.state.label).to.equal('To transcode') 153 expect(body.state.label).to.equal('To transcode')
@@ -155,7 +155,7 @@ describe('Test video transcoding', function () {
155 155
156 { 156 {
157 // Should have my video 157 // Should have my video
158 const { data } = await servers[1].videosCommand.listMyVideos() 158 const { data } = await servers[1].videos.listMyVideos()
159 const videoToFindInMine = data.find(v => v.name === attributes.name) 159 const videoToFindInMine = data.find(v => v.name === attributes.name)
160 expect(videoToFindInMine).not.to.be.undefined 160 expect(videoToFindInMine).not.to.be.undefined
161 expect(videoToFindInMine.state.id).to.equal(VideoState.TO_TRANSCODE) 161 expect(videoToFindInMine.state.id).to.equal(VideoState.TO_TRANSCODE)
@@ -165,23 +165,23 @@ describe('Test video transcoding', function () {
165 165
166 { 166 {
167 // Should not list this video 167 // Should not list this video
168 const { data } = await servers[1].videosCommand.list() 168 const { data } = await servers[1].videos.list()
169 const videoToFindInList = data.find(v => v.name === attributes.name) 169 const videoToFindInList = data.find(v => v.name === attributes.name)
170 expect(videoToFindInList).to.be.undefined 170 expect(videoToFindInList).to.be.undefined
171 } 171 }
172 172
173 // Server 1 should not have the video yet 173 // Server 1 should not have the video yet
174 await servers[0].videosCommand.get({ id: videoId, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) 174 await servers[0].videos.get({ id: videoId, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
175 } 175 }
176 176
177 await waitJobs(servers) 177 await waitJobs(servers)
178 178
179 for (const server of servers) { 179 for (const server of servers) {
180 const { data } = await server.videosCommand.list() 180 const { data } = await server.videos.list()
181 const videoToFind = data.find(v => v.name === 'waiting video') 181 const videoToFind = data.find(v => v.name === 'waiting video')
182 expect(videoToFind).not.to.be.undefined 182 expect(videoToFind).not.to.be.undefined
183 183
184 const videoDetails = await server.videosCommand.get({ id: videoToFind.id }) 184 const videoDetails = await server.videos.get({ id: videoToFind.id })
185 185
186 expect(videoDetails.state.id).to.equal(VideoState.PUBLISHED) 186 expect(videoDetails.state.id).to.equal(VideoState.PUBLISHED)
187 expect(videoDetails.state.label).to.equal('Published') 187 expect(videoDetails.state.label).to.equal('Published')
@@ -207,15 +207,15 @@ describe('Test video transcoding', function () {
207 fixture 207 fixture
208 } 208 }
209 209
210 await servers[1].videosCommand.upload({ attributes }) 210 await servers[1].videos.upload({ attributes })
211 211
212 await waitJobs(servers) 212 await waitJobs(servers)
213 213
214 for (const server of servers) { 214 for (const server of servers) {
215 const { data } = await server.videosCommand.list() 215 const { data } = await server.videos.list()
216 216
217 const video = data.find(v => v.name === attributes.name) 217 const video = data.find(v => v.name === attributes.name)
218 const videoDetails = await server.videosCommand.get({ id: video.id }) 218 const videoDetails = await server.videos.get({ id: video.id })
219 expect(videoDetails.files).to.have.lengthOf(4) 219 expect(videoDetails.files).to.have.lengthOf(4)
220 220
221 const magnetUri = videoDetails.files[0].magnetUri 221 const magnetUri = videoDetails.files[0].magnetUri
@@ -232,7 +232,7 @@ describe('Test video transcoding', function () {
232 fixture: 'video_short_4k.mp4' 232 fixture: 'video_short_4k.mp4'
233 } 233 }
234 234
235 const { uuid } = await servers[1].videosCommand.upload({ attributes }) 235 const { uuid } = await servers[1].videos.upload({ attributes })
236 video4k = uuid 236 video4k = uuid
237 237
238 await waitJobs(servers) 238 await waitJobs(servers)
@@ -240,7 +240,7 @@ describe('Test video transcoding', function () {
240 const resolutions = [ 240, 360, 480, 720, 1080, 1440, 2160 ] 240 const resolutions = [ 240, 360, 480, 720, 1080, 1440, 2160 ]
241 241
242 for (const server of servers) { 242 for (const server of servers) {
243 const videoDetails = await server.videosCommand.get({ id: video4k }) 243 const videoDetails = await server.videos.get({ id: video4k })
244 expect(videoDetails.files).to.have.lengthOf(resolutions.length) 244 expect(videoDetails.files).to.have.lengthOf(resolutions.length)
245 245
246 for (const r of resolutions) { 246 for (const r of resolutions) {
@@ -260,19 +260,19 @@ describe('Test video transcoding', function () {
260 name: 'mp3_256k', 260 name: 'mp3_256k',
261 fixture: 'video_short_mp3_256k.mp4' 261 fixture: 'video_short_mp3_256k.mp4'
262 } 262 }
263 await servers[1].videosCommand.upload({ attributes }) 263 await servers[1].videos.upload({ attributes })
264 264
265 await waitJobs(servers) 265 await waitJobs(servers)
266 266
267 for (const server of servers) { 267 for (const server of servers) {
268 const { data } = await server.videosCommand.list() 268 const { data } = await server.videos.list()
269 269
270 const video = data.find(v => v.name === attributes.name) 270 const video = data.find(v => v.name === attributes.name)
271 const videoDetails = await server.videosCommand.get({ id: video.id }) 271 const videoDetails = await server.videos.get({ id: video.id })
272 272
273 expect(videoDetails.files).to.have.lengthOf(4) 273 expect(videoDetails.files).to.have.lengthOf(4)
274 274
275 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-240.mp4')) 275 const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-240.mp4'))
276 const probe = await getAudioStream(path) 276 const probe = await getAudioStream(path)
277 277
278 if (probe.audioStream) { 278 if (probe.audioStream) {
@@ -291,18 +291,18 @@ describe('Test video transcoding', function () {
291 name: 'no_audio', 291 name: 'no_audio',
292 fixture: 'video_short_no_audio.mp4' 292 fixture: 'video_short_no_audio.mp4'
293 } 293 }
294 await servers[1].videosCommand.upload({ attributes }) 294 await servers[1].videos.upload({ attributes })
295 295
296 await waitJobs(servers) 296 await waitJobs(servers)
297 297
298 for (const server of servers) { 298 for (const server of servers) {
299 const { data } = await server.videosCommand.list() 299 const { data } = await server.videos.list()
300 300
301 const video = data.find(v => v.name === attributes.name) 301 const video = data.find(v => v.name === attributes.name)
302 const videoDetails = await server.videosCommand.get({ id: video.id }) 302 const videoDetails = await server.videos.get({ id: video.id })
303 303
304 expect(videoDetails.files).to.have.lengthOf(4) 304 expect(videoDetails.files).to.have.lengthOf(4)
305 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-240.mp4')) 305 const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-240.mp4'))
306 const probe = await getAudioStream(path) 306 const probe = await getAudioStream(path)
307 expect(probe).to.not.have.property('audioStream') 307 expect(probe).to.not.have.property('audioStream')
308 } 308 }
@@ -315,21 +315,21 @@ describe('Test video transcoding', function () {
315 name: 'untouched_audio', 315 name: 'untouched_audio',
316 fixture: 'video_short.mp4' 316 fixture: 'video_short.mp4'
317 } 317 }
318 await servers[1].videosCommand.upload({ attributes }) 318 await servers[1].videos.upload({ attributes })
319 319
320 await waitJobs(servers) 320 await waitJobs(servers)
321 321
322 for (const server of servers) { 322 for (const server of servers) {
323 const { data } = await server.videosCommand.list() 323 const { data } = await server.videos.list()
324 324
325 const video = data.find(v => v.name === attributes.name) 325 const video = data.find(v => v.name === attributes.name)
326 const videoDetails = await server.videosCommand.get({ id: video.id }) 326 const videoDetails = await server.videos.get({ id: video.id })
327 327
328 expect(videoDetails.files).to.have.lengthOf(4) 328 expect(videoDetails.files).to.have.lengthOf(4)
329 329
330 const fixturePath = buildAbsoluteFixturePath(attributes.fixture) 330 const fixturePath = buildAbsoluteFixturePath(attributes.fixture)
331 const fixtureVideoProbe = await getAudioStream(fixturePath) 331 const fixtureVideoProbe = await getAudioStream(fixturePath)
332 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-240.mp4')) 332 const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-240.mp4'))
333 333
334 const videoProbe = await getAudioStream(path) 334 const videoProbe = await getAudioStream(path)
335 335
@@ -348,7 +348,7 @@ describe('Test video transcoding', function () {
348 function runSuite (mode: 'legacy' | 'resumable') { 348 function runSuite (mode: 'legacy' | 'resumable') {
349 349
350 before(async function () { 350 before(async function () {
351 await servers[1].configCommand.updateCustomSubConfig({ 351 await servers[1].config.updateCustomSubConfig({
352 newConfig: { 352 newConfig: {
353 transcoding: { 353 transcoding: {
354 hls: { enabled: true }, 354 hls: { enabled: true },
@@ -372,15 +372,15 @@ describe('Test video transcoding', function () {
372 this.timeout(60_000) 372 this.timeout(60_000)
373 373
374 const attributes = { name: 'audio_with_preview', previewfile: 'preview.jpg', fixture: 'sample.ogg' } 374 const attributes = { name: 'audio_with_preview', previewfile: 'preview.jpg', fixture: 'sample.ogg' }
375 await servers[1].videosCommand.upload({ attributes, mode }) 375 await servers[1].videos.upload({ attributes, mode })
376 376
377 await waitJobs(servers) 377 await waitJobs(servers)
378 378
379 for (const server of servers) { 379 for (const server of servers) {
380 const { data } = await server.videosCommand.list() 380 const { data } = await server.videos.list()
381 381
382 const video = data.find(v => v.name === 'audio_with_preview') 382 const video = data.find(v => v.name === 'audio_with_preview')
383 const videoDetails = await server.videosCommand.get({ id: video.id }) 383 const videoDetails = await server.videos.get({ id: video.id })
384 384
385 expect(videoDetails.files).to.have.lengthOf(1) 385 expect(videoDetails.files).to.have.lengthOf(1)
386 386
@@ -396,15 +396,15 @@ describe('Test video transcoding', function () {
396 this.timeout(60_000) 396 this.timeout(60_000)
397 397
398 const attributes = { name: 'audio_without_preview', fixture: 'sample.ogg' } 398 const attributes = { name: 'audio_without_preview', fixture: 'sample.ogg' }
399 await servers[1].videosCommand.upload({ attributes, mode }) 399 await servers[1].videos.upload({ attributes, mode })
400 400
401 await waitJobs(servers) 401 await waitJobs(servers)
402 402
403 for (const server of servers) { 403 for (const server of servers) {
404 const { data } = await server.videosCommand.list() 404 const { data } = await server.videos.list()
405 405
406 const video = data.find(v => v.name === 'audio_without_preview') 406 const video = data.find(v => v.name === 'audio_without_preview')
407 const videoDetails = await server.videosCommand.get({ id: video.id }) 407 const videoDetails = await server.videos.get({ id: video.id })
408 408
409 expect(videoDetails.files).to.have.lengthOf(1) 409 expect(videoDetails.files).to.have.lengthOf(1)
410 410
@@ -419,7 +419,7 @@ describe('Test video transcoding', function () {
419 it('Should upload an audio file and create an audio version only', async function () { 419 it('Should upload an audio file and create an audio version only', async function () {
420 this.timeout(60_000) 420 this.timeout(60_000)
421 421
422 await servers[1].configCommand.updateCustomSubConfig({ 422 await servers[1].config.updateCustomSubConfig({
423 newConfig: { 423 newConfig: {
424 transcoding: { 424 transcoding: {
425 hls: { enabled: true }, 425 hls: { enabled: true },
@@ -434,12 +434,12 @@ describe('Test video transcoding', function () {
434 }) 434 })
435 435
436 const attributes = { name: 'audio_with_preview', previewfile: 'preview.jpg', fixture: 'sample.ogg' } 436 const attributes = { name: 'audio_with_preview', previewfile: 'preview.jpg', fixture: 'sample.ogg' }
437 const { id } = await servers[1].videosCommand.upload({ attributes, mode }) 437 const { id } = await servers[1].videos.upload({ attributes, mode })
438 438
439 await waitJobs(servers) 439 await waitJobs(servers)
440 440
441 for (const server of servers) { 441 for (const server of servers) {
442 const videoDetails = await server.videosCommand.get({ id }) 442 const videoDetails = await server.videos.get({ id })
443 443
444 for (const files of [ videoDetails.files, videoDetails.streamingPlaylists[0].files ]) { 444 for (const files of [ videoDetails.files, videoDetails.streamingPlaylists[0].files ]) {
445 expect(files).to.have.lengthOf(2) 445 expect(files).to.have.lengthOf(2)
@@ -470,15 +470,15 @@ describe('Test video transcoding', function () {
470 description: 'my super 30fps description for server 2', 470 description: 'my super 30fps description for server 2',
471 fixture: '60fps_720p_small.mp4' 471 fixture: '60fps_720p_small.mp4'
472 } 472 }
473 await servers[1].videosCommand.upload({ attributes }) 473 await servers[1].videos.upload({ attributes })
474 474
475 await waitJobs(servers) 475 await waitJobs(servers)
476 476
477 for (const server of servers) { 477 for (const server of servers) {
478 const { data } = await server.videosCommand.list() 478 const { data } = await server.videos.list()
479 479
480 const video = data.find(v => v.name === attributes.name) 480 const video = data.find(v => v.name === attributes.name)
481 const videoDetails = await server.videosCommand.get({ id: video.id }) 481 const videoDetails = await server.videos.get({ id: video.id })
482 482
483 expect(videoDetails.files).to.have.lengthOf(4) 483 expect(videoDetails.files).to.have.lengthOf(4)
484 expect(videoDetails.files[0].fps).to.be.above(58).and.below(62) 484 expect(videoDetails.files[0].fps).to.be.above(58).and.below(62)
@@ -487,13 +487,13 @@ describe('Test video transcoding', function () {
487 expect(videoDetails.files[3].fps).to.be.below(31) 487 expect(videoDetails.files[3].fps).to.be.below(31)
488 488
489 for (const resolution of [ '240', '360', '480' ]) { 489 for (const resolution of [ '240', '360', '480' ]) {
490 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-' + resolution + '.mp4')) 490 const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-' + resolution + '.mp4'))
491 const fps = await getVideoFileFPS(path) 491 const fps = await getVideoFileFPS(path)
492 492
493 expect(fps).to.be.below(31) 493 expect(fps).to.be.below(31)
494 } 494 }
495 495
496 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-720.mp4')) 496 const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-720.mp4'))
497 const fps = await getVideoFileFPS(path) 497 const fps = await getVideoFileFPS(path)
498 498
499 expect(fps).to.be.above(58).and.below(62) 499 expect(fps).to.be.above(58).and.below(62)
@@ -518,23 +518,23 @@ describe('Test video transcoding', function () {
518 fixture: tempFixturePath 518 fixture: tempFixturePath
519 } 519 }
520 520
521 await servers[1].videosCommand.upload({ attributes }) 521 await servers[1].videos.upload({ attributes })
522 522
523 await waitJobs(servers) 523 await waitJobs(servers)
524 524
525 for (const server of servers) { 525 for (const server of servers) {
526 const { data } = await server.videosCommand.list() 526 const { data } = await server.videos.list()
527 527
528 const video = data.find(v => v.name === attributes.name) 528 const video = data.find(v => v.name === attributes.name)
529 529
530 { 530 {
531 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-240.mp4')) 531 const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-240.mp4'))
532 const fps = await getVideoFileFPS(path) 532 const fps = await getVideoFileFPS(path)
533 expect(fps).to.be.equal(25) 533 expect(fps).to.be.equal(25)
534 } 534 }
535 535
536 { 536 {
537 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-720.mp4')) 537 const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-720.mp4'))
538 const fps = await getVideoFileFPS(path) 538 const fps = await getVideoFileFPS(path)
539 expect(fps).to.be.equal(59) 539 expect(fps).to.be.equal(59)
540 } 540 }
@@ -561,17 +561,17 @@ describe('Test video transcoding', function () {
561 fixture: tempFixturePath 561 fixture: tempFixturePath
562 } 562 }
563 563
564 await servers[1].videosCommand.upload({ attributes }) 564 await servers[1].videos.upload({ attributes })
565 565
566 await waitJobs(servers) 566 await waitJobs(servers)
567 567
568 for (const server of servers) { 568 for (const server of servers) {
569 const { data } = await server.videosCommand.list() 569 const { data } = await server.videos.list()
570 570
571 const video = data.find(v => v.name === attributes.name) 571 const video = data.find(v => v.name === attributes.name)
572 572
573 for (const resolution of [ '240', '360', '480', '720', '1080' ]) { 573 for (const resolution of [ '240', '360', '480', '720', '1080' ]) {
574 const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-' + resolution + '.mp4')) 574 const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-' + resolution + '.mp4'))
575 575
576 const bitrate = await getVideoFileBitrate(path) 576 const bitrate = await getVideoFileBitrate(path)
577 const fps = await getVideoFileFPS(path) 577 const fps = await getVideoFileFPS(path)
@@ -602,21 +602,21 @@ describe('Test video transcoding', function () {
602 hls: { enabled: true } 602 hls: { enabled: true }
603 } 603 }
604 } 604 }
605 await servers[1].configCommand.updateCustomSubConfig({ newConfig }) 605 await servers[1].config.updateCustomSubConfig({ newConfig })
606 606
607 const attributes = { 607 const attributes = {
608 name: 'low bitrate', 608 name: 'low bitrate',
609 fixture: 'low-bitrate.mp4' 609 fixture: 'low-bitrate.mp4'
610 } 610 }
611 611
612 const { uuid } = await servers[1].videosCommand.upload({ attributes }) 612 const { uuid } = await servers[1].videos.upload({ attributes })
613 613
614 await waitJobs(servers) 614 await waitJobs(servers)
615 615
616 const resolutions = [ 240, 360, 480, 720, 1080 ] 616 const resolutions = [ 240, 360, 480, 720, 1080 ]
617 for (const r of resolutions) { 617 for (const r of resolutions) {
618 const path = `videos/${uuid}-${r}.mp4` 618 const path = `videos/${uuid}-${r}.mp4`
619 const size = await servers[1].serversCommand.getServerFileSize(path) 619 const size = await servers[1].servers.getServerFileSize(path)
620 expect(size, `${path} not below ${60_000}`).to.be.below(60_000) 620 expect(size, `${path} not below ${60_000}`).to.be.below(60_000)
621 } 621 }
622 }) 622 })
@@ -627,11 +627,11 @@ describe('Test video transcoding', function () {
627 it('Should provide valid ffprobe data', async function () { 627 it('Should provide valid ffprobe data', async function () {
628 this.timeout(160_000) 628 this.timeout(160_000)
629 629
630 const videoUUID = (await servers[1].videosCommand.quickUpload({ name: 'ffprobe data' })).uuid 630 const videoUUID = (await servers[1].videos.quickUpload({ name: 'ffprobe data' })).uuid
631 await waitJobs(servers) 631 await waitJobs(servers)
632 632
633 { 633 {
634 const path = servers[1].serversCommand.buildDirectory(join('videos', videoUUID + '-240.mp4')) 634 const path = servers[1].servers.buildDirectory(join('videos', videoUUID + '-240.mp4'))
635 const metadata = await getMetadataFromFile(path) 635 const metadata = await getMetadataFromFile(path)
636 636
637 // expected format properties 637 // expected format properties
@@ -661,7 +661,7 @@ describe('Test video transcoding', function () {
661 } 661 }
662 662
663 for (const server of servers) { 663 for (const server of servers) {
664 const videoDetails = await server.videosCommand.get({ id: videoUUID }) 664 const videoDetails = await server.videos.get({ id: videoUUID })
665 665
666 const videoFiles = videoDetails.files 666 const videoFiles = videoDetails.files
667 .concat(videoDetails.streamingPlaylists[0].files) 667 .concat(videoDetails.streamingPlaylists[0].files)
@@ -673,7 +673,7 @@ describe('Test video transcoding', function () {
673 expect(file.metadataUrl).to.contain(servers[1].url) 673 expect(file.metadataUrl).to.contain(servers[1].url)
674 expect(file.metadataUrl).to.contain(videoUUID) 674 expect(file.metadataUrl).to.contain(videoUUID)
675 675
676 const metadata = await server.videosCommand.getFileMetadata({ url: file.metadataUrl }) 676 const metadata = await server.videos.getFileMetadata({ url: file.metadataUrl })
677 expect(metadata).to.have.nested.property('format.size') 677 expect(metadata).to.have.nested.property('format.size')
678 } 678 }
679 } 679 }
@@ -690,7 +690,7 @@ describe('Test video transcoding', function () {
690 describe('Transcoding job queue', function () { 690 describe('Transcoding job queue', function () {
691 691
692 it('Should have the appropriate priorities for transcoding jobs', async function () { 692 it('Should have the appropriate priorities for transcoding jobs', async function () {
693 const body = await servers[1].jobsCommand.getJobsList({ 693 const body = await servers[1].jobs.getJobsList({
694 start: 0, 694 start: 0,
695 count: 100, 695 count: 100,
696 sort: '-createdAt', 696 sort: '-createdAt',
diff --git a/server/tests/api/videos/videos-filter.ts b/server/tests/api/videos/videos-filter.ts
index 4a5a83ee6..af1541dbd 100644
--- a/server/tests/api/videos/videos-filter.ts
+++ b/server/tests/api/videos/videos-filter.ts
@@ -55,19 +55,19 @@ describe('Test videos filter', function () {
55 55
56 for (const server of servers) { 56 for (const server of servers) {
57 const moderator = { username: 'moderator', password: 'my super password' } 57 const moderator = { username: 'moderator', password: 'my super password' }
58 await server.usersCommand.create({ username: moderator.username, password: moderator.password, role: UserRole.MODERATOR }) 58 await server.users.create({ username: moderator.username, password: moderator.password, role: UserRole.MODERATOR })
59 server['moderatorAccessToken'] = await server.loginCommand.getAccessToken(moderator) 59 server['moderatorAccessToken'] = await server.login.getAccessToken(moderator)
60 60
61 await server.videosCommand.upload({ attributes: { name: 'public ' + server.serverNumber } }) 61 await server.videos.upload({ attributes: { name: 'public ' + server.serverNumber } })
62 62
63 { 63 {
64 const attributes = { name: 'unlisted ' + server.serverNumber, privacy: VideoPrivacy.UNLISTED } 64 const attributes = { name: 'unlisted ' + server.serverNumber, privacy: VideoPrivacy.UNLISTED }
65 await server.videosCommand.upload({ attributes }) 65 await server.videos.upload({ attributes })
66 } 66 }
67 67
68 { 68 {
69 const attributes = { name: 'private ' + server.serverNumber, privacy: VideoPrivacy.PRIVATE } 69 const attributes = { name: 'private ' + server.serverNumber, privacy: VideoPrivacy.PRIVATE }
70 await server.videosCommand.upload({ attributes }) 70 await server.videos.upload({ attributes })
71 } 71 }
72 } 72 }
73 73
diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts
index 8614078f1..4b5e581d1 100644
--- a/server/tests/api/videos/videos-history.ts
+++ b/server/tests/api/videos/videos-history.ts
@@ -33,20 +33,20 @@ describe('Test videos history', function () {
33 33
34 await setAccessTokensToServers([ server ]) 34 await setAccessTokensToServers([ server ])
35 35
36 command = server.historyCommand 36 command = server.history
37 37
38 { 38 {
39 const { uuid } = await server.videosCommand.upload({ attributes: { name: 'video 1' } }) 39 const { uuid } = await server.videos.upload({ attributes: { name: 'video 1' } })
40 video1UUID = uuid 40 video1UUID = uuid
41 } 41 }
42 42
43 { 43 {
44 const { uuid } = await server.videosCommand.upload({ attributes: { name: 'video 2' } }) 44 const { uuid } = await server.videos.upload({ attributes: { name: 'video 2' } })
45 video2UUID = uuid 45 video2UUID = uuid
46 } 46 }
47 47
48 { 48 {
49 const { uuid } = await server.videosCommand.upload({ attributes: { name: 'video 3' } }) 49 const { uuid } = await server.videos.upload({ attributes: { name: 'video 3' } })
50 video3UUID = uuid 50 video3UUID = uuid
51 } 51 }
52 52
@@ -54,15 +54,15 @@ describe('Test videos history', function () {
54 username: 'user_1', 54 username: 'user_1',
55 password: 'super password' 55 password: 'super password'
56 } 56 }
57 await server.usersCommand.create({ username: user.username, password: user.password }) 57 await server.users.create({ username: user.username, password: user.password })
58 userAccessToken = await server.loginCommand.getAccessToken(user) 58 userAccessToken = await server.login.getAccessToken(user)
59 }) 59 })
60 60
61 it('Should get videos, without watching history', async function () { 61 it('Should get videos, without watching history', async function () {
62 const { data } = await server.videosCommand.listWithToken() 62 const { data } = await server.videos.listWithToken()
63 63
64 for (const video of data) { 64 for (const video of data) {
65 const videoDetails = await server.videosCommand.getWithToken({ id: video.id }) 65 const videoDetails = await server.videos.getWithToken({ id: video.id })
66 66
67 expect(video.userHistory).to.be.undefined 67 expect(video.userHistory).to.be.undefined
68 expect(videoDetails.userHistory).to.be.undefined 68 expect(videoDetails.userHistory).to.be.undefined
@@ -78,12 +78,12 @@ describe('Test videos history', function () {
78 const videosOfVideos: Video[][] = [] 78 const videosOfVideos: Video[][] = []
79 79
80 { 80 {
81 const { data } = await server.videosCommand.listWithToken() 81 const { data } = await server.videos.listWithToken()
82 videosOfVideos.push(data) 82 videosOfVideos.push(data)
83 } 83 }
84 84
85 { 85 {
86 const body = await server.searchCommand.searchVideos({ token: server.accessToken, search: 'video' }) 86 const body = await server.search.searchVideos({ token: server.accessToken, search: 'video' })
87 videosOfVideos.push(body.data) 87 videosOfVideos.push(body.data)
88 } 88 }
89 89
@@ -102,21 +102,21 @@ describe('Test videos history', function () {
102 } 102 }
103 103
104 { 104 {
105 const videoDetails = await server.videosCommand.getWithToken({ id: video1UUID }) 105 const videoDetails = await server.videos.getWithToken({ id: video1UUID })
106 106
107 expect(videoDetails.userHistory).to.not.be.undefined 107 expect(videoDetails.userHistory).to.not.be.undefined
108 expect(videoDetails.userHistory.currentTime).to.equal(3) 108 expect(videoDetails.userHistory.currentTime).to.equal(3)
109 } 109 }
110 110
111 { 111 {
112 const videoDetails = await server.videosCommand.getWithToken({ id: video2UUID }) 112 const videoDetails = await server.videos.getWithToken({ id: video2UUID })
113 113
114 expect(videoDetails.userHistory).to.not.be.undefined 114 expect(videoDetails.userHistory).to.not.be.undefined
115 expect(videoDetails.userHistory.currentTime).to.equal(8) 115 expect(videoDetails.userHistory.currentTime).to.equal(8)
116 } 116 }
117 117
118 { 118 {
119 const videoDetails = await server.videosCommand.getWithToken({ id: video3UUID }) 119 const videoDetails = await server.videos.getWithToken({ id: video3UUID })
120 120
121 expect(videoDetails.userHistory).to.be.undefined 121 expect(videoDetails.userHistory).to.be.undefined
122 } 122 }
@@ -164,7 +164,7 @@ describe('Test videos history', function () {
164 }) 164 })
165 165
166 it('Should disable videos history', async function () { 166 it('Should disable videos history', async function () {
167 await server.usersCommand.updateMe({ 167 await server.users.updateMe({
168 videosHistoryEnabled: false 168 videosHistoryEnabled: false
169 }) 169 })
170 170
@@ -172,7 +172,7 @@ describe('Test videos history', function () {
172 }) 172 })
173 173
174 it('Should re-enable videos history', async function () { 174 it('Should re-enable videos history', async function () {
175 await server.usersCommand.updateMe({ 175 await server.users.updateMe({
176 videosHistoryEnabled: true 176 videosHistoryEnabled: true
177 }) 177 })
178 178
diff --git a/server/tests/api/videos/videos-overview.ts b/server/tests/api/videos/videos-overview.ts
index 969393842..f0657b334 100644
--- a/server/tests/api/videos/videos-overview.ts
+++ b/server/tests/api/videos/videos-overview.ts
@@ -25,7 +25,7 @@ describe('Test a videos overview', function () {
25 }) 25 })
26 26
27 it('Should send empty overview', async function () { 27 it('Should send empty overview', async function () {
28 const body = await server.overviewsCommand.getVideos({ page: 1 }) 28 const body = await server.overviews.getVideos({ page: 1 })
29 29
30 testOverviewCount(body, 0) 30 testOverviewCount(body, 0)
31 }) 31 })
@@ -35,7 +35,7 @@ describe('Test a videos overview', function () {
35 35
36 await wait(3000) 36 await wait(3000)
37 37
38 await server.videosCommand.upload({ 38 await server.videos.upload({
39 attributes: { 39 attributes: {
40 name: 'video 0', 40 name: 'video 0',
41 category: 3, 41 category: 3,
@@ -43,7 +43,7 @@ describe('Test a videos overview', function () {
43 } 43 }
44 }) 44 })
45 45
46 const body = await server.overviewsCommand.getVideos({ page: 1 }) 46 const body = await server.overviews.getVideos({ page: 1 })
47 47
48 testOverviewCount(body, 0) 48 testOverviewCount(body, 0)
49 }) 49 })
@@ -53,7 +53,7 @@ describe('Test a videos overview', function () {
53 53
54 { 54 {
55 for (let i = 1; i < 6; i++) { 55 for (let i = 1; i < 6; i++) {
56 await server.videosCommand.upload({ 56 await server.videos.upload({
57 attributes: { 57 attributes: {
58 name: 'video ' + i, 58 name: 'video ' + i,
59 category: 3, 59 category: 3,
@@ -66,13 +66,13 @@ describe('Test a videos overview', function () {
66 } 66 }
67 67
68 { 68 {
69 const body = await server.overviewsCommand.getVideos({ page: 1 }) 69 const body = await server.overviews.getVideos({ page: 1 })
70 70
71 testOverviewCount(body, 1) 71 testOverviewCount(body, 1)
72 } 72 }
73 73
74 { 74 {
75 const overview = await server.overviewsCommand.getVideos({ page: 2 }) 75 const overview = await server.overviews.getVideos({ page: 2 })
76 76
77 expect(overview.tags).to.have.lengthOf(1) 77 expect(overview.tags).to.have.lengthOf(1)
78 expect(overview.categories).to.have.lengthOf(0) 78 expect(overview.categories).to.have.lengthOf(0)
@@ -81,8 +81,8 @@ describe('Test a videos overview', function () {
81 }) 81 })
82 82
83 it('Should have the correct overview', async function () { 83 it('Should have the correct overview', async function () {
84 const overview1 = await server.overviewsCommand.getVideos({ page: 1 }) 84 const overview1 = await server.overviews.getVideos({ page: 1 })
85 const overview2 = await server.overviewsCommand.getVideos({ page: 2 }) 85 const overview2 = await server.overviews.getVideos({ page: 2 })
86 86
87 for (const arr of [ overview1.tags, overview1.categories, overview1.channels, overview2.tags ]) { 87 for (const arr of [ overview1.tags, overview1.categories, overview1.channels, overview2.tags ]) {
88 expect(arr).to.have.lengthOf(1) 88 expect(arr).to.have.lengthOf(1)
@@ -108,18 +108,18 @@ describe('Test a videos overview', function () {
108 }) 108 })
109 109
110 it('Should hide muted accounts', async function () { 110 it('Should hide muted accounts', async function () {
111 const token = await server.usersCommand.generateUserAndToken('choco') 111 const token = await server.users.generateUserAndToken('choco')
112 112
113 await server.blocklistCommand.addToMyBlocklist({ token, account: 'root@' + server.host }) 113 await server.blocklist.addToMyBlocklist({ token, account: 'root@' + server.host })
114 114
115 { 115 {
116 const body = await server.overviewsCommand.getVideos({ page: 1 }) 116 const body = await server.overviews.getVideos({ page: 1 })
117 117
118 testOverviewCount(body, 1) 118 testOverviewCount(body, 1)
119 } 119 }
120 120
121 { 121 {
122 const body = await server.overviewsCommand.getVideos({ page: 1, token }) 122 const body = await server.overviews.getVideos({ page: 1, token })
123 123
124 testOverviewCount(body, 0) 124 testOverviewCount(body, 0)
125 } 125 }
diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts
index 7ded1bf38..238662cf3 100644
--- a/server/tests/api/videos/videos-views-cleaner.ts
+++ b/server/tests/api/videos/videos-views-cleaner.ts
@@ -30,15 +30,15 @@ describe('Test video views cleaner', function () {
30 30
31 await doubleFollow(servers[0], servers[1]) 31 await doubleFollow(servers[0], servers[1])
32 32
33 videoIdServer1 = (await servers[0].videosCommand.quickUpload({ name: 'video server 1' })).uuid 33 videoIdServer1 = (await servers[0].videos.quickUpload({ name: 'video server 1' })).uuid
34 videoIdServer2 = (await servers[1].videosCommand.quickUpload({ name: 'video server 2' })).uuid 34 videoIdServer2 = (await servers[1].videos.quickUpload({ name: 'video server 2' })).uuid
35 35
36 await waitJobs(servers) 36 await waitJobs(servers)
37 37
38 await servers[0].videosCommand.view({ id: videoIdServer1 }) 38 await servers[0].videos.view({ id: videoIdServer1 })
39 await servers[1].videosCommand.view({ id: videoIdServer1 }) 39 await servers[1].videos.view({ id: videoIdServer1 })
40 await servers[0].videosCommand.view({ id: videoIdServer2 }) 40 await servers[0].videos.view({ id: videoIdServer2 })
41 await servers[1].videosCommand.view({ id: videoIdServer2 }) 41 await servers[1].videos.view({ id: videoIdServer2 })
42 42
43 await waitJobs(servers) 43 await waitJobs(servers)
44 }) 44 })
@@ -56,14 +56,14 @@ describe('Test video views cleaner', function () {
56 56
57 { 57 {
58 for (const server of servers) { 58 for (const server of servers) {
59 const total = await server.sqlCommand.countVideoViewsOf(videoIdServer1) 59 const total = await server.sql.countVideoViewsOf(videoIdServer1)
60 expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views') 60 expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views')
61 } 61 }
62 } 62 }
63 63
64 { 64 {
65 for (const server of servers) { 65 for (const server of servers) {
66 const total = await server.sqlCommand.countVideoViewsOf(videoIdServer2) 66 const total = await server.sql.countVideoViewsOf(videoIdServer2)
67 expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views') 67 expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views')
68 } 68 }
69 } 69 }
@@ -82,16 +82,16 @@ describe('Test video views cleaner', function () {
82 82
83 { 83 {
84 for (const server of servers) { 84 for (const server of servers) {
85 const total = await server.sqlCommand.countVideoViewsOf(videoIdServer1) 85 const total = await server.sql.countVideoViewsOf(videoIdServer1)
86 expect(total).to.equal(2) 86 expect(total).to.equal(2)
87 } 87 }
88 } 88 }
89 89
90 { 90 {
91 const totalServer1 = await servers[0].sqlCommand.countVideoViewsOf(videoIdServer2) 91 const totalServer1 = await servers[0].sql.countVideoViewsOf(videoIdServer2)
92 expect(totalServer1).to.equal(0) 92 expect(totalServer1).to.equal(0)
93 93
94 const totalServer2 = await servers[1].sqlCommand.countVideoViewsOf(videoIdServer2) 94 const totalServer2 = await servers[1].sql.countVideoViewsOf(videoIdServer2)
95 expect(totalServer2).to.equal(2) 95 expect(totalServer2).to.equal(2)
96 } 96 }
97 }) 97 })