aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/upload-quota.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/upload-quota.ts')
-rw-r--r--server/tests/api/check-params/upload-quota.ts30
1 files changed, 15 insertions, 15 deletions
diff --git a/server/tests/api/check-params/upload-quota.ts b/server/tests/api/check-params/upload-quota.ts
index 164c581e3..4ca544790 100644
--- a/server/tests/api/check-params/upload-quota.ts
+++ b/server/tests/api/check-params/upload-quota.ts
@@ -29,12 +29,12 @@ describe('Test upload quota', function () {
29 await setAccessTokensToServers([ server ]) 29 await setAccessTokensToServers([ server ])
30 await setDefaultVideoChannel([ server ]) 30 await setDefaultVideoChannel([ server ])
31 31
32 const user = await server.usersCommand.getMyInfo() 32 const user = await server.users.getMyInfo()
33 rootId = user.id 33 rootId = user.id
34 34
35 await server.usersCommand.update({ userId: rootId, videoQuota: 42 }) 35 await server.users.update({ userId: rootId, videoQuota: 42 })
36 36
37 command = server.videosCommand 37 command = server.videos
38 }) 38 })
39 39
40 describe('When having a video quota', function () { 40 describe('When having a video quota', function () {
@@ -43,8 +43,8 @@ describe('Test upload quota', function () {
43 this.timeout(30000) 43 this.timeout(30000)
44 44
45 const user = { username: 'registered' + randomInt(1, 1500), password: 'password' } 45 const user = { username: 'registered' + randomInt(1, 1500), password: 'password' }
46 await server.usersCommand.register(user) 46 await server.users.register(user)
47 const userToken = await server.loginCommand.getAccessToken(user) 47 const userToken = await server.login.getAccessToken(user)
48 48
49 const attributes = { fixture: 'video_short2.webm' } 49 const attributes = { fixture: 'video_short2.webm' }
50 for (let i = 0; i < 5; i++) { 50 for (let i = 0; i < 5; i++) {
@@ -58,8 +58,8 @@ describe('Test upload quota', function () {
58 this.timeout(30000) 58 this.timeout(30000)
59 59
60 const user = { username: 'registered' + randomInt(1, 1500), password: 'password' } 60 const user = { username: 'registered' + randomInt(1, 1500), password: 'password' }
61 await server.usersCommand.register(user) 61 await server.users.register(user)
62 const userToken = await server.loginCommand.getAccessToken(user) 62 const userToken = await server.login.getAccessToken(user)
63 63
64 const attributes = { fixture: 'video_short2.webm' } 64 const attributes = { fixture: 'video_short2.webm' }
65 for (let i = 0; i < 5; i++) { 65 for (let i = 0; i < 5; i++) {
@@ -73,16 +73,16 @@ describe('Test upload quota', function () {
73 this.timeout(120000) 73 this.timeout(120000)
74 74
75 const baseAttributes = { 75 const baseAttributes = {
76 channelId: server.videoChannel.id, 76 channelId: server.store.channel.id,
77 privacy: VideoPrivacy.PUBLIC 77 privacy: VideoPrivacy.PUBLIC
78 } 78 }
79 await server.importsCommand.importVideo({ attributes: { ...baseAttributes, targetUrl: ImportsCommand.getGoodVideoUrl() } }) 79 await server.imports.importVideo({ attributes: { ...baseAttributes, targetUrl: ImportsCommand.getGoodVideoUrl() } })
80 await server.importsCommand.importVideo({ attributes: { ...baseAttributes, magnetUri: ImportsCommand.getMagnetURI() } }) 80 await server.imports.importVideo({ attributes: { ...baseAttributes, magnetUri: ImportsCommand.getMagnetURI() } })
81 await server.importsCommand.importVideo({ attributes: { ...baseAttributes, torrentfile: 'video-720p.torrent' as any } }) 81 await server.imports.importVideo({ attributes: { ...baseAttributes, torrentfile: 'video-720p.torrent' as any } })
82 82
83 await waitJobs([ server ]) 83 await waitJobs([ server ])
84 84
85 const { total, data: videoImports } = await server.importsCommand.getMyVideoImports() 85 const { total, data: videoImports } = await server.imports.getMyVideoImports()
86 expect(total).to.equal(3) 86 expect(total).to.equal(3)
87 87
88 expect(videoImports).to.have.lengthOf(3) 88 expect(videoImports).to.have.lengthOf(3)
@@ -98,7 +98,7 @@ describe('Test upload quota', function () {
98 describe('When having a daily video quota', function () { 98 describe('When having a daily video quota', function () {
99 99
100 it('Should fail with a user having too many videos daily', async function () { 100 it('Should fail with a user having too many videos daily', async function () {
101 await server.usersCommand.update({ userId: rootId, videoQuotaDaily: 42 }) 101 await server.users.update({ userId: rootId, videoQuotaDaily: 42 })
102 102
103 await command.upload({ expectedStatus: HttpStatusCode.PAYLOAD_TOO_LARGE_413, mode: 'legacy' }) 103 await command.upload({ expectedStatus: HttpStatusCode.PAYLOAD_TOO_LARGE_413, mode: 'legacy' })
104 await command.upload({ expectedStatus: HttpStatusCode.PAYLOAD_TOO_LARGE_413, mode: 'resumable' }) 104 await command.upload({ expectedStatus: HttpStatusCode.PAYLOAD_TOO_LARGE_413, mode: 'resumable' })
@@ -107,7 +107,7 @@ describe('Test upload quota', function () {
107 107
108 describe('When having an absolute and daily video quota', function () { 108 describe('When having an absolute and daily video quota', function () {
109 it('Should fail if exceeding total quota', async function () { 109 it('Should fail if exceeding total quota', async function () {
110 await server.usersCommand.update({ 110 await server.users.update({
111 userId: rootId, 111 userId: rootId,
112 videoQuota: 42, 112 videoQuota: 42,
113 videoQuotaDaily: 1024 * 1024 * 1024 113 videoQuotaDaily: 1024 * 1024 * 1024
@@ -118,7 +118,7 @@ describe('Test upload quota', function () {
118 }) 118 })
119 119
120 it('Should fail if exceeding daily quota', async function () { 120 it('Should fail if exceeding daily quota', async function () {
121 await server.usersCommand.update({ 121 await server.users.update({
122 userId: rootId, 122 userId: rootId,
123 videoQuota: 1024 * 1024 * 1024, 123 videoQuota: 1024 * 1024 * 1024,
124 videoQuotaDaily: 42 124 videoQuotaDaily: 42