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[] = []
50 let videoChannelId: number
52 before(async function () {
55 servers = await flushAndRunMultipleServers(3)
57 // Get the access tokens
58 await setAccessTokensToServers(servers)
61 const videoChannel = {
62 displayName: 'my channel',
63 description: 'super channel'
65 await addVideoChannel(servers[ 0 ].url, servers[ 0 ].accessToken, videoChannel)
66 const channelRes = await getVideoChannelsList(servers[ 0 ].url, 0, 1)
67 videoChannelId = channelRes.body.data[ 0 ].id
70 // Server 1 and server 2 follow each other
71 await doubleFollow(servers[0], servers[1])
72 // Server 1 and server 3 follow each other
73 await doubleFollow(servers[0], servers[2])
74 // Server 2 and server 3 follow each other
75 await doubleFollow(servers[1], servers[2])
78 it('Should not have videos for all servers', async function () {
79 for (const server of servers) {
80 const res = await getVideosList(server.url)
81 const videos = res.body.data
82 expect(videos).to.be.an('array')
83 expect(videos.length).to.equal(0)
87 describe('Should upload the video and propagate on each server', function () {
88 it('Should upload the video on server 1 and propagate on each server', async function () {
91 const videoAttributes = {
92 name: 'my super name for server 1',
97 description: 'my super description for server 1',
98 support: 'my super support text for server 1',
99 tags: [ 'tag1p1', 'tag2p1' ],
100 channelId: videoChannelId,
101 fixture: 'video_short1.webm'
103 await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes)
107 // All servers should have this video
108 let publishedAt: string = null
109 for (const server of servers) {
110 const isLocal = server.url === 'http://localhost:9001'
111 const checkAttributes = {
112 name: 'my super name for server 1',
117 description: 'my super description for server 1',
118 support: 'my super support text for server 1',
121 host: 'localhost:9001'
126 tags: [ 'tag1p1', 'tag2p1' ],
127 privacy: VideoPrivacy.PUBLIC,
128 commentsEnabled: true,
131 description: 'super channel',
134 fixture: 'video_short1.webm',
143 const res = await getVideosList(server.url)
144 const videos = res.body.data
145 expect(videos).to.be.an('array')
146 expect(videos.length).to.equal(1)
147 const video = videos[0]
149 await completeVideoCheck(server.url, video, checkAttributes)
150 publishedAt = video.publishedAt
154 it('Should upload the video on server 2 and propagate on each server', async function () {
159 password: 'super_password'
161 await createUser(servers[1].url, servers[1].accessToken, user.username, user.password)
162 const userAccessToken = await userLogin(servers[1], user)
164 const videoAttributes = {
165 name: 'my super name for server 2',
170 description: 'my super description for server 2',
171 support: 'my super support text for server 2',
172 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
173 fixture: 'video_short2.webm',
174 thumbnailfile: 'thumbnail.jpg',
175 previewfile: 'preview.jpg'
177 await uploadVideo(servers[1].url, userAccessToken, videoAttributes)
182 // All servers should have this video
183 for (const server of servers) {
184 const isLocal = server.url === 'http://localhost:9002'
185 const checkAttributes = {
186 name: 'my super name for server 2',
191 description: 'my super description for server 2',
192 support: 'my super support text for server 2',
195 host: 'localhost:9002'
198 commentsEnabled: true,
200 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
201 privacy: VideoPrivacy.PUBLIC,
203 name: 'Default user1 channel',
204 description: 'super channel',
207 fixture: 'video_short2.webm',
226 thumbnailfile: 'thumbnail',
227 previewfile: 'preview'
230 const res = await getVideosList(server.url)
231 const videos = res.body.data
232 expect(videos).to.be.an('array')
233 expect(videos.length).to.equal(2)
234 const video = videos[1]
236 await completeVideoCheck(server.url, video, checkAttributes)
240 it('Should upload two videos on server 3 and propagate on each server', async function () {
243 const videoAttributes1 = {
244 name: 'my super name for server 3',
249 description: 'my super description for server 3',
250 support: 'my super support text for server 3',
252 fixture: 'video_short3.webm'
254 await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes1)
256 const videoAttributes2 = {
257 name: 'my super name for server 3-2',
262 description: 'my super description for server 3-2',
263 support: 'my super support text for server 3-2',
264 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
265 fixture: 'video_short.webm'
267 await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes2)
271 // All servers should have this video
272 for (const server of servers) {
273 const isLocal = server.url === 'http://localhost:9003'
274 const res = await getVideosList(server.url)
276 const videos = res.body.data
277 expect(videos).to.be.an('array')
278 expect(videos.length).to.equal(4)
280 // We not sure about the order of the two last uploads
283 if (videos[2].name === 'my super name for server 3') {
291 const checkAttributesVideo1 = {
292 name: 'my super name for server 3',
297 description: 'my super description for server 3',
298 support: 'my super support text for server 3',
301 host: 'localhost:9003'
305 commentsEnabled: true,
307 privacy: VideoPrivacy.PUBLIC,
309 name: 'Default root channel',
313 fixture: 'video_short3.webm',
321 await completeVideoCheck(server.url, video1, checkAttributesVideo1)
323 const checkAttributesVideo2 = {
324 name: 'my super name for server 3-2',
329 description: 'my super description for server 3-2',
330 support: 'my super support text for server 3-2',
333 host: 'localhost:9003'
335 commentsEnabled: true,
338 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
339 privacy: VideoPrivacy.PUBLIC,
341 name: 'Default root channel',
345 fixture: 'video_short.webm',
353 await completeVideoCheck(server.url, video2, checkAttributesVideo2)
358 describe('It should list local videos', function () {
359 it('Should list only local videos on server 1', async function () {
360 const { body } = await getLocalVideos(servers[0].url)
362 expect(body.total).to.equal(1)
363 expect(body.data).to.be.an('array')
364 expect(body.data.length).to.equal(1)
365 expect(body.data[0].name).to.equal('my super name for server 1')
368 it('Should list only local videos on server 2', async function () {
369 const { body } = await getLocalVideos(servers[1].url)
371 expect(body.total).to.equal(1)
372 expect(body.data).to.be.an('array')
373 expect(body.data.length).to.equal(1)
374 expect(body.data[0].name).to.equal('my super name for server 2')
377 it('Should list only local videos on server 3', async function () {
378 const { body } = await getLocalVideos(servers[2].url)
380 expect(body.total).to.equal(2)
381 expect(body.data).to.be.an('array')
382 expect(body.data.length).to.equal(2)
383 expect(body.data[0].name).to.equal('my super name for server 3')
384 expect(body.data[1].name).to.equal('my super name for server 3-2')
388 describe('Should seed the uploaded video', function () {
389 it('Should add the file 1 by asking server 3', async function () {
392 const res = await getVideosList(servers[2].url)
394 const video = res.body.data[0]
395 toRemove.push(res.body.data[2])
396 toRemove.push(res.body.data[3])
398 const res2 = await getVideo(servers[2].url, video.id)
399 const videoDetails = res2.body
401 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
402 expect(torrent.files).to.be.an('array')
403 expect(torrent.files.length).to.equal(1)
404 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
407 it('Should add the file 2 by asking server 1', async function () {
410 const res = await getVideosList(servers[0].url)
412 const video = res.body.data[1]
413 const res2 = await getVideo(servers[0].url, video.id)
414 const videoDetails = res2.body
416 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
417 expect(torrent.files).to.be.an('array')
418 expect(torrent.files.length).to.equal(1)
419 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
422 it('Should add the file 3 by asking server 2', async function () {
425 const res = await getVideosList(servers[1].url)
427 const video = res.body.data[2]
428 const res2 = await getVideo(servers[1].url, video.id)
429 const videoDetails = res2.body
431 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
432 expect(torrent.files).to.be.an('array')
433 expect(torrent.files.length).to.equal(1)
434 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
437 it('Should add the file 3-2 by asking server 1', async function () {
440 const res = await getVideosList(servers[0].url)
442 const video = res.body.data[3]
443 const res2 = await getVideo(servers[0].url, video.id)
444 const videoDetails = res2.body
446 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri)
447 expect(torrent.files).to.be.an('array')
448 expect(torrent.files.length).to.equal(1)
449 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
452 it('Should add the file 2 in 360p by asking server 1', async function () {
455 const res = await getVideosList(servers[0].url)
457 const video = res.body.data.find(v => v.name === 'my super name for server 2')
458 const res2 = await getVideo(servers[0].url, video.id)
459 const videoDetails = res2.body
461 const file = videoDetails.files.find(f => f.resolution.id === 360)
462 expect(file).not.to.be.undefined
464 const torrent = await webtorrentAdd(file.magnetUri)
465 expect(torrent.files).to.be.an('array')
466 expect(torrent.files.length).to.equal(1)
467 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
471 describe('Should update video views, likes and dislikes', function () {
472 let localVideosServer3 = []
473 let remoteVideosServer1 = []
474 let remoteVideosServer2 = []
475 let remoteVideosServer3 = []
477 before(async function () {
478 const res1 = await getVideosList(servers[0].url)
479 remoteVideosServer1 = res1.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
481 const res2 = await getVideosList(servers[1].url)
482 remoteVideosServer2 = res2.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
484 const res3 = await getVideosList(servers[2].url)
485 localVideosServer3 = res3.body.data.filter(video => video.isLocal === true).map(video => video.uuid)
486 remoteVideosServer3 = res3.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
489 it('Should view multiple videos on owned servers', async function () {
492 const tasks: Promise<any>[] = []
493 await viewVideo(servers[2].url, localVideosServer3[0])
494 await viewVideo(servers[2].url, localVideosServer3[0])
495 await viewVideo(servers[2].url, localVideosServer3[0])
496 await viewVideo(servers[2].url, localVideosServer3[1])
498 await Promise.all(tasks)
501 await viewVideo(servers[2].url, localVideosServer3[0])
505 await viewVideo(servers[2].url, localVideosServer3[0])
509 for (const server of servers) {
510 const res = await getVideosList(server.url)
512 const videos = res.body.data
513 const video0 = videos.find(v => v.uuid === localVideosServer3[0])
514 const video1 = videos.find(v => v.uuid === localVideosServer3[1])
516 expect(video0.views).to.equal(3)
517 expect(video1.views).to.equal(1)
521 it('Should view multiple videos on each servers', async function () {
524 const tasks: Promise<any>[] = []
525 tasks.push(viewVideo(servers[0].url, remoteVideosServer1[0]))
526 tasks.push(viewVideo(servers[1].url, remoteVideosServer2[0]))
527 tasks.push(viewVideo(servers[1].url, remoteVideosServer2[0]))
528 tasks.push(viewVideo(servers[2].url, remoteVideosServer3[0]))
529 tasks.push(viewVideo(servers[2].url, remoteVideosServer3[1]))
530 tasks.push(viewVideo(servers[2].url, remoteVideosServer3[1]))
531 tasks.push(viewVideo(servers[2].url, remoteVideosServer3[1]))
532 tasks.push(viewVideo(servers[2].url, localVideosServer3[1]))
533 tasks.push(viewVideo(servers[2].url, localVideosServer3[1]))
534 tasks.push(viewVideo(servers[2].url, localVideosServer3[1]))
536 await Promise.all(tasks)
540 let baseVideos = null
542 for (const server of servers) {
543 const res = await getVideosList(server.url)
545 const videos = res.body.data
547 // Initialize base videos for future comparisons
548 if (baseVideos === null) {
553 for (const baseVideo of baseVideos) {
554 const sameVideo = videos.find(video => video.name === baseVideo.name)
555 expect(baseVideo.views).to.equal(sameVideo.views)
560 it('Should like and dislikes videos on different services', async function () {
563 await rateVideo(servers[0].url, servers[0].accessToken, remoteVideosServer1[0], 'like')
565 await rateVideo(servers[0].url, servers[0].accessToken, remoteVideosServer1[0], 'dislike')
567 await rateVideo(servers[0].url, servers[0].accessToken, remoteVideosServer1[0], 'like')
568 await rateVideo(servers[2].url, servers[2].accessToken, localVideosServer3[1], 'like')
570 await rateVideo(servers[2].url, servers[2].accessToken, localVideosServer3[1], 'dislike')
571 await rateVideo(servers[2].url, servers[2].accessToken, remoteVideosServer3[1], 'dislike')
573 await rateVideo(servers[2].url, servers[2].accessToken, remoteVideosServer3[0], 'like')
577 let baseVideos = null
578 for (const server of servers) {
579 const res = await getVideosList(server.url)
581 const videos = res.body.data
583 // Initialize base videos for future comparisons
584 if (baseVideos === null) {
589 for (const baseVideo of baseVideos) {
590 const sameVideo = videos.find(video => video.name === baseVideo.name)
591 expect(baseVideo.likes).to.equal(sameVideo.likes)
592 expect(baseVideo.dislikes).to.equal(sameVideo.dislikes)
598 describe('Should manipulate these videos', function () {
599 it('Should update the video 3 by asking server 3', async function () {
603 name: 'my super video updated',
608 description: 'my super description updated',
609 support: 'my super support text updated',
610 tags: [ 'tag_up_1', 'tag_up_2' ],
611 thumbnailfile: 'thumbnail.jpg',
612 previewfile: 'preview.jpg'
615 await updateVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, attributes)
620 it('Should have the video 3 updated on each server', async function () {
623 for (const server of servers) {
624 const res = await getVideosList(server.url)
626 const videos = res.body.data
627 const videoUpdated = videos.find(video => video.name === 'my super video updated')
628 expect(!!videoUpdated).to.be.true
630 const isLocal = server.url === 'http://localhost:9003'
631 const checkAttributes = {
632 name: 'my super video updated',
637 description: 'my super description updated',
638 support: 'my super support text updated',
641 host: 'localhost:9003'
645 commentsEnabled: true,
646 tags: [ 'tag_up_1', 'tag_up_2' ],
647 privacy: VideoPrivacy.PUBLIC,
649 name: 'Default root channel',
653 fixture: 'video_short3.webm',
660 thumbnailfile: 'thumbnail',
661 previewfile: 'preview'
663 await completeVideoCheck(server.url, videoUpdated, checkAttributes)
667 it('Should remove the videos 3 and 3-2 by asking server 3', async function () {
670 await removeVideo(servers[2].url, servers[2].accessToken, toRemove[0].id)
671 await removeVideo(servers[2].url, servers[2].accessToken, toRemove[1].id)
676 it('Should not have files of videos 3 and 3-2 on each server', async function () {
677 for (const server of servers) {
678 await checkVideoFilesWereRemoved(toRemove[0].uuid, server.serverNumber)
679 await checkVideoFilesWereRemoved(toRemove[1].uuid, server.serverNumber)
683 it('Should have videos 1 and 3 on each server', async function () {
684 for (const server of servers) {
685 const res = await getVideosList(server.url)
687 const videos = res.body.data
688 expect(videos).to.be.an('array')
689 expect(videos.length).to.equal(2)
690 expect(videos[0].name).not.to.equal(videos[1].name)
691 expect(videos[0].name).not.to.equal(toRemove[0].name)
692 expect(videos[1].name).not.to.equal(toRemove[0].name)
693 expect(videos[0].name).not.to.equal(toRemove[1].name)
694 expect(videos[1].name).not.to.equal(toRemove[1].name)
696 videoUUID = videos.find(video => video.name === 'my super name for server 1').uuid
700 it('Should get the same video by UUID on each server', async function () {
702 for (const server of servers) {
703 const res = await getVideo(server.url, videoUUID)
705 const video = res.body
707 if (baseVideo === null) {
712 expect(baseVideo.name).to.equal(video.name)
713 expect(baseVideo.uuid).to.equal(video.uuid)
714 expect(baseVideo.category.id).to.equal(video.category.id)
715 expect(baseVideo.language.id).to.equal(video.language.id)
716 expect(baseVideo.licence.id).to.equal(video.licence.id)
717 expect(baseVideo.nsfw).to.equal(video.nsfw)
718 expect(baseVideo.account.name).to.equal(video.account.name)
719 expect(baseVideo.account.displayName).to.equal(video.account.displayName)
720 expect(baseVideo.account.url).to.equal(video.account.url)
721 expect(baseVideo.account.host).to.equal(video.account.host)
722 expect(baseVideo.tags).to.deep.equal(video.tags)
726 it('Should get the preview from each server', async function () {
727 for (const server of servers) {
728 const res = await getVideo(server.url, videoUUID)
729 const video = res.body
731 await testImage(server.url, 'video_short1-preview.webm', video.previewPath)
736 describe('Should comment these videos', function () {
737 let childOfFirstChild: VideoCommentThreadTree
739 it('Should add comment (threads and replies)', async function () {
743 const text = 'my super first comment'
744 await addVideoCommentThread(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID, text)
748 const text = 'my super second comment'
749 await addVideoCommentThread(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, text)
755 const res = await getVideoCommentThreads(servers[1].url, videoUUID, 0, 5)
756 const threadId = res.body.data.find(c => c.text === 'my super first comment').id
758 const text = 'my super answer to thread 1'
759 await addVideoCommentReply(servers[ 1 ].url, servers[ 1 ].accessToken, videoUUID, threadId, text)
765 const res1 = await getVideoCommentThreads(servers[2].url, videoUUID, 0, 5)
766 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
768 const res2 = await getVideoThreadComments(servers[2].url, videoUUID, threadId)
769 const childCommentId = res2.body.children[0].comment.id
771 const text3 = 'my second answer to thread 1'
772 await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, threadId, text3)
774 const text2 = 'my super answer to answer of thread 1'
775 await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, childCommentId, text2)
781 it('Should have these threads', async function () {
782 for (const server of servers) {
783 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
785 expect(res.body.total).to.equal(2)
786 expect(res.body.data).to.be.an('array')
787 expect(res.body.data).to.have.lengthOf(2)
790 const comment: VideoComment = res.body.data.find(c => c.text === 'my super first comment')
791 expect(comment).to.not.be.undefined
792 expect(comment.inReplyToCommentId).to.be.null
793 expect(comment.account.name).to.equal('root')
794 expect(comment.account.host).to.equal('localhost:9001')
795 expect(comment.totalReplies).to.equal(3)
796 expect(dateIsValid(comment.createdAt as string)).to.be.true
797 expect(dateIsValid(comment.updatedAt as string)).to.be.true
801 const comment: VideoComment = res.body.data.find(c => c.text === 'my super second comment')
802 expect(comment).to.not.be.undefined
803 expect(comment.inReplyToCommentId).to.be.null
804 expect(comment.account.name).to.equal('root')
805 expect(comment.account.host).to.equal('localhost:9003')
806 expect(comment.totalReplies).to.equal(0)
807 expect(dateIsValid(comment.createdAt as string)).to.be.true
808 expect(dateIsValid(comment.updatedAt as string)).to.be.true
813 it('Should have these comments', async function () {
814 for (const server of servers) {
815 const res1 = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
816 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
818 const res2 = await getVideoThreadComments(server.url, videoUUID, threadId)
820 const tree: VideoCommentThreadTree = res2.body
821 expect(tree.comment.text).equal('my super first comment')
822 expect(tree.comment.account.name).equal('root')
823 expect(tree.comment.account.host).equal('localhost:9001')
824 expect(tree.children).to.have.lengthOf(2)
826 const firstChild = tree.children[0]
827 expect(firstChild.comment.text).to.equal('my super answer to thread 1')
828 expect(firstChild.comment.account.name).equal('root')
829 expect(firstChild.comment.account.host).equal('localhost:9002')
830 expect(firstChild.children).to.have.lengthOf(1)
832 childOfFirstChild = firstChild.children[0]
833 expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1')
834 expect(childOfFirstChild.comment.account.name).equal('root')
835 expect(childOfFirstChild.comment.account.host).equal('localhost:9003')
836 expect(childOfFirstChild.children).to.have.lengthOf(0)
838 const secondChild = tree.children[1]
839 expect(secondChild.comment.text).to.equal('my second answer to thread 1')
840 expect(secondChild.comment.account.name).equal('root')
841 expect(secondChild.comment.account.host).equal('localhost:9003')
842 expect(secondChild.children).to.have.lengthOf(0)
846 it('Should delete a reply', async function () {
849 await deleteVideoComment(servers[2].url, servers[2].accessToken, videoUUID, childOfFirstChild.comment.id)
854 it('Should not have this comment anymore', async function () {
855 for (const server of servers) {
856 const res1 = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
857 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
859 const res2 = await getVideoThreadComments(server.url, videoUUID, threadId)
861 const tree: VideoCommentThreadTree = res2.body
862 expect(tree.comment.text).equal('my super first comment')
864 const firstChild = tree.children[0]
865 expect(firstChild.comment.text).to.equal('my super answer to thread 1')
866 expect(firstChild.children).to.have.lengthOf(0)
868 const secondChild = tree.children[1]
869 expect(secondChild.comment.text).to.equal('my second answer to thread 1')
873 it('Should delete the thread comments', async function () {
876 const res1 = await getVideoCommentThreads(servers[0].url, videoUUID, 0, 5)
877 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
878 await deleteVideoComment(servers[0].url, servers[0].accessToken, videoUUID, threadId)
883 it('Should have the thread comments deleted on other servers too', async function () {
884 for (const server of servers) {
885 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
887 expect(res.body.total).to.equal(1)
888 expect(res.body.data).to.be.an('array')
889 expect(res.body.data).to.have.lengthOf(1)
892 const comment: VideoComment = res.body.data[0]
893 expect(comment).to.not.be.undefined
894 expect(comment.inReplyToCommentId).to.be.null
895 expect(comment.account.name).to.equal('root')
896 expect(comment.account.host).to.equal('localhost:9003')
897 expect(comment.totalReplies).to.equal(0)
898 expect(dateIsValid(comment.createdAt as string)).to.be.true
899 expect(dateIsValid(comment.updatedAt as string)).to.be.true
904 it('Should disable comments', async function () {
908 commentsEnabled: false
911 await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, attributes)
915 for (const server of servers) {
916 const res = await getVideo(server.url, videoUUID)
917 expect(res.body.commentsEnabled).to.be.false
919 const text = 'my super forbidden comment'
920 await addVideoCommentThread(server.url, server.accessToken, videoUUID, text, 409)
925 describe('With minimum parameters', function () {
926 it('Should upload and propagate the video', async function () {
929 const path = '/api/v1/videos/upload'
931 const req = request(servers[1].url)
933 .set('Accept', 'application/json')
934 .set('Authorization', 'Bearer ' + servers[1].accessToken)
935 .field('name', 'minimum parameters')
936 .field('privacy', '1')
937 .field('nsfw', 'false')
938 .field('channelId', '1')
939 .field('commentsEnabled', 'true')
941 const filePath = join(__dirname, '..', '..', 'api', 'fixtures', 'video_short.webm')
943 await req.attach('videofile', filePath)
948 for (const server of servers) {
949 const res = await getVideosList(server.url)
950 const video = res.body.data.find(v => v.name === 'minimum parameters')
952 const isLocal = server.url === 'http://localhost:9002'
953 const checkAttributes = {
954 name: 'minimum parameters',
963 host: 'localhost:9002'
967 commentsEnabled: true,
969 privacy: VideoPrivacy.PUBLIC,
971 name: 'Default root channel',
975 fixture: 'video_short.webm',
995 await completeVideoCheck(server.url, video, checkAttributes)
1000 after(async function () {
1001 killallServers(servers)
1003 // Keep the logs if the test failed