From 5600def4c87d3e6b7724489c9c4415778ea014d3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 16 Apr 2020 15:13:46 +0200 Subject: Fix user video quota with webtorrent disabled --- server/tests/api/users/users.ts | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'server/tests/api') 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 { reportVideoAbuse, addVideoCommentThread, updateVideoAbuse, - getVideoAbusesList + getVideoAbusesList, updateCustomSubConfig, getCustomConfig, waitJobs } from '../../../../shared/extra-utils' import { follow } from '../../../../shared/extra-utils/server/follows' import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login' import { getMyVideos } from '../../../../shared/extra-utils/videos/videos' import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' +import { CustomConfig } from '@shared/models/server' const expect = chai.expect @@ -293,7 +294,7 @@ describe('Test users', function () { describe('My videos & quotas', function () { it('Should be able to upload a video with this user', async function () { - this.timeout(5000) + this.timeout(10000) const videoAttributes = { name: 'super user video', @@ -345,6 +346,36 @@ describe('Test users', function () { expect(videos).to.have.lengthOf(0) } }) + + it('Should disable webtorrent, enable HLS, and update my quota', async function () { + this.timeout(60000) + + { + const res = await getCustomConfig(server.url, server.accessToken) + const config = res.body as CustomConfig + config.transcoding.webtorrent.enabled = false + config.transcoding.hls.enabled = true + config.transcoding.enabled = true + await updateCustomSubConfig(server.url, server.accessToken, config) + } + + { + const videoAttributes = { + name: 'super user video 2', + fixture: 'video_short.webm' + } + await uploadVideo(server.url, accessTokenUser, videoAttributes) + + await waitJobs([ server ]) + } + + { + const res = await getMyUserVideoQuotaUsed(server.url, accessTokenUser) + const data = res.body + + expect(data.videoQuotaUsed).to.be.greaterThan(220000) + } + }) }) describe('Users listing', function () { -- cgit v1.2.3