]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/videos.ts
Merge branch 'release/v1.2.0'
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / videos.ts
index 7fce8ba7c71c81125c4f6b80817c751a6612062f..f26b91435e5499d52c3fba1ffad41df3c544bc68 100644 (file)
@@ -8,9 +8,13 @@ import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enu
 import {
   createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest,
   makeGetRequest, makeUploadRequest, makePutBodyRequest, removeVideo, runServer, ServerInfo, setAccessTokensToServers, userLogin
-} from '../../utils'
-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
-import { getAccountsList } from '../../utils/users/accounts'
+} from '../../../../shared/utils'
+import {
+  checkBadCountPagination,
+  checkBadSortPagination,
+  checkBadStartPagination
+} from '../../../../shared/utils/requests/check-api-params'
+import { getAccountsList } from '../../../../shared/utils/users/accounts'
 
 const expect = chai.expect
 
@@ -20,7 +24,7 @@ describe('Test videos API validator', function () {
   let userAccessToken = ''
   let accountName: string
   let channelId: number
-  let channelUUID: string
+  let channelName: string
   let videoId
 
   // ---------------------------------------------------------------
@@ -42,7 +46,7 @@ describe('Test videos API validator', function () {
     {
       const res = await getMyUserInformation(server.url, server.accessToken)
       channelId = res.body.videoChannels[ 0 ].id
-      channelUUID = res.body.videoChannels[ 0 ].uuid
+      channelName = res.body.videoChannels[ 0 ].name
       accountName = res.body.account.name + '@' + res.body.account.host
     }
   })
@@ -140,7 +144,7 @@ describe('Test videos API validator', function () {
     let path: string
 
     before(async function () {
-      path = '/api/v1/video-channels/' + channelUUID + '/videos'
+      path = '/api/v1/video-channels/' + channelName + '/videos'
     })
 
     it('Should fail with a bad start pagination', async function () {
@@ -233,7 +237,7 @@ describe('Test videos API validator', function () {
     })
 
     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) })
       const attaches = baseCorrectAttaches
 
       await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -316,10 +320,15 @@ describe('Test videos API validator', function () {
 
     it('Should fail without an incorrect input file', async function () {
       const fields = baseCorrectParams
-      const attaches = {
+      let attaches = {
         'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm')
       }
       await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
+
+      attaches = {
+        'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mkv')
+      }
+      await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
     })
 
     it('Should fail with an incorrect thumbnail file', async function () {
@@ -482,7 +491,7 @@ describe('Test videos API validator', function () {
     })
 
     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: path + videoId, token: server.accessToken, fields })
     })