1 /* tslint:disable:no-unused-expression */
3 import * as chai from 'chai'
5 import { join } from 'path'
6 import * as request from 'supertest'
7 import { VideoPrivacy } from '../../../../shared/models/videos'
8 import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
12 checkVideoFilesWereRemoved,
17 flushAndRunMultipleServers,
18 flushTests, getLocalVideos,
26 setAccessTokensToServers,
37 addVideoCommentThread,
39 getVideoCommentThreads,
40 getVideoThreadComments
41 } from '../../utils/videos/video-comments'
42 import { getAccountsList } from '../../utils/users/accounts'
44 const expect = chai.expect
46 describe('Test multiple servers', function () {
47 let servers: ServerInfo[] = []
51 let videoChannelId: number
53 before(async function () {
56 servers = await flushAndRunMultipleServers(3)
58 // Get the access tokens
59 await setAccessTokensToServers(servers)
62 const res = await getAccountsList(servers[0].url)
63 accountId = res.body.data[0].id
67 const videoChannel = {
69 description: 'super channel'
71 await addVideoChannel(servers[ 0 ].url, servers[ 0 ].accessToken, accountId, videoChannel)
72 const channelRes = await getVideoChannelsList(servers[ 0 ].url, 0, 1)
73 videoChannelId = channelRes.body.data[ 0 ].id
76 // Server 1 and server 2 follow each other
77 await doubleFollow(servers[0], servers[1])
78 // Server 1 and server 3 follow each other
79 await doubleFollow(servers[0], servers[2])
80 // Server 2 and server 3 follow each other
81 await doubleFollow(servers[1], servers[2])
84 it('Should not have videos for all servers', async function () {
85 for (const server of servers) {
86 const res = await getVideosList(server.url)
87 const videos = res.body.data
88 expect(videos).to.be.an('array')
89 expect(videos.length).to.equal(0)
93 describe('Should upload the video and propagate on each server', function () {
94 it('Should upload the video on server 1 and propagate on each server', async function () {
97 const videoAttributes = {
98 name: 'my super name for server 1',
103 description: 'my super description for server 1',
104 support: 'my super support text for server 1',
105 tags: [ 'tag1p1', 'tag2p1' ],
106 channelId: videoChannelId,
107 fixture: 'video_short1.webm'
109 await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes)
113 // All servers should have this video
114 for (const server of servers) {
115 const isLocal = server.url === 'http://localhost:9001'
116 const checkAttributes = {
117 name: 'my super name for server 1',
122 description: 'my super description for server 1',
123 support: 'my super support text for server 1',
126 host: 'localhost:9001'
130 tags: [ 'tag1p1', 'tag2p1' ],
131 privacy: VideoPrivacy.PUBLIC,
132 commentsEnabled: true,
135 description: 'super channel',
138 fixture: 'video_short1.webm',
147 const res = await getVideosList(server.url)
148 const videos = res.body.data
149 expect(videos).to.be.an('array')
150 expect(videos.length).to.equal(1)
151 const video = videos[0]
153 await completeVideoCheck(server.url, video, checkAttributes)
157 it('Should upload the video on server 2 and propagate on each server', async function () {
162 password: 'super_password'
164 await createUser(servers[1].url, servers[1].accessToken, user.username, user.password)
165 const userAccessToken = await userLogin(servers[1], user)
167 const videoAttributes = {
168 name: 'my super name for server 2',
173 description: 'my super description for server 2',
174 support: 'my super support text for server 2',
175 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
176 fixture: 'video_short2.webm',
177 thumbnailfile: 'thumbnail.jpg',
178 previewfile: 'preview.jpg'
180 await uploadVideo(servers[1].url, userAccessToken, videoAttributes)
185 // All servers should have this video
186 for (const server of servers) {
187 const isLocal = server.url === 'http://localhost:9002'
188 const checkAttributes = {
189 name: 'my super name for server 2',
194 description: 'my super description for server 2',
195 support: 'my super support text for server 2',
198 host: 'localhost:9002'
201 commentsEnabled: true,
203 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
204 privacy: VideoPrivacy.PUBLIC,
206 name: 'Default user1 channel',
207 description: 'super channel',
210 fixture: 'video_short2.webm',
229 thumbnailfile: 'thumbnail',
230 previewfile: 'preview'
233 const res = await getVideosList(server.url)
234 const videos = res.body.data
235 expect(videos).to.be.an('array')
236 expect(videos.length).to.equal(2)
237 const video = videos[1]
239 await completeVideoCheck(server.url, video, checkAttributes)
243 it('Should upload two videos on server 3 and propagate on each server', async function () {
246 const videoAttributes1 = {
247 name: 'my super name for server 3',
252 description: 'my super description for server 3',
253 support: 'my super support text for server 3',
255 fixture: 'video_short3.webm'
257 await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes1)
259 const videoAttributes2 = {
260 name: 'my super name for server 3-2',
265 description: 'my super description for server 3-2',
266 support: 'my super support text for server 3-2',
267 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
268 fixture: 'video_short.webm'
270 await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes2)
274 // All servers should have this video
275 for (const server of servers) {
276 const isLocal = server.url === 'http://localhost:9003'
277 const res = await getVideosList(server.url)
279 const videos = res.body.data
280 expect(videos).to.be.an('array')
281 expect(videos.length).to.equal(4)
283 // We not sure about the order of the two last uploads
286 if (videos[2].name === 'my super name for server 3') {
294 const checkAttributesVideo1 = {
295 name: 'my super name for server 3',
300 description: 'my super description for server 3',
301 support: 'my super support text for server 3',
304 host: 'localhost:9003'
308 commentsEnabled: true,
310 privacy: VideoPrivacy.PUBLIC,
312 name: 'Default root channel',
316 fixture: 'video_short3.webm',
324 await completeVideoCheck(server.url, video1, checkAttributesVideo1)
326 const checkAttributesVideo2 = {
327 name: 'my super name for server 3-2',
332 description: 'my super description for server 3-2',
333 support: 'my super support text for server 3-2',
336 host: 'localhost:9003'
338 commentsEnabled: true,
341 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
342 privacy: VideoPrivacy.PUBLIC,
344 name: 'Default root channel',
348 fixture: 'video_short.webm',
356 await completeVideoCheck(server.url, video2, checkAttributesVideo2)
361 describe('It should list local videos', function () {
362 it('Should list only local videos on server 1', async function () {
363 const { body } = await getLocalVideos(servers[0].url)
365 expect(body.total).to.equal(1)
366 expect(body.data).to.be.an('array')
367 expect(body.data.length).to.equal(1)
368 expect(body.data[0].name).to.equal('my super name for server 1')
371 it('Should list only local videos on server 2', async function () {
372 const { body } = await getLocalVideos(servers[1].url)
374 expect(body.total).to.equal(1)
375 expect(body.data).to.be.an('array')
376 expect(body.data.length).to.equal(1)
377 expect(body.data[0].name).to.equal('my super name for server 2')
380 it('Should list only local videos on server 3', async function () {
381 const { body } = await getLocalVideos(servers[2].url)
383 expect(body.total).to.equal(2)
384 expect(body.data).to.be.an('array')
385 expect(body.data.length).to.equal(2)
386 expect(body.data[0].name).to.equal('my super name for server 3')
387 expect(body.data[1].name).to.equal('my super name for server 3-2')
391 describe('Should seed the uploaded video', function () {
392 it('Should add the file 1 by asking server 3', async function () {
395 const res = await getVideosList(servers[2].url)
397 const video = res.body.data[0]
398 toRemove.push(res.body.data[2])
399 toRemove.push(res.body.data[3])
401 const res2 = await getVideo(servers[2].url, video.id)
402 const videoDetails = res2.body
404 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
405 expect(torrent.files).to.be.an('array')
406 expect(torrent.files.length).to.equal(1)
407 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
410 it('Should add the file 2 by asking server 1', async function () {
413 const res = await getVideosList(servers[0].url)
415 const video = res.body.data[1]
416 const res2 = await getVideo(servers[0].url, video.id)
417 const videoDetails = res2.body
419 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
420 expect(torrent.files).to.be.an('array')
421 expect(torrent.files.length).to.equal(1)
422 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
425 it('Should add the file 3 by asking server 2', async function () {
428 const res = await getVideosList(servers[1].url)
430 const video = res.body.data[2]
431 const res2 = await getVideo(servers[1].url, video.id)
432 const videoDetails = res2.body
434 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
435 expect(torrent.files).to.be.an('array')
436 expect(torrent.files.length).to.equal(1)
437 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
440 it('Should add the file 3-2 by asking server 1', async function () {
443 const res = await getVideosList(servers[0].url)
445 const video = res.body.data[3]
446 const res2 = await getVideo(servers[0].url, video.id)
447 const videoDetails = res2.body
449 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri)
450 expect(torrent.files).to.be.an('array')
451 expect(torrent.files.length).to.equal(1)
452 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
455 it('Should add the file 2 in 360p by asking server 1', async function () {
458 const res = await getVideosList(servers[0].url)
460 const video = res.body.data.find(v => v.name === 'my super name for server 2')
461 const res2 = await getVideo(servers[0].url, video.id)
462 const videoDetails = res2.body
464 const file = videoDetails.files.find(f => f.resolution.id === 360)
465 expect(file).not.to.be.undefined
467 const torrent = await webtorrentAdd(file.magnetUri)
468 expect(torrent.files).to.be.an('array')
469 expect(torrent.files.length).to.equal(1)
470 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
474 describe('Should update video views, likes and dislikes', function () {
475 let localVideosServer3 = []
476 let remoteVideosServer1 = []
477 let remoteVideosServer2 = []
478 let remoteVideosServer3 = []
480 before(async function () {
481 const res1 = await getVideosList(servers[0].url)
482 remoteVideosServer1 = res1.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
484 const res2 = await getVideosList(servers[1].url)
485 remoteVideosServer2 = res2.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
487 const res3 = await getVideosList(servers[2].url)
488 localVideosServer3 = res3.body.data.filter(video => video.isLocal === true).map(video => video.uuid)
489 remoteVideosServer3 = res3.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
492 it('Should view multiple videos on owned servers', async function () {
495 const tasks: Promise<any>[] = []
496 await viewVideo(servers[2].url, localVideosServer3[0])
497 await viewVideo(servers[2].url, localVideosServer3[0])
498 await viewVideo(servers[2].url, localVideosServer3[0])
499 await viewVideo(servers[2].url, localVideosServer3[1])
501 await Promise.all(tasks)
504 await viewVideo(servers[2].url, localVideosServer3[0])
508 await viewVideo(servers[2].url, localVideosServer3[0])
512 for (const server of servers) {
513 const res = await getVideosList(server.url)
515 const videos = res.body.data
516 const video0 = videos.find(v => v.uuid === localVideosServer3[0])
517 const video1 = videos.find(v => v.uuid === localVideosServer3[1])
519 expect(video0.views).to.equal(3)
520 expect(video1.views).to.equal(1)
524 it('Should view multiple videos on each servers', async function () {
527 const tasks: Promise<any>[] = []
528 tasks.push(viewVideo(servers[0].url, remoteVideosServer1[0]))
529 tasks.push(viewVideo(servers[1].url, remoteVideosServer2[0]))
530 tasks.push(viewVideo(servers[1].url, remoteVideosServer2[0]))
531 tasks.push(viewVideo(servers[2].url, remoteVideosServer3[0]))
532 tasks.push(viewVideo(servers[2].url, remoteVideosServer3[1]))
533 tasks.push(viewVideo(servers[2].url, remoteVideosServer3[1]))
534 tasks.push(viewVideo(servers[2].url, remoteVideosServer3[1]))
535 tasks.push(viewVideo(servers[2].url, localVideosServer3[1]))
536 tasks.push(viewVideo(servers[2].url, localVideosServer3[1]))
537 tasks.push(viewVideo(servers[2].url, localVideosServer3[1]))
539 await Promise.all(tasks)
543 let baseVideos = null
545 for (const server of servers) {
546 const res = await getVideosList(server.url)
548 const videos = res.body.data
550 // Initialize base videos for future comparisons
551 if (baseVideos === null) {
556 for (const baseVideo of baseVideos) {
557 const sameVideo = videos.find(video => video.name === baseVideo.name)
558 expect(baseVideo.views).to.equal(sameVideo.views)
563 it('Should like and dislikes videos on different services', async function () {
566 await rateVideo(servers[0].url, servers[0].accessToken, remoteVideosServer1[0], 'like')
568 await rateVideo(servers[0].url, servers[0].accessToken, remoteVideosServer1[0], 'dislike')
570 await rateVideo(servers[0].url, servers[0].accessToken, remoteVideosServer1[0], 'like')
571 await rateVideo(servers[2].url, servers[2].accessToken, localVideosServer3[1], 'like')
573 await rateVideo(servers[2].url, servers[2].accessToken, localVideosServer3[1], 'dislike')
574 await rateVideo(servers[2].url, servers[2].accessToken, remoteVideosServer3[1], 'dislike')
576 await rateVideo(servers[2].url, servers[2].accessToken, remoteVideosServer3[0], 'like')
580 let baseVideos = null
581 for (const server of servers) {
582 const res = await getVideosList(server.url)
584 const videos = res.body.data
586 // Initialize base videos for future comparisons
587 if (baseVideos === null) {
592 for (const baseVideo of baseVideos) {
593 const sameVideo = videos.find(video => video.name === baseVideo.name)
594 expect(baseVideo.likes).to.equal(sameVideo.likes)
595 expect(baseVideo.dislikes).to.equal(sameVideo.dislikes)
601 describe('Should manipulate these videos', function () {
602 it('Should update the video 3 by asking server 3', async function () {
606 name: 'my super video updated',
611 description: 'my super description updated',
612 support: 'my super support text updated',
613 tags: [ 'tag_up_1', 'tag_up_2' ],
614 thumbnailfile: 'thumbnail.jpg',
615 previewfile: 'preview.jpg'
618 await updateVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, attributes)
623 it('Should have the video 3 updated on each server', async function () {
626 for (const server of servers) {
627 const res = await getVideosList(server.url)
629 const videos = res.body.data
630 const videoUpdated = videos.find(video => video.name === 'my super video updated')
631 expect(!!videoUpdated).to.be.true
633 const isLocal = server.url === 'http://localhost:9003'
634 const checkAttributes = {
635 name: 'my super video updated',
640 description: 'my super description updated',
641 support: 'my super support text updated',
644 host: 'localhost:9003'
648 commentsEnabled: true,
649 tags: [ 'tag_up_1', 'tag_up_2' ],
650 privacy: VideoPrivacy.PUBLIC,
652 name: 'Default root channel',
656 fixture: 'video_short3.webm',
663 thumbnailfile: 'thumbnail',
664 previewfile: 'preview'
666 await completeVideoCheck(server.url, videoUpdated, checkAttributes)
670 it('Should remove the videos 3 and 3-2 by asking server 3', async function () {
673 await removeVideo(servers[2].url, servers[2].accessToken, toRemove[0].id)
674 await removeVideo(servers[2].url, servers[2].accessToken, toRemove[1].id)
679 it('Should not have files of videos 3 and 3-2 on each server', async function () {
680 for (const server of servers) {
681 await checkVideoFilesWereRemoved(toRemove[0].uuid, server.serverNumber)
682 await checkVideoFilesWereRemoved(toRemove[1].uuid, server.serverNumber)
686 it('Should have videos 1 and 3 on each server', async function () {
687 for (const server of servers) {
688 const res = await getVideosList(server.url)
690 const videos = res.body.data
691 expect(videos).to.be.an('array')
692 expect(videos.length).to.equal(2)
693 expect(videos[0].name).not.to.equal(videos[1].name)
694 expect(videos[0].name).not.to.equal(toRemove[0].name)
695 expect(videos[1].name).not.to.equal(toRemove[0].name)
696 expect(videos[0].name).not.to.equal(toRemove[1].name)
697 expect(videos[1].name).not.to.equal(toRemove[1].name)
699 videoUUID = videos.find(video => video.name === 'my super name for server 1').uuid
703 it('Should get the same video by UUID on each server', async function () {
705 for (const server of servers) {
706 const res = await getVideo(server.url, videoUUID)
708 const video = res.body
710 if (baseVideo === null) {
715 expect(baseVideo.name).to.equal(video.name)
716 expect(baseVideo.uuid).to.equal(video.uuid)
717 expect(baseVideo.category.id).to.equal(video.category.id)
718 expect(baseVideo.language.id).to.equal(video.language.id)
719 expect(baseVideo.licence.id).to.equal(video.licence.id)
720 expect(baseVideo.nsfw).to.equal(video.nsfw)
721 expect(baseVideo.account.name).to.equal(video.account.name)
722 expect(baseVideo.account.displayName).to.equal(video.account.displayName)
723 expect(baseVideo.account.url).to.equal(video.account.url)
724 expect(baseVideo.account.host).to.equal(video.account.host)
725 expect(baseVideo.tags).to.deep.equal(video.tags)
729 it('Should get the preview from each server', async function () {
730 for (const server of servers) {
731 const res = await getVideo(server.url, videoUUID)
732 const video = res.body
734 await testImage(server.url, 'video_short1-preview.webm', video.previewPath)
739 describe('Should comment these videos', function () {
740 let childOfFirstChild: VideoCommentThreadTree
742 it('Should add comment (threads and replies)', async function () {
746 const text = 'my super first comment'
747 await addVideoCommentThread(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID, text)
751 const text = 'my super second comment'
752 await addVideoCommentThread(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, text)
758 const res = await getVideoCommentThreads(servers[1].url, videoUUID, 0, 5)
759 const threadId = res.body.data.find(c => c.text === 'my super first comment').id
761 const text = 'my super answer to thread 1'
762 await addVideoCommentReply(servers[ 1 ].url, servers[ 1 ].accessToken, videoUUID, threadId, text)
768 const res1 = await getVideoCommentThreads(servers[2].url, videoUUID, 0, 5)
769 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
771 const res2 = await getVideoThreadComments(servers[2].url, videoUUID, threadId)
772 const childCommentId = res2.body.children[0].comment.id
774 const text3 = 'my second answer to thread 1'
775 await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, threadId, text3)
777 const text2 = 'my super answer to answer of thread 1'
778 await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, childCommentId, text2)
784 it('Should have these threads', async function () {
785 for (const server of servers) {
786 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
788 expect(res.body.total).to.equal(2)
789 expect(res.body.data).to.be.an('array')
790 expect(res.body.data).to.have.lengthOf(2)
793 const comment: VideoComment = res.body.data.find(c => c.text === 'my super first comment')
794 expect(comment).to.not.be.undefined
795 expect(comment.inReplyToCommentId).to.be.null
796 expect(comment.account.name).to.equal('root')
797 expect(comment.account.host).to.equal('localhost:9001')
798 expect(comment.totalReplies).to.equal(3)
799 expect(dateIsValid(comment.createdAt as string)).to.be.true
800 expect(dateIsValid(comment.updatedAt as string)).to.be.true
804 const comment: VideoComment = res.body.data.find(c => c.text === 'my super second comment')
805 expect(comment).to.not.be.undefined
806 expect(comment.inReplyToCommentId).to.be.null
807 expect(comment.account.name).to.equal('root')
808 expect(comment.account.host).to.equal('localhost:9003')
809 expect(comment.totalReplies).to.equal(0)
810 expect(dateIsValid(comment.createdAt as string)).to.be.true
811 expect(dateIsValid(comment.updatedAt as string)).to.be.true
816 it('Should have these comments', async function () {
817 for (const server of servers) {
818 const res1 = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
819 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
821 const res2 = await getVideoThreadComments(server.url, videoUUID, threadId)
823 const tree: VideoCommentThreadTree = res2.body
824 expect(tree.comment.text).equal('my super first comment')
825 expect(tree.comment.account.name).equal('root')
826 expect(tree.comment.account.host).equal('localhost:9001')
827 expect(tree.children).to.have.lengthOf(2)
829 const firstChild = tree.children[0]
830 expect(firstChild.comment.text).to.equal('my super answer to thread 1')
831 expect(firstChild.comment.account.name).equal('root')
832 expect(firstChild.comment.account.host).equal('localhost:9002')
833 expect(firstChild.children).to.have.lengthOf(1)
835 childOfFirstChild = firstChild.children[0]
836 expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1')
837 expect(childOfFirstChild.comment.account.name).equal('root')
838 expect(childOfFirstChild.comment.account.host).equal('localhost:9003')
839 expect(childOfFirstChild.children).to.have.lengthOf(0)
841 const secondChild = tree.children[1]
842 expect(secondChild.comment.text).to.equal('my second answer to thread 1')
843 expect(secondChild.comment.account.name).equal('root')
844 expect(secondChild.comment.account.host).equal('localhost:9003')
845 expect(secondChild.children).to.have.lengthOf(0)
849 it('Should delete a reply', async function () {
852 await deleteVideoComment(servers[2].url, servers[2].accessToken, videoUUID, childOfFirstChild.comment.id)
857 it('Should not have this comment anymore', async function () {
858 for (const server of servers) {
859 const res1 = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
860 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
862 const res2 = await getVideoThreadComments(server.url, videoUUID, threadId)
864 const tree: VideoCommentThreadTree = res2.body
865 expect(tree.comment.text).equal('my super first comment')
867 const firstChild = tree.children[0]
868 expect(firstChild.comment.text).to.equal('my super answer to thread 1')
869 expect(firstChild.children).to.have.lengthOf(0)
871 const secondChild = tree.children[1]
872 expect(secondChild.comment.text).to.equal('my second answer to thread 1')
876 it('Should delete the thread comments', async function () {
879 const res1 = await getVideoCommentThreads(servers[0].url, videoUUID, 0, 5)
880 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
881 await deleteVideoComment(servers[0].url, servers[0].accessToken, videoUUID, threadId)
886 it('Should have the thread comments deleted on other servers too', async function () {
887 for (const server of servers) {
888 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
890 expect(res.body.total).to.equal(1)
891 expect(res.body.data).to.be.an('array')
892 expect(res.body.data).to.have.lengthOf(1)
895 const comment: VideoComment = res.body.data[0]
896 expect(comment).to.not.be.undefined
897 expect(comment.inReplyToCommentId).to.be.null
898 expect(comment.account.name).to.equal('root')
899 expect(comment.account.host).to.equal('localhost:9003')
900 expect(comment.totalReplies).to.equal(0)
901 expect(dateIsValid(comment.createdAt as string)).to.be.true
902 expect(dateIsValid(comment.updatedAt as string)).to.be.true
907 it('Should disable comments', async function () {
911 commentsEnabled: false
914 await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, attributes)
918 for (const server of servers) {
919 const res = await getVideo(server.url, videoUUID)
920 expect(res.body.commentsEnabled).to.be.false
922 const text = 'my super forbidden comment'
923 await addVideoCommentThread(server.url, server.accessToken, videoUUID, text, 409)
928 describe('With minimum parameters', function () {
929 it('Should upload and propagate the video', async function () {
932 const path = '/api/v1/videos/upload'
934 const req = request(servers[1].url)
936 .set('Accept', 'application/json')
937 .set('Authorization', 'Bearer ' + servers[1].accessToken)
938 .field('name', 'minimum parameters')
939 .field('privacy', '1')
940 .field('nsfw', 'false')
941 .field('channelId', '1')
942 .field('commentsEnabled', 'true')
944 const filePath = join(__dirname, '..', '..', 'api', 'fixtures', 'video_short.webm')
946 await req.attach('videofile', filePath)
951 for (const server of servers) {
952 const res = await getVideosList(server.url)
953 const video = res.body.data.find(v => v.name === 'minimum parameters')
955 const isLocal = server.url === 'http://localhost:9002'
956 const checkAttributes = {
957 name: 'minimum parameters',
966 host: 'localhost:9002'
970 commentsEnabled: true,
972 privacy: VideoPrivacy.PUBLIC,
974 name: 'Default root channel',
978 fixture: 'video_short.webm',
998 await completeVideoCheck(server.url, video, checkAttributes)
1003 after(async function () {
1004 killallServers(servers)
1006 // Keep the logs if the test failed