aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/videos/resumable-upload.ts21
1 files changed, 13 insertions, 8 deletions
diff --git a/server/tests/api/videos/resumable-upload.ts b/server/tests/api/videos/resumable-upload.ts
index 13e47c85e..a2d60eeec 100644
--- a/server/tests/api/videos/resumable-upload.ts
+++ b/server/tests/api/videos/resumable-upload.ts
@@ -99,8 +99,8 @@ describe('Test resumable upload', function () {
99 this.timeout(30000) 99 this.timeout(30000)
100 100
101 server = await createSingleServer(1) 101 server = await createSingleServer(1)
102 await setAccessTokensToServers([ server ]) 102 await setAccessTokensToServers([server])
103 await setDefaultVideoChannel([ server ]) 103 await setDefaultVideoChannel([server])
104 104
105 const body = await server.users.getMyInfo() 105 const body = await server.users.getMyInfo()
106 rootId = body.id 106 rootId = body.id
@@ -146,8 +146,7 @@ describe('Test resumable upload', function () {
146 }) 146 })
147 147
148 it('Should not accept more chunks than expected', async function () { 148 it('Should not accept more chunks than expected', async function () {
149 const size = 100 149 const uploadId = await prepareUpload(100)
150 const uploadId = await prepareUpload(size)
151 150
152 await sendChunks({ pathUploadId: uploadId, expectedStatus: HttpStatusCode.CONFLICT_409 }) 151 await sendChunks({ pathUploadId: uploadId, expectedStatus: HttpStatusCode.CONFLICT_409 })
153 await checkFileSize(uploadId, 0) 152 await checkFileSize(uploadId, 0)
@@ -156,8 +155,14 @@ describe('Test resumable upload', function () {
156 it('Should not accept more chunks than expected with an invalid content length/content range', async function () { 155 it('Should not accept more chunks than expected with an invalid content length/content range', async function () {
157 const uploadId = await prepareUpload(1500) 156 const uploadId = await prepareUpload(1500)
158 157
159 await sendChunks({ pathUploadId: uploadId, expectedStatus: HttpStatusCode.BAD_REQUEST_400, contentLength: 1000 }) 158 // Content length check seems to have changed in v16
160 await checkFileSize(uploadId, 0) 159 if (process.version.startsWith('v16')) {
160 await sendChunks({ pathUploadId: uploadId, expectedStatus: HttpStatusCode.CONFLICT_409, contentLength: 1000 })
161 await checkFileSize(uploadId, 1000)
162 } else {
163 await sendChunks({ pathUploadId: uploadId, expectedStatus: HttpStatusCode.BAD_REQUEST_400, contentLength: 1000 })
164 await checkFileSize(uploadId, 0)
165 }
161 }) 166 })
162 167
163 it('Should not accept more chunks than expected with an invalid content length', async function () { 168 it('Should not accept more chunks than expected with an invalid content length', async function () {
@@ -166,12 +171,12 @@ describe('Test resumable upload', function () {
166 const size = 1000 171 const size = 1000
167 172
168 const contentRangeBuilder = start => `bytes ${start}-${start + size - 1}/${size}` 173 const contentRangeBuilder = start => `bytes ${start}-${start + size - 1}/${size}`
169 await sendChunks({ pathUploadId: uploadId, expectedStatus: HttpStatusCode.BAD_REQUEST_400, contentRangeBuilder, contentLength: size }) 174 await sendChunks({ pathUploadId: uploadId, expectedStatus: HttpStatusCode.CONFLICT_409, contentRangeBuilder, contentLength: size })
170 await checkFileSize(uploadId, 0) 175 await checkFileSize(uploadId, 0)
171 }) 176 })
172 }) 177 })
173 178
174 after(async function () { 179 after(async function () {
175 await cleanupTests([ server ]) 180 await cleanupTests([server])
176 }) 181 })
177}) 182})