aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-16 15:13:46 +0200
committerChocobozzz <me@florianbigard.com>2020-04-16 15:13:46 +0200
commit5600def4c87d3e6b7724489c9c4415778ea014d3 (patch)
tree419920806ed4b91048041110dec4f01b40091a95 /server/tests
parent437e8e06eb32ffe21111f0946115aae0e4c33381 (diff)
downloadPeerTube-5600def4c87d3e6b7724489c9c4415778ea014d3.tar.gz
PeerTube-5600def4c87d3e6b7724489c9c4415778ea014d3.tar.zst
PeerTube-5600def4c87d3e6b7724489c9c4415778ea014d3.zip
Fix user video quota with webtorrent disabled
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/users/users.ts35
1 files changed, 33 insertions, 2 deletions
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index 3e1a0c19b..db82e8fc2 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -37,12 +37,13 @@ import {
37 reportVideoAbuse, 37 reportVideoAbuse,
38 addVideoCommentThread, 38 addVideoCommentThread,
39 updateVideoAbuse, 39 updateVideoAbuse,
40 getVideoAbusesList 40 getVideoAbusesList, updateCustomSubConfig, getCustomConfig, waitJobs
41} from '../../../../shared/extra-utils' 41} from '../../../../shared/extra-utils'
42import { follow } from '../../../../shared/extra-utils/server/follows' 42import { follow } from '../../../../shared/extra-utils/server/follows'
43import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login' 43import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login'
44import { getMyVideos } from '../../../../shared/extra-utils/videos/videos' 44import { getMyVideos } from '../../../../shared/extra-utils/videos/videos'
45import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' 45import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'
46import { CustomConfig } from '@shared/models/server'
46 47
47const expect = chai.expect 48const expect = chai.expect
48 49
@@ -293,7 +294,7 @@ describe('Test users', function () {
293 describe('My videos & quotas', function () { 294 describe('My videos & quotas', function () {
294 295
295 it('Should be able to upload a video with this user', async function () { 296 it('Should be able to upload a video with this user', async function () {
296 this.timeout(5000) 297 this.timeout(10000)
297 298
298 const videoAttributes = { 299 const videoAttributes = {
299 name: 'super user video', 300 name: 'super user video',
@@ -345,6 +346,36 @@ describe('Test users', function () {
345 expect(videos).to.have.lengthOf(0) 346 expect(videos).to.have.lengthOf(0)
346 } 347 }
347 }) 348 })
349
350 it('Should disable webtorrent, enable HLS, and update my quota', async function () {
351 this.timeout(60000)
352
353 {
354 const res = await getCustomConfig(server.url, server.accessToken)
355 const config = res.body as CustomConfig
356 config.transcoding.webtorrent.enabled = false
357 config.transcoding.hls.enabled = true
358 config.transcoding.enabled = true
359 await updateCustomSubConfig(server.url, server.accessToken, config)
360 }
361
362 {
363 const videoAttributes = {
364 name: 'super user video 2',
365 fixture: 'video_short.webm'
366 }
367 await uploadVideo(server.url, accessTokenUser, videoAttributes)
368
369 await waitJobs([ server ])
370 }
371
372 {
373 const res = await getMyUserVideoQuotaUsed(server.url, accessTokenUser)
374 const data = res.body
375
376 expect(data.videoQuotaUsed).to.be.greaterThan(220000)
377 }
378 })
348 }) 379 })
349 380
350 describe('Users listing', function () { 381 describe('Users listing', function () {