diff options
author | Felix Ableitner <me@nutomic.com> | 2018-08-28 02:01:35 -0500 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-28 09:01:35 +0200 |
commit | bee0abffff73804d816b90c7fd599e0a51c09d61 (patch) | |
tree | fae6d58637f9c63a3800090277f8e130b43442dd /server/tests/utils/users/users.ts | |
parent | c907c2fa3fd7c0a741117a0204d0ebca675124bd (diff) | |
download | PeerTube-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/users/users.ts')
-rw-r--r-- | server/tests/utils/users/users.ts | 6 |
1 files changed, 5 insertions, 1 deletions
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({ |