aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/videos.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-24 15:10:37 +0200
committerChocobozzz <me@florianbigard.com>2019-04-24 16:26:25 +0200
commit7c3b79768bd174b22154e8d2df0b1211e01ee56a (patch)
tree9e45c9302083f0438f7ea174f5fb7d6042be5712 /server/tests/api/check-params/videos.ts
parent913b1d71e630d5a959c763bf565a171b4dc61434 (diff)
downloadPeerTube-7c3b79768bd174b22154e8d2df0b1211e01ee56a.tar.gz
PeerTube-7c3b79768bd174b22154e8d2df0b1211e01ee56a.tar.zst
PeerTube-7c3b79768bd174b22154e8d2df0b1211e01ee56a.zip
Use test wrapper exit function
Diffstat (limited to 'server/tests/api/check-params/videos.ts')
-rw-r--r--server/tests/api/check-params/videos.ts60
1 files changed, 36 insertions, 24 deletions
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index bc321e91f..51e592a15 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -6,16 +6,28 @@ import 'mocha'
6import { join } from 'path' 6import { join } from 'path'
7import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' 7import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum'
8import { 8import {
9 createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest, 9 cleanupTests,
10 makeGetRequest, makeUploadRequest, makePutBodyRequest, removeVideo, uploadVideo, 10 createUser,
11 flushAndRunServer, ServerInfo, setAccessTokensToServers, userLogin, updateCustomSubConfig 11 flushAndRunServer,
12 getMyUserInformation,
13 getVideo,
14 getVideosList,
15 immutableAssign,
16 makeDeleteRequest,
17 makeGetRequest,
18 makePutBodyRequest,
19 makeUploadRequest,
20 removeVideo,
21 ServerInfo,
22 setAccessTokensToServers,
23 userLogin,
24 root
12} from '../../../../shared/extra-utils' 25} from '../../../../shared/extra-utils'
13import { 26import {
14 checkBadCountPagination, 27 checkBadCountPagination,
15 checkBadSortPagination, 28 checkBadSortPagination,
16 checkBadStartPagination 29 checkBadStartPagination
17} from '../../../../shared/extra-utils/requests/check-api-params' 30} from '../../../../shared/extra-utils/requests/check-api-params'
18import { getAccountsList } from '../../../../shared/extra-utils/users/accounts'
19 31
20const expect = chai.expect 32const expect = chai.expect
21 33
@@ -166,7 +178,7 @@ describe('Test videos API validator', function () {
166 describe('When adding a video', function () { 178 describe('When adding a video', function () {
167 let baseCorrectParams 179 let baseCorrectParams
168 const baseCorrectAttaches = { 180 const baseCorrectAttaches = {
169 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.webm') 181 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.webm')
170 } 182 }
171 183
172 before(function () { 184 before(function () {
@@ -326,15 +338,15 @@ describe('Test videos API validator', function () {
326 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 338 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
327 }) 339 })
328 340
329 it('Should fail without an incorrect input file', async function () { 341 it('Should fail with an incorrect input file', async function () {
330 const fields = baseCorrectParams 342 const fields = baseCorrectParams
331 let attaches = { 343 let attaches = {
332 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short_fake.webm') 344 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short_fake.webm')
333 } 345 }
334 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 346 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
335 347
336 attaches = { 348 attaches = {
337 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mkv') 349 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mkv')
338 } 350 }
339 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 351 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
340 }) 352 })
@@ -342,8 +354,8 @@ describe('Test videos API validator', function () {
342 it('Should fail with an incorrect thumbnail file', async function () { 354 it('Should fail with an incorrect thumbnail file', async function () {
343 const fields = baseCorrectParams 355 const fields = baseCorrectParams
344 const attaches = { 356 const attaches = {
345 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png'), 357 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png'),
346 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') 358 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
347 } 359 }
348 360
349 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 361 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -352,8 +364,8 @@ describe('Test videos API validator', function () {
352 it('Should fail with a big thumbnail file', async function () { 364 it('Should fail with a big thumbnail file', async function () {
353 const fields = baseCorrectParams 365 const fields = baseCorrectParams
354 const attaches = { 366 const attaches = {
355 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png'), 367 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'),
356 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') 368 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
357 } 369 }
358 370
359 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 371 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -362,8 +374,8 @@ describe('Test videos API validator', function () {
362 it('Should fail with an incorrect preview file', async function () { 374 it('Should fail with an incorrect preview file', async function () {
363 const fields = baseCorrectParams 375 const fields = baseCorrectParams
364 const attaches = { 376 const attaches = {
365 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png'), 377 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png'),
366 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') 378 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
367 } 379 }
368 380
369 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 381 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -372,8 +384,8 @@ describe('Test videos API validator', function () {
372 it('Should fail with a big preview file', async function () { 384 it('Should fail with a big preview file', async function () {
373 const fields = baseCorrectParams 385 const fields = baseCorrectParams
374 const attaches = { 386 const attaches = {
375 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png'), 387 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'),
376 'videofile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') 388 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
377 } 389 }
378 390
379 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 391 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -398,7 +410,7 @@ describe('Test videos API validator', function () {
398 410
399 { 411 {
400 const attaches = immutableAssign(baseCorrectAttaches, { 412 const attaches = immutableAssign(baseCorrectAttaches, {
401 videofile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') 413 videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
402 }) 414 })
403 415
404 await makeUploadRequest({ 416 await makeUploadRequest({
@@ -413,7 +425,7 @@ describe('Test videos API validator', function () {
413 425
414 { 426 {
415 const attaches = immutableAssign(baseCorrectAttaches, { 427 const attaches = immutableAssign(baseCorrectAttaches, {
416 videofile: join(__dirname, '..', '..', 'fixtures', 'video_short.ogv') 428 videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.ogv')
417 }) 429 })
418 430
419 await makeUploadRequest({ 431 await makeUploadRequest({
@@ -550,7 +562,7 @@ describe('Test videos API validator', function () {
550 it('Should fail with an incorrect thumbnail file', async function () { 562 it('Should fail with an incorrect thumbnail file', async function () {
551 const fields = baseCorrectParams 563 const fields = baseCorrectParams
552 const attaches = { 564 const attaches = {
553 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') 565 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png')
554 } 566 }
555 567
556 await makeUploadRequest({ 568 await makeUploadRequest({
@@ -566,7 +578,7 @@ describe('Test videos API validator', function () {
566 it('Should fail with a big thumbnail file', async function () { 578 it('Should fail with a big thumbnail file', async function () {
567 const fields = baseCorrectParams 579 const fields = baseCorrectParams
568 const attaches = { 580 const attaches = {
569 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') 581 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')
570 } 582 }
571 583
572 await makeUploadRequest({ 584 await makeUploadRequest({
@@ -582,7 +594,7 @@ describe('Test videos API validator', function () {
582 it('Should fail with an incorrect preview file', async function () { 594 it('Should fail with an incorrect preview file', async function () {
583 const fields = baseCorrectParams 595 const fields = baseCorrectParams
584 const attaches = { 596 const attaches = {
585 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') 597 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png')
586 } 598 }
587 599
588 await makeUploadRequest({ 600 await makeUploadRequest({
@@ -598,7 +610,7 @@ describe('Test videos API validator', function () {
598 it('Should fail with a big preview file', async function () { 610 it('Should fail with a big preview file', async function () {
599 const fields = baseCorrectParams 611 const fields = baseCorrectParams
600 const attaches = { 612 const attaches = {
601 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') 613 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')
602 } 614 }
603 615
604 await makeUploadRequest({ 616 await makeUploadRequest({
@@ -728,7 +740,7 @@ describe('Test videos API validator', function () {
728 }) 740 })
729 }) 741 })
730 742
731 after(function () { 743 after(async function () {
732 killallServers([ server ]) 744 await cleanupTests([ server ])
733 }) 745 })
734}) 746})