]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/video-channels.ts
Add ability to forbid followers
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / video-channels.ts
index bcf4b7473e319857d1d0be42f752e1a47063c1b6..14e4deaf7680b1fa7068bcd62b73db2bf1f97b15 100644 (file)
@@ -20,8 +20,12 @@ import {
   ServerInfo,
   setAccessTokensToServers,
   userLogin
-} from '../../utils'
-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
+} from '../../../../shared/utils'
+import {
+  checkBadCountPagination,
+  checkBadSortPagination,
+  checkBadStartPagination
+} from '../../../../shared/utils/requests/check-api-params'
 import { User } from '../../../../shared/models/users'
 import { join } from 'path'
 
@@ -118,12 +122,12 @@ describe('Test video channels API validator', function () {
     })
 
     it('Should fail with a long description', async function () {
-      const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(150) })
+      const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(201) })
       await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields })
     })
 
     it('Should fail with a long support text', async function () {
-      const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(150) })
+      const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(201) })
       await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields })
     })
 
@@ -136,6 +140,16 @@ describe('Test video channels API validator', function () {
         statusCodeExpected: 200
       })
     })
+
+    it('Should fail when adding a channel with the same username', async function () {
+      await makePostBodyRequest({
+        url: server.url,
+        path: videoChannelPath,
+        token: server.accessToken,
+        fields: baseCorrectParams,
+        statusCodeExpected: 409
+      })
+    })
   })
 
   describe('When updating a video channel', function () {
@@ -175,12 +189,12 @@ describe('Test video channels API validator', function () {
     })
 
     it('Should fail with a long description', async function () {
-      const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(150) })
+      const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(201) })
       await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields })
     })
 
     it('Should fail with a long support text', async function () {
-      const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(150) })
+      const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(201) })
       await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields })
     })