aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/multiple-servers.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos/multiple-servers.ts')
-rw-r--r--server/tests/api/videos/multiple-servers.ts168
1 files changed, 84 insertions, 84 deletions
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