aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/check-params/videos.ts63
1 files changed, 42 insertions, 21 deletions
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index 8d30769d3..af75d33c1 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -96,7 +96,7 @@ describe('Test videos API validator', function () {
96 it('Should fail with nothing', async function () { 96 it('Should fail with nothing', async function () {
97 const fields = {} 97 const fields = {}
98 const attaches = {} 98 const attaches = {}
99 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 99 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
100 }) 100 })
101 101
102 it('Should fail without name', async function () { 102 it('Should fail without name', async function () {
@@ -111,7 +111,7 @@ describe('Test videos API validator', function () {
111 const attaches = { 111 const attaches = {
112 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 112 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
113 } 113 }
114 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 114 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
115 }) 115 })
116 116
117 it('Should fail with a long name', async function () { 117 it('Should fail with a long name', async function () {
@@ -127,7 +127,7 @@ describe('Test videos API validator', function () {
127 const attaches = { 127 const attaches = {
128 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 128 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
129 } 129 }
130 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 130 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
131 }) 131 })
132 132
133 it('Should fail without a category', async function () { 133 it('Should fail without a category', async function () {
@@ -142,7 +142,7 @@ describe('Test videos API validator', function () {
142 const attaches = { 142 const attaches = {
143 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 143 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
144 } 144 }
145 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 145 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
146 }) 146 })
147 147
148 it('Should fail with a bad category', async function () { 148 it('Should fail with a bad category', async function () {
@@ -158,7 +158,7 @@ describe('Test videos API validator', function () {
158 const attaches = { 158 const attaches = {
159 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 159 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
160 } 160 }
161 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 161 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
162 }) 162 })
163 163
164 it('Should fail without a licence', async function () { 164 it('Should fail without a licence', async function () {
@@ -173,7 +173,7 @@ describe('Test videos API validator', function () {
173 const attaches = { 173 const attaches = {
174 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 174 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
175 } 175 }
176 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 176 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
177 }) 177 })
178 178
179 it('Should fail with a bad licence', async function () { 179 it('Should fail with a bad licence', async function () {
@@ -189,7 +189,7 @@ describe('Test videos API validator', function () {
189 const attaches = { 189 const attaches = {
190 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 190 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
191 } 191 }
192 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 192 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
193 }) 193 })
194 194
195 it('Should fail with a bad language', async function () { 195 it('Should fail with a bad language', async function () {
@@ -205,7 +205,7 @@ describe('Test videos API validator', function () {
205 const attaches = { 205 const attaches = {
206 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 206 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
207 } 207 }
208 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 208 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
209 }) 209 })
210 210
211 it('Should fail without nsfw attribute', async function () { 211 it('Should fail without nsfw attribute', async function () {
@@ -220,7 +220,7 @@ describe('Test videos API validator', function () {
220 const attaches = { 220 const attaches = {
221 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 221 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
222 } 222 }
223 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 223 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
224 }) 224 })
225 225
226 it('Should fail with a bad nsfw attribue', async function () { 226 it('Should fail with a bad nsfw attribue', async function () {
@@ -236,7 +236,7 @@ describe('Test videos API validator', function () {
236 const attaches = { 236 const attaches = {
237 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 237 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
238 } 238 }
239 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 239 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
240 }) 240 })
241 241
242 it('Should fail without description', async function () { 242 it('Should fail without description', async function () {
@@ -251,7 +251,7 @@ describe('Test videos API validator', function () {
251 const attaches = { 251 const attaches = {
252 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 252 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
253 } 253 }
254 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 254 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
255 }) 255 })
256 256
257 it('Should fail with a long description', async function () { 257 it('Should fail with a long description', async function () {
@@ -269,7 +269,7 @@ describe('Test videos API validator', function () {
269 const attaches = { 269 const attaches = {
270 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 270 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
271 } 271 }
272 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 272 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
273 }) 273 })
274 274
275 it('Should fail with too many tags', async function () { 275 it('Should fail with too many tags', async function () {
@@ -285,7 +285,7 @@ describe('Test videos API validator', function () {
285 const attaches = { 285 const attaches = {
286 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 286 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
287 } 287 }
288 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 288 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
289 }) 289 })
290 290
291 it('Should fail with a tag length too low', async function () { 291 it('Should fail with a tag length too low', async function () {
@@ -301,7 +301,7 @@ describe('Test videos API validator', function () {
301 const attaches = { 301 const attaches = {
302 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 302 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
303 } 303 }
304 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 304 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
305 }) 305 })
306 306
307 it('Should fail with a tag length too big', async function () { 307 it('Should fail with a tag length too big', async function () {
@@ -317,7 +317,7 @@ describe('Test videos API validator', function () {
317 const attaches = { 317 const attaches = {
318 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 318 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
319 } 319 }
320 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 320 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
321 }) 321 })
322 322
323 it('Should fail without an input file', async function () { 323 it('Should fail without an input file', async function () {
@@ -331,7 +331,7 @@ describe('Test videos API validator', function () {
331 tags: [ 'tag1', 'tag2' ] 331 tags: [ 'tag1', 'tag2' ]
332 } 332 }
333 const attaches = {} 333 const attaches = {}
334 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 334 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
335 }) 335 })
336 336
337 it('Should fail without an incorrect input file', async function () { 337 it('Should fail without an incorrect input file', async function () {
@@ -347,7 +347,7 @@ describe('Test videos API validator', function () {
347 const attaches = { 347 const attaches = {
348 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm') 348 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm')
349 } 349 }
350 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 350 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
351 }) 351 })
352 352
353 it('Should fail with a too big duration', async function () { 353 it('Should fail with a too big duration', async function () {
@@ -363,7 +363,7 @@ describe('Test videos API validator', function () {
363 const attaches = { 363 const attaches = {
364 'videofile': join(__dirname, '..', 'fixtures', 'video_too_long.webm') 364 'videofile': join(__dirname, '..', 'fixtures', 'video_too_long.webm')
365 } 365 }
366 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) 366 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
367 }) 367 })
368 368
369 it('Should succeed with the correct parameters', async function () { 369 it('Should succeed with the correct parameters', async function () {
@@ -382,13 +382,34 @@ describe('Test videos API validator', function () {
382 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm') 382 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
383 } 383 }
384 384
385 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches, statusCodeExpected: 204 }) 385 await makePostUploadRequest({
386 url: server.url,
387 path: path + '/upload',
388 token: server.accessToken,
389 fields,
390 attaches,
391 statusCodeExpected: 204
392 })
386 393
387 attaches.videofile = join(__dirname, '..', 'fixtures', 'video_short.mp4') 394 attaches.videofile = join(__dirname, '..', 'fixtures', 'video_short.mp4')
388 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches, statusCodeExpected: 204 }) 395 await makePostUploadRequest({
396 url: server.url,
397 path: path + '/upload',
398 token: server.accessToken,
399 fields,
400 attaches,
401 statusCodeExpected: 204
402 })
389 403
390 attaches.videofile = join(__dirname, '..', 'fixtures', 'video_short.ogv') 404 attaches.videofile = join(__dirname, '..', 'fixtures', 'video_short.ogv')
391 await makePostUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches, statusCodeExpected: 204 }) 405 await makePostUploadRequest({
406 url: server.url,
407 path: path + '/upload',
408 token: server.accessToken,
409 fields,
410 attaches,
411 statusCodeExpected: 204
412 })
392 }) 413 })
393 }) 414 })
394 415