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 = {
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 for (const server of servers) {
109 const isLocal = server.url === 'http://localhost:9001'
110 const checkAttributes = {
111 name: 'my super name for server 1',
116 description: 'my super description for server 1',
117 support: 'my super support text for server 1',
120 host: 'localhost:9001'
124 tags: [ 'tag1p1', 'tag2p1' ],
125 privacy: VideoPrivacy.PUBLIC,
126 commentsEnabled: true,
129 description: 'super channel',
132 fixture: 'video_short1.webm',
141 const res = await getVideosList(server.url)
142 const videos = res.body.data
143 expect(videos).to.be.an('array')
144 expect(videos.length).to.equal(1)
145 const video = videos[0]
147 await completeVideoCheck(server.url, video, checkAttributes)
151 it('Should upload the video on server 2 and propagate on each server', async function () {
156 password: 'super_password'
158 await createUser(servers[1].url, servers[1].accessToken, user.username, user.password)
159 const userAccessToken = await userLogin(servers[1], user)
161 const videoAttributes = {
162 name: 'my super name for server 2',
167 description: 'my super description for server 2',
168 support: 'my super support text for server 2',
169 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
170 fixture: 'video_short2.webm',
171 thumbnailfile: 'thumbnail.jpg',
172 previewfile: 'preview.jpg'
174 await uploadVideo(servers[1].url, userAccessToken, videoAttributes)
179 // All servers should have this video
180 for (const server of servers) {
181 const isLocal = server.url === 'http://localhost:9002'
182 const checkAttributes = {
183 name: 'my super name for server 2',
188 description: 'my super description for server 2',
189 support: 'my super support text for server 2',
192 host: 'localhost:9002'
195 commentsEnabled: true,
197 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
198 privacy: VideoPrivacy.PUBLIC,
200 name: 'Default user1 channel',
201 description: 'super channel',
204 fixture: 'video_short2.webm',
223 thumbnailfile: 'thumbnail',
224 previewfile: 'preview'
227 const res = await getVideosList(server.url)
228 const videos = res.body.data
229 expect(videos).to.be.an('array')
230 expect(videos.length).to.equal(2)
231 const video = videos[1]
233 await completeVideoCheck(server.url, video, checkAttributes)
237 it('Should upload two videos on server 3 and propagate on each server', async function () {
240 const videoAttributes1 = {
241 name: 'my super name for server 3',
246 description: 'my super description for server 3',
247 support: 'my super support text for server 3',
249 fixture: 'video_short3.webm'
251 await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes1)
253 const videoAttributes2 = {
254 name: 'my super name for server 3-2',
259 description: 'my super description for server 3-2',
260 support: 'my super support text for server 3-2',
261 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
262 fixture: 'video_short.webm'
264 await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes2)
268 // All servers should have this video
269 for (const server of servers) {
270 const isLocal = server.url === 'http://localhost:9003'
271 const res = await getVideosList(server.url)
273 const videos = res.body.data
274 expect(videos).to.be.an('array')
275 expect(videos.length).to.equal(4)
277 // We not sure about the order of the two last uploads
280 if (videos[2].name === 'my super name for server 3') {
288 const checkAttributesVideo1 = {
289 name: 'my super name for server 3',
294 description: 'my super description for server 3',
295 support: 'my super support text for server 3',
298 host: 'localhost:9003'
302 commentsEnabled: true,
304 privacy: VideoPrivacy.PUBLIC,
306 name: 'Default root channel',
310 fixture: 'video_short3.webm',
318 await completeVideoCheck(server.url, video1, checkAttributesVideo1)
320 const checkAttributesVideo2 = {
321 name: 'my super name for server 3-2',
326 description: 'my super description for server 3-2',
327 support: 'my super support text for server 3-2',
330 host: 'localhost:9003'
332 commentsEnabled: true,
335 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
336 privacy: VideoPrivacy.PUBLIC,
338 name: 'Default root channel',
342 fixture: 'video_short.webm',
350 await completeVideoCheck(server.url, video2, checkAttributesVideo2)
355 describe('It should list local videos', function () {
356 it('Should list only local videos on server 1', async function () {
357 const { body } = await getLocalVideos(servers[0].url)
359 expect(body.total).to.equal(1)
360 expect(body.data).to.be.an('array')
361 expect(body.data.length).to.equal(1)
362 expect(body.data[0].name).to.equal('my super name for server 1')
365 it('Should list only local videos on server 2', async function () {
366 const { body } = await getLocalVideos(servers[1].url)
368 expect(body.total).to.equal(1)
369 expect(body.data).to.be.an('array')
370 expect(body.data.length).to.equal(1)
371 expect(body.data[0].name).to.equal('my super name for server 2')
374 it('Should list only local videos on server 3', async function () {
375 const { body } = await getLocalVideos(servers[2].url)
377 expect(body.total).to.equal(2)
378 expect(body.data).to.be.an('array')
379 expect(body.data.length).to.equal(2)
380 expect(body.data[0].name).to.equal('my super name for server 3')
381 expect(body.data[1].name).to.equal('my super name for server 3-2')
385 describe('Should seed the uploaded video', function () {
386 it('Should add the file 1 by asking server 3', async function () {
389 const res = await getVideosList(servers[2].url)
391 const video = res.body.data[0]
392 toRemove.push(res.body.data[2])
393 toRemove.push(res.body.data[3])
395 const res2 = await getVideo(servers[2].url, video.id)
396 const videoDetails = res2.body
398 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
399 expect(torrent.files).to.be.an('array')
400 expect(torrent.files.length).to.equal(1)
401 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
404 it('Should add the file 2 by asking server 1', async function () {
407 const res = await getVideosList(servers[0].url)
409 const video = res.body.data[1]
410 const res2 = await getVideo(servers[0].url, video.id)
411 const videoDetails = res2.body
413 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
414 expect(torrent.files).to.be.an('array')
415 expect(torrent.files.length).to.equal(1)
416 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
419 it('Should add the file 3 by asking server 2', async function () {
422 const res = await getVideosList(servers[1].url)
424 const video = res.body.data[2]
425 const res2 = await getVideo(servers[1].url, video.id)
426 const videoDetails = res2.body
428 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
429 expect(torrent.files).to.be.an('array')
430 expect(torrent.files.length).to.equal(1)
431 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
434 it('Should add the file 3-2 by asking server 1', async function () {
437 const res = await getVideosList(servers[0].url)
439 const video = res.body.data[3]
440 const res2 = await getVideo(servers[0].url, video.id)
441 const videoDetails = res2.body
443 const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri)
444 expect(torrent.files).to.be.an('array')
445 expect(torrent.files.length).to.equal(1)
446 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
449 it('Should add the file 2 in 360p by asking server 1', async function () {
452 const res = await getVideosList(servers[0].url)
454 const video = res.body.data.find(v => v.name === 'my super name for server 2')
455 const res2 = await getVideo(servers[0].url, video.id)
456 const videoDetails = res2.body
458 const file = videoDetails.files.find(f => f.resolution.id === 360)
459 expect(file).not.to.be.undefined
461 const torrent = await webtorrentAdd(file.magnetUri)
462 expect(torrent.files).to.be.an('array')
463 expect(torrent.files.length).to.equal(1)
464 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
468 describe('Should update video views, likes and dislikes', function () {
469 let localVideosServer3 = []
470 let remoteVideosServer1 = []
471 let remoteVideosServer2 = []
472 let remoteVideosServer3 = []
474 before(async function () {
475 const res1 = await getVideosList(servers[0].url)
476 remoteVideosServer1 = res1.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
478 const res2 = await getVideosList(servers[1].url)
479 remoteVideosServer2 = res2.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
481 const res3 = await getVideosList(servers[2].url)
482 localVideosServer3 = res3.body.data.filter(video => video.isLocal === true).map(video => video.uuid)
483 remoteVideosServer3 = res3.body.data.filter(video => video.isLocal === false).map(video => video.uuid)
486 it('Should view multiple videos on owned servers', async function () {
489 const tasks: Promise<any>[] = []
490 await viewVideo(servers[2].url, localVideosServer3[0])
491 await viewVideo(servers[2].url, localVideosServer3[0])
492 await viewVideo(servers[2].url, localVideosServer3[0])
493 await viewVideo(servers[2].url, localVideosServer3[1])
495 await Promise.all(tasks)
498 await viewVideo(servers[2].url, localVideosServer3[0])
502 await viewVideo(servers[2].url, localVideosServer3[0])
506 for (const server of servers) {
507 const res = await getVideosList(server.url)
509 const videos = res.body.data
510 const video0 = videos.find(v => v.uuid === localVideosServer3[0])
511 const video1 = videos.find(v => v.uuid === localVideosServer3[1])
513 expect(video0.views).to.equal(3)
514 expect(video1.views).to.equal(1)
518 it('Should view multiple videos on each servers', async function () {
521 const tasks: Promise<any>[] = []
522 tasks.push(viewVideo(servers[0].url, remoteVideosServer1[0]))
523 tasks.push(viewVideo(servers[1].url, remoteVideosServer2[0]))
524 tasks.push(viewVideo(servers[1].url, remoteVideosServer2[0]))
525 tasks.push(viewVideo(servers[2].url, remoteVideosServer3[0]))
526 tasks.push(viewVideo(servers[2].url, remoteVideosServer3[1]))
527 tasks.push(viewVideo(servers[2].url, remoteVideosServer3[1]))
528 tasks.push(viewVideo(servers[2].url, remoteVideosServer3[1]))
529 tasks.push(viewVideo(servers[2].url, localVideosServer3[1]))
530 tasks.push(viewVideo(servers[2].url, localVideosServer3[1]))
531 tasks.push(viewVideo(servers[2].url, localVideosServer3[1]))
533 await Promise.all(tasks)
537 let baseVideos = null
539 for (const server of servers) {
540 const res = await getVideosList(server.url)
542 const videos = res.body.data
544 // Initialize base videos for future comparisons
545 if (baseVideos === null) {
550 for (const baseVideo of baseVideos) {
551 const sameVideo = videos.find(video => video.name === baseVideo.name)
552 expect(baseVideo.views).to.equal(sameVideo.views)
557 it('Should like and dislikes videos on different services', async function () {
560 await rateVideo(servers[0].url, servers[0].accessToken, remoteVideosServer1[0], 'like')
562 await rateVideo(servers[0].url, servers[0].accessToken, remoteVideosServer1[0], 'dislike')
564 await rateVideo(servers[0].url, servers[0].accessToken, remoteVideosServer1[0], 'like')
565 await rateVideo(servers[2].url, servers[2].accessToken, localVideosServer3[1], 'like')
567 await rateVideo(servers[2].url, servers[2].accessToken, localVideosServer3[1], 'dislike')
568 await rateVideo(servers[2].url, servers[2].accessToken, remoteVideosServer3[1], 'dislike')
570 await rateVideo(servers[2].url, servers[2].accessToken, remoteVideosServer3[0], 'like')
574 let baseVideos = null
575 for (const server of servers) {
576 const res = await getVideosList(server.url)
578 const videos = res.body.data
580 // Initialize base videos for future comparisons
581 if (baseVideos === null) {
586 for (const baseVideo of baseVideos) {
587 const sameVideo = videos.find(video => video.name === baseVideo.name)
588 expect(baseVideo.likes).to.equal(sameVideo.likes)
589 expect(baseVideo.dislikes).to.equal(sameVideo.dislikes)
595 describe('Should manipulate these videos', function () {
596 it('Should update the video 3 by asking server 3', async function () {
600 name: 'my super video updated',
605 description: 'my super description updated',
606 support: 'my super support text updated',
607 tags: [ 'tag_up_1', 'tag_up_2' ],
608 thumbnailfile: 'thumbnail.jpg',
609 previewfile: 'preview.jpg'
612 await updateVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, attributes)
617 it('Should have the video 3 updated on each server', async function () {
620 for (const server of servers) {
621 const res = await getVideosList(server.url)
623 const videos = res.body.data
624 const videoUpdated = videos.find(video => video.name === 'my super video updated')
625 expect(!!videoUpdated).to.be.true
627 const isLocal = server.url === 'http://localhost:9003'
628 const checkAttributes = {
629 name: 'my super video updated',
634 description: 'my super description updated',
635 support: 'my super support text updated',
638 host: 'localhost:9003'
642 commentsEnabled: true,
643 tags: [ 'tag_up_1', 'tag_up_2' ],
644 privacy: VideoPrivacy.PUBLIC,
646 name: 'Default root channel',
650 fixture: 'video_short3.webm',
657 thumbnailfile: 'thumbnail',
658 previewfile: 'preview'
660 await completeVideoCheck(server.url, videoUpdated, checkAttributes)
664 it('Should remove the videos 3 and 3-2 by asking server 3', async function () {
667 await removeVideo(servers[2].url, servers[2].accessToken, toRemove[0].id)
668 await removeVideo(servers[2].url, servers[2].accessToken, toRemove[1].id)
673 it('Should not have files of videos 3 and 3-2 on each server', async function () {
674 for (const server of servers) {
675 await checkVideoFilesWereRemoved(toRemove[0].uuid, server.serverNumber)
676 await checkVideoFilesWereRemoved(toRemove[1].uuid, server.serverNumber)
680 it('Should have videos 1 and 3 on each server', async function () {
681 for (const server of servers) {
682 const res = await getVideosList(server.url)
684 const videos = res.body.data
685 expect(videos).to.be.an('array')
686 expect(videos.length).to.equal(2)
687 expect(videos[0].name).not.to.equal(videos[1].name)
688 expect(videos[0].name).not.to.equal(toRemove[0].name)
689 expect(videos[1].name).not.to.equal(toRemove[0].name)
690 expect(videos[0].name).not.to.equal(toRemove[1].name)
691 expect(videos[1].name).not.to.equal(toRemove[1].name)
693 videoUUID = videos.find(video => video.name === 'my super name for server 1').uuid
697 it('Should get the same video by UUID on each server', async function () {
699 for (const server of servers) {
700 const res = await getVideo(server.url, videoUUID)
702 const video = res.body
704 if (baseVideo === null) {
709 expect(baseVideo.name).to.equal(video.name)
710 expect(baseVideo.uuid).to.equal(video.uuid)
711 expect(baseVideo.category.id).to.equal(video.category.id)
712 expect(baseVideo.language.id).to.equal(video.language.id)
713 expect(baseVideo.licence.id).to.equal(video.licence.id)
714 expect(baseVideo.nsfw).to.equal(video.nsfw)
715 expect(baseVideo.account.name).to.equal(video.account.name)
716 expect(baseVideo.account.displayName).to.equal(video.account.displayName)
717 expect(baseVideo.account.url).to.equal(video.account.url)
718 expect(baseVideo.account.host).to.equal(video.account.host)
719 expect(baseVideo.tags).to.deep.equal(video.tags)
723 it('Should get the preview from each server', async function () {
724 for (const server of servers) {
725 const res = await getVideo(server.url, videoUUID)
726 const video = res.body
728 await testImage(server.url, 'video_short1-preview.webm', video.previewPath)
733 describe('Should comment these videos', function () {
734 let childOfFirstChild: VideoCommentThreadTree
736 it('Should add comment (threads and replies)', async function () {
740 const text = 'my super first comment'
741 await addVideoCommentThread(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID, text)
745 const text = 'my super second comment'
746 await addVideoCommentThread(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, text)
752 const res = await getVideoCommentThreads(servers[1].url, videoUUID, 0, 5)
753 const threadId = res.body.data.find(c => c.text === 'my super first comment').id
755 const text = 'my super answer to thread 1'
756 await addVideoCommentReply(servers[ 1 ].url, servers[ 1 ].accessToken, videoUUID, threadId, text)
762 const res1 = await getVideoCommentThreads(servers[2].url, videoUUID, 0, 5)
763 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
765 const res2 = await getVideoThreadComments(servers[2].url, videoUUID, threadId)
766 const childCommentId = res2.body.children[0].comment.id
768 const text3 = 'my second answer to thread 1'
769 await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, threadId, text3)
771 const text2 = 'my super answer to answer of thread 1'
772 await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, childCommentId, text2)
778 it('Should have these threads', async function () {
779 for (const server of servers) {
780 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
782 expect(res.body.total).to.equal(2)
783 expect(res.body.data).to.be.an('array')
784 expect(res.body.data).to.have.lengthOf(2)
787 const comment: VideoComment = res.body.data.find(c => c.text === 'my super first comment')
788 expect(comment).to.not.be.undefined
789 expect(comment.inReplyToCommentId).to.be.null
790 expect(comment.account.name).to.equal('root')
791 expect(comment.account.host).to.equal('localhost:9001')
792 expect(comment.totalReplies).to.equal(3)
793 expect(dateIsValid(comment.createdAt as string)).to.be.true
794 expect(dateIsValid(comment.updatedAt as string)).to.be.true
798 const comment: VideoComment = res.body.data.find(c => c.text === 'my super second comment')
799 expect(comment).to.not.be.undefined
800 expect(comment.inReplyToCommentId).to.be.null
801 expect(comment.account.name).to.equal('root')
802 expect(comment.account.host).to.equal('localhost:9003')
803 expect(comment.totalReplies).to.equal(0)
804 expect(dateIsValid(comment.createdAt as string)).to.be.true
805 expect(dateIsValid(comment.updatedAt as string)).to.be.true
810 it('Should have these comments', async function () {
811 for (const server of servers) {
812 const res1 = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
813 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
815 const res2 = await getVideoThreadComments(server.url, videoUUID, threadId)
817 const tree: VideoCommentThreadTree = res2.body
818 expect(tree.comment.text).equal('my super first comment')
819 expect(tree.comment.account.name).equal('root')
820 expect(tree.comment.account.host).equal('localhost:9001')
821 expect(tree.children).to.have.lengthOf(2)
823 const firstChild = tree.children[0]
824 expect(firstChild.comment.text).to.equal('my super answer to thread 1')
825 expect(firstChild.comment.account.name).equal('root')
826 expect(firstChild.comment.account.host).equal('localhost:9002')
827 expect(firstChild.children).to.have.lengthOf(1)
829 childOfFirstChild = firstChild.children[0]
830 expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1')
831 expect(childOfFirstChild.comment.account.name).equal('root')
832 expect(childOfFirstChild.comment.account.host).equal('localhost:9003')
833 expect(childOfFirstChild.children).to.have.lengthOf(0)
835 const secondChild = tree.children[1]
836 expect(secondChild.comment.text).to.equal('my second answer to thread 1')
837 expect(secondChild.comment.account.name).equal('root')
838 expect(secondChild.comment.account.host).equal('localhost:9003')
839 expect(secondChild.children).to.have.lengthOf(0)
843 it('Should delete a reply', async function () {
846 await deleteVideoComment(servers[2].url, servers[2].accessToken, videoUUID, childOfFirstChild.comment.id)
851 it('Should not have this comment anymore', async function () {
852 for (const server of servers) {
853 const res1 = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
854 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
856 const res2 = await getVideoThreadComments(server.url, videoUUID, threadId)
858 const tree: VideoCommentThreadTree = res2.body
859 expect(tree.comment.text).equal('my super first comment')
861 const firstChild = tree.children[0]
862 expect(firstChild.comment.text).to.equal('my super answer to thread 1')
863 expect(firstChild.children).to.have.lengthOf(0)
865 const secondChild = tree.children[1]
866 expect(secondChild.comment.text).to.equal('my second answer to thread 1')
870 it('Should delete the thread comments', async function () {
873 const res1 = await getVideoCommentThreads(servers[0].url, videoUUID, 0, 5)
874 const threadId = res1.body.data.find(c => c.text === 'my super first comment').id
875 await deleteVideoComment(servers[0].url, servers[0].accessToken, videoUUID, threadId)
880 it('Should have the thread comments deleted on other servers too', async function () {
881 for (const server of servers) {
882 const res = await getVideoCommentThreads(server.url, videoUUID, 0, 5)
884 expect(res.body.total).to.equal(1)
885 expect(res.body.data).to.be.an('array')
886 expect(res.body.data).to.have.lengthOf(1)
889 const comment: VideoComment = res.body.data[0]
890 expect(comment).to.not.be.undefined
891 expect(comment.inReplyToCommentId).to.be.null
892 expect(comment.account.name).to.equal('root')
893 expect(comment.account.host).to.equal('localhost:9003')
894 expect(comment.totalReplies).to.equal(0)
895 expect(dateIsValid(comment.createdAt as string)).to.be.true
896 expect(dateIsValid(comment.updatedAt as string)).to.be.true
901 it('Should disable comments', async function () {
905 commentsEnabled: false
908 await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, attributes)
912 for (const server of servers) {
913 const res = await getVideo(server.url, videoUUID)
914 expect(res.body.commentsEnabled).to.be.false
916 const text = 'my super forbidden comment'
917 await addVideoCommentThread(server.url, server.accessToken, videoUUID, text, 409)
922 describe('With minimum parameters', function () {
923 it('Should upload and propagate the video', async function () {
926 const path = '/api/v1/videos/upload'
928 const req = request(servers[1].url)
930 .set('Accept', 'application/json')
931 .set('Authorization', 'Bearer ' + servers[1].accessToken)
932 .field('name', 'minimum parameters')
933 .field('privacy', '1')
934 .field('nsfw', 'false')
935 .field('channelId', '1')
936 .field('commentsEnabled', 'true')
938 const filePath = join(__dirname, '..', '..', 'api', 'fixtures', 'video_short.webm')
940 await req.attach('videofile', filePath)
945 for (const server of servers) {
946 const res = await getVideosList(server.url)
947 const video = res.body.data.find(v => v.name === 'minimum parameters')
949 const isLocal = server.url === 'http://localhost:9002'
950 const checkAttributes = {
951 name: 'minimum parameters',
960 host: 'localhost:9002'
964 commentsEnabled: true,
966 privacy: VideoPrivacy.PUBLIC,
968 name: 'Default root channel',
972 fixture: 'video_short.webm',
992 await completeVideoCheck(server.url, video, checkAttributes)
997 after(async function () {
998 killallServers(servers)
1000 // Keep the logs if the test failed