aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-03 10:12:36 +0100
committerChocobozzz <me@florianbigard.com>2018-01-03 10:38:19 +0100
commit47564bbe2eeb2baae9b7e3f9b2b8d16522bc7e04 (patch)
tree25e2836baf3dfce6f422192d98332db1bfe65890 /server/tests/api/videos
parentc5911fd347c76e8bdc05ea9f3ee9efed4a58c236 (diff)
downloadPeerTube-47564bbe2eeb2baae9b7e3f9b2b8d16522bc7e04.tar.gz
PeerTube-47564bbe2eeb2baae9b7e3f9b2b8d16522bc7e04.tar.zst
PeerTube-47564bbe2eeb2baae9b7e3f9b2b8d16522bc7e04.zip
Add ability to disable video comments
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/multiple-servers.ts27
-rw-r--r--server/tests/api/videos/single-server.ts5
2 files changed, 31 insertions, 1 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index abd051a30..b6dfe0d1b 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -93,6 +93,7 @@ describe('Test multiple servers', function () {
93 duration: 10, 93 duration: 10,
94 tags: [ 'tag1p1', 'tag2p1' ], 94 tags: [ 'tag1p1', 'tag2p1' ],
95 privacy: VideoPrivacy.PUBLIC, 95 privacy: VideoPrivacy.PUBLIC,
96 commentsEnabled: true,
96 channel: { 97 channel: {
97 name: 'my channel', 98 name: 'my channel',
98 description: 'super channel', 99 description: 'super channel',
@@ -155,6 +156,7 @@ describe('Test multiple servers', function () {
155 host: 'localhost:9002', 156 host: 'localhost:9002',
156 account: 'user1', 157 account: 'user1',
157 isLocal, 158 isLocal,
159 commentsEnabled: true,
158 duration: 5, 160 duration: 5,
159 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ], 161 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
160 privacy: VideoPrivacy.PUBLIC, 162 privacy: VideoPrivacy.PUBLIC,
@@ -254,6 +256,7 @@ describe('Test multiple servers', function () {
254 account: 'root', 256 account: 'root',
255 isLocal, 257 isLocal,
256 duration: 5, 258 duration: 5,
259 commentsEnabled: true,
257 tags: [ 'tag1p3' ], 260 tags: [ 'tag1p3' ],
258 privacy: VideoPrivacy.PUBLIC, 261 privacy: VideoPrivacy.PUBLIC,
259 channel: { 262 channel: {
@@ -280,6 +283,7 @@ describe('Test multiple servers', function () {
280 description: 'my super description for server 3-2', 283 description: 'my super description for server 3-2',
281 host: 'localhost:9003', 284 host: 'localhost:9003',
282 account: 'root', 285 account: 'root',
286 commentsEnabled: true,
283 isLocal, 287 isLocal,
284 duration: 5, 288 duration: 5,
285 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ], 289 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
@@ -545,6 +549,7 @@ describe('Test multiple servers', function () {
545 account: 'root', 549 account: 'root',
546 isLocal, 550 isLocal,
547 duration: 5, 551 duration: 5,
552 commentsEnabled: true,
548 tags: [ 'tag_up_1', 'tag_up_2' ], 553 tags: [ 'tag_up_1', 'tag_up_2' ],
549 privacy: VideoPrivacy.PUBLIC, 554 privacy: VideoPrivacy.PUBLIC,
550 channel: { 555 channel: {
@@ -732,6 +737,26 @@ describe('Test multiple servers', function () {
732 expect(secondChild.children).to.have.lengthOf(0) 737 expect(secondChild.children).to.have.lengthOf(0)
733 } 738 }
734 }) 739 })
740
741 it('Should disable comments', async function () {
742 this.timeout(20000)
743
744 const attributes = {
745 commentsEnabled: false
746 }
747
748 await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, attributes)
749
750 await wait(5000)
751
752 for (const server of servers) {
753 const res = await getVideo(server.url, videoUUID)
754 expect(res.body.commentsEnabled).to.be.false
755
756 const text = 'my super forbidden comment'
757 await addVideoCommentThread(server.url, server.accessToken, videoUUID, text, 409)
758 }
759 })
735 }) 760 })
736 761
737 describe('With minimum parameters', function () { 762 describe('With minimum parameters', function () {
@@ -748,6 +773,7 @@ describe('Test multiple servers', function () {
748 .field('privacy', '1') 773 .field('privacy', '1')
749 .field('nsfw', 'false') 774 .field('nsfw', 'false')
750 .field('channelId', '1') 775 .field('channelId', '1')
776 .field('commentsEnabled', 'true')
751 777
752 const filePath = join(__dirname, '..', '..', 'api', 'fixtures', 'video_short.webm') 778 const filePath = join(__dirname, '..', '..', 'api', 'fixtures', 'video_short.webm')
753 779
@@ -772,6 +798,7 @@ describe('Test multiple servers', function () {
772 account: 'root', 798 account: 'root',
773 isLocal, 799 isLocal,
774 duration: 5, 800 duration: 5,
801 commentsEnabled: true,
775 tags: [ ], 802 tags: [ ],
776 privacy: VideoPrivacy.PUBLIC, 803 privacy: VideoPrivacy.PUBLIC,
777 channel: { 804 channel: {
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index 2a3126f32..0a0c95750 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -32,6 +32,7 @@ describe('Test a single server', function () {
32 duration: 5, 32 duration: 5,
33 tags: [ 'tag1', 'tag2', 'tag3' ], 33 tags: [ 'tag1', 'tag2', 'tag3' ],
34 privacy: VideoPrivacy.PUBLIC, 34 privacy: VideoPrivacy.PUBLIC,
35 commentsEnabled: true,
35 channel: { 36 channel: {
36 name: 'Default root channel', 37 name: 'Default root channel',
37 description: '', 38 description: '',
@@ -51,7 +52,7 @@ describe('Test a single server', function () {
51 category: 4, 52 category: 4,
52 licence: 2, 53 licence: 2,
53 language: 5, 54 language: 5,
54 nsfw: true, 55 nsfw: false,
55 description: 'my super description updated', 56 description: 'my super description updated',
56 host: 'localhost:9001', 57 host: 'localhost:9001',
57 account: 'root', 58 account: 'root',
@@ -59,6 +60,7 @@ describe('Test a single server', function () {
59 tags: [ 'tagup1', 'tagup2' ], 60 tags: [ 'tagup1', 'tagup2' ],
60 privacy: VideoPrivacy.PUBLIC, 61 privacy: VideoPrivacy.PUBLIC,
61 duration: 5, 62 duration: 5,
63 commentsEnabled: false,
62 channel: { 64 channel: {
63 name: 'Default root channel', 65 name: 'Default root channel',
64 description: '', 66 description: '',
@@ -475,6 +477,7 @@ describe('Test a single server', function () {
475 language: 5, 477 language: 5,
476 nsfw: false, 478 nsfw: false,
477 description: 'my super description updated', 479 description: 'my super description updated',
480 commentsEnabled: false,
478 tags: [ 'tagup1', 'tagup2' ] 481 tags: [ 'tagup1', 'tagup2' ]
479 } 482 }
480 await updateVideo(server.url, server.accessToken, videoId, attributes) 483 await updateVideo(server.url, server.accessToken, videoId, attributes)