aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils
diff options
context:
space:
mode:
authorFelix Ableitner <me@nutomic.com>2018-08-28 02:01:35 -0500
committerChocobozzz <me@florianbigard.com>2018-08-28 09:01:35 +0200
commitbee0abffff73804d816b90c7fd599e0a51c09d61 (patch)
treefae6d58637f9c63a3800090277f8e130b43442dd /server/tests/utils
parentc907c2fa3fd7c0a741117a0204d0ebca675124bd (diff)
downloadPeerTube-bee0abffff73804d816b90c7fd599e0a51c09d61.tar.gz
PeerTube-bee0abffff73804d816b90c7fd599e0a51c09d61.tar.zst
PeerTube-bee0abffff73804d816b90c7fd599e0a51c09d61.zip
Implement daily upload limit (#956)
* Implement daily upload limit (ref #652) * remove duplicate code * review fixes * fix tests? * whitespace fixes, finish leftover todo * fix tests * added some new tests * use different config value for tests * remove todo
Diffstat (limited to 'server/tests/utils')
-rw-r--r--server/tests/utils/server/config.ts3
-rw-r--r--server/tests/utils/users/users.ts6
2 files changed, 7 insertions, 2 deletions
diff --git a/server/tests/utils/server/config.ts b/server/tests/utils/server/config.ts
index d6ac3ef8a..799c31ae5 100644
--- a/server/tests/utils/server/config.ts
+++ b/server/tests/utils/server/config.ts
@@ -80,7 +80,8 @@ function updateCustomSubConfig (url: string, token: string, newConfig: any) {
80 email: 'superadmin1@example.com' 80 email: 'superadmin1@example.com'
81 }, 81 },
82 user: { 82 user: {
83 videoQuota: 5242881 83 videoQuota: 5242881,
84 videoQuotaDaily: 318742
84 }, 85 },
85 transcoding: { 86 transcoding: {
86 enabled: true, 87 enabled: true,
diff --git a/server/tests/utils/users/users.ts b/server/tests/utils/users/users.ts
index f786de6e3..5dba34b69 100644
--- a/server/tests/utils/users/users.ts
+++ b/server/tests/utils/users/users.ts
@@ -10,6 +10,7 @@ function createUser (
10 username: string, 10 username: string,
11 password: string, 11 password: string,
12 videoQuota = 1000000, 12 videoQuota = 1000000,
13 videoQuotaDaily = -1,
13 role: UserRole = UserRole.USER, 14 role: UserRole = UserRole.USER,
14 specialStatus = 200 15 specialStatus = 200
15) { 16) {
@@ -19,7 +20,8 @@ function createUser (
19 password, 20 password,
20 role, 21 role,
21 email: username + '@example.com', 22 email: username + '@example.com',
22 videoQuota 23 videoQuota,
24 videoQuotaDaily
23 } 25 }
24 26
25 return request(url) 27 return request(url)
@@ -202,6 +204,7 @@ function updateUser (options: {
202 accessToken: string, 204 accessToken: string,
203 email?: string, 205 email?: string,
204 videoQuota?: number, 206 videoQuota?: number,
207 videoQuotaDaily?: number,
205 role?: UserRole 208 role?: UserRole
206}) { 209}) {
207 const path = '/api/v1/users/' + options.userId 210 const path = '/api/v1/users/' + options.userId
@@ -209,6 +212,7 @@ function updateUser (options: {
209 const toSend = {} 212 const toSend = {}
210 if (options.email !== undefined && options.email !== null) toSend['email'] = options.email 213 if (options.email !== undefined && options.email !== null) toSend['email'] = options.email
211 if (options.videoQuota !== undefined && options.videoQuota !== null) toSend['videoQuota'] = options.videoQuota 214 if (options.videoQuota !== undefined && options.videoQuota !== null) toSend['videoQuota'] = options.videoQuota
215 if (options.videoQuotaDaily !== undefined && options.videoQuotaDaily !== null) toSend['videoQuotaDaily'] = options.videoQuotaDaily
212 if (options.role !== undefined && options.role !== null) toSend['role'] = options.role 216 if (options.role !== undefined && options.role !== null) toSend['role'] = options.role
213 217
214 return makePutBodyRequest({ 218 return makePutBodyRequest({