diff options
Diffstat (limited to 'server/tests/api/videos')
23 files changed, 145 insertions, 121 deletions
diff --git a/server/tests/api/videos/audio-only.ts b/server/tests/api/videos/audio-only.ts index f4b635bd5..e58360ffe 100644 --- a/server/tests/api/videos/audio-only.ts +++ b/server/tests/api/videos/audio-only.ts | |||
@@ -3,7 +3,14 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' | 5 | import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' |
6 | import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 6 | import { |
7 | cleanupTests, | ||
8 | createMultipleServers, | ||
9 | doubleFollow, | ||
10 | PeerTubeServer, | ||
11 | setAccessTokensToServers, | ||
12 | waitJobs | ||
13 | } from '@shared/server-commands' | ||
7 | 14 | ||
8 | const expect = chai.expect | 15 | const expect = chai.expect |
9 | 16 | ||
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index c6c279064..ecdd36613 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts | |||
@@ -4,23 +4,24 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import request from 'supertest' | 5 | import request from 'supertest' |
6 | import { | 6 | import { |
7 | buildAbsoluteFixturePath, | ||
8 | checkTmpIsEmpty, | 7 | checkTmpIsEmpty, |
9 | checkVideoFilesWereRemoved, | 8 | checkVideoFilesWereRemoved, |
10 | cleanupTests, | ||
11 | completeVideoCheck, | 9 | completeVideoCheck, |
12 | createMultipleServers, | ||
13 | dateIsValid, | 10 | dateIsValid, |
11 | saveVideoInServers, | ||
12 | testImage | ||
13 | } from '@server/tests/shared' | ||
14 | import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' | ||
15 | import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@shared/models' | ||
16 | import { | ||
17 | cleanupTests, | ||
18 | createMultipleServers, | ||
14 | doubleFollow, | 19 | doubleFollow, |
15 | PeerTubeServer, | 20 | PeerTubeServer, |
16 | saveVideoInServers, | ||
17 | setAccessTokensToServers, | 21 | setAccessTokensToServers, |
18 | testImage, | ||
19 | wait, | ||
20 | waitJobs, | 22 | waitJobs, |
21 | webtorrentAdd | 23 | webtorrentAdd |
22 | } from '@shared/extra-utils' | 24 | } from '@shared/server-commands' |
23 | import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@shared/models' | ||
24 | 25 | ||
25 | const expect = chai.expect | 26 | const expect = chai.expect |
26 | 27 | ||
@@ -379,7 +380,7 @@ describe('Test multiple servers', function () { | |||
379 | 380 | ||
380 | describe('Should seed the uploaded video', function () { | 381 | describe('Should seed the uploaded video', function () { |
381 | it('Should add the file 1 by asking server 3', async function () { | 382 | it('Should add the file 1 by asking server 3', async function () { |
382 | this.timeout(10000) | 383 | this.timeout(30000) |
383 | 384 | ||
384 | const { data } = await servers[2].videos.list() | 385 | const { data } = await servers[2].videos.list() |
385 | 386 | ||
@@ -395,7 +396,7 @@ describe('Test multiple servers', function () { | |||
395 | }) | 396 | }) |
396 | 397 | ||
397 | it('Should add the file 2 by asking server 1', async function () { | 398 | it('Should add the file 2 by asking server 1', async function () { |
398 | this.timeout(10000) | 399 | this.timeout(30000) |
399 | 400 | ||
400 | const { data } = await servers[0].videos.list() | 401 | const { data } = await servers[0].videos.list() |
401 | 402 | ||
@@ -409,7 +410,7 @@ describe('Test multiple servers', function () { | |||
409 | }) | 410 | }) |
410 | 411 | ||
411 | it('Should add the file 3 by asking server 2', async function () { | 412 | it('Should add the file 3 by asking server 2', async function () { |
412 | this.timeout(10000) | 413 | this.timeout(30000) |
413 | 414 | ||
414 | const { data } = await servers[1].videos.list() | 415 | const { data } = await servers[1].videos.list() |
415 | 416 | ||
@@ -423,7 +424,7 @@ describe('Test multiple servers', function () { | |||
423 | }) | 424 | }) |
424 | 425 | ||
425 | it('Should add the file 3-2 by asking server 1', async function () { | 426 | it('Should add the file 3-2 by asking server 1', async function () { |
426 | this.timeout(10000) | 427 | this.timeout(30000) |
427 | 428 | ||
428 | const { data } = await servers[0].videos.list() | 429 | const { data } = await servers[0].videos.list() |
429 | 430 | ||
@@ -437,7 +438,7 @@ describe('Test multiple servers', function () { | |||
437 | }) | 438 | }) |
438 | 439 | ||
439 | it('Should add the file 2 in 360p by asking server 1', async function () { | 440 | it('Should add the file 2 in 360p by asking server 1', async function () { |
440 | this.timeout(10000) | 441 | this.timeout(30000) |
441 | 442 | ||
442 | const { data } = await servers[0].videos.list() | 443 | const { data } = await servers[0].videos.list() |
443 | 444 | ||
@@ -594,7 +595,7 @@ describe('Test multiple servers', function () { | |||
594 | let updatedAtMin: Date | 595 | let updatedAtMin: Date |
595 | 596 | ||
596 | it('Should update video 3', async function () { | 597 | it('Should update video 3', async function () { |
597 | this.timeout(10000) | 598 | this.timeout(30000) |
598 | 599 | ||
599 | const attributes = { | 600 | const attributes = { |
600 | name: 'my super video updated', | 601 | name: 'my super video updated', |
@@ -617,7 +618,7 @@ describe('Test multiple servers', function () { | |||
617 | }) | 618 | }) |
618 | 619 | ||
619 | it('Should have the video 3 updated on each server', async function () { | 620 | it('Should have the video 3 updated on each server', async function () { |
620 | this.timeout(10000) | 621 | this.timeout(30000) |
621 | 622 | ||
622 | for (const server of servers) { | 623 | for (const server of servers) { |
623 | const { data } = await server.videos.list() | 624 | const { data } = await server.videos.list() |
@@ -668,7 +669,7 @@ describe('Test multiple servers', function () { | |||
668 | }) | 669 | }) |
669 | 670 | ||
670 | it('Should only update thumbnail and update updatedAt attribute', async function () { | 671 | it('Should only update thumbnail and update updatedAt attribute', async function () { |
671 | this.timeout(10000) | 672 | this.timeout(30000) |
672 | 673 | ||
673 | const attributes = { | 674 | const attributes = { |
674 | thumbnailfile: 'thumbnail.jpg' | 675 | thumbnailfile: 'thumbnail.jpg' |
@@ -860,7 +861,7 @@ describe('Test multiple servers', function () { | |||
860 | }) | 861 | }) |
861 | 862 | ||
862 | it('Should delete a reply', async function () { | 863 | it('Should delete a reply', async function () { |
863 | this.timeout(10000) | 864 | this.timeout(30000) |
864 | 865 | ||
865 | await servers[2].comments.delete({ videoId: videoUUID, commentId: childOfFirstChild.comment.id }) | 866 | await servers[2].comments.delete({ videoId: videoUUID, commentId: childOfFirstChild.comment.id }) |
866 | 867 | ||
@@ -891,7 +892,7 @@ describe('Test multiple servers', function () { | |||
891 | }) | 892 | }) |
892 | 893 | ||
893 | it('Should delete the thread comments', async function () { | 894 | it('Should delete the thread comments', async function () { |
894 | this.timeout(10000) | 895 | this.timeout(30000) |
895 | 896 | ||
896 | const { data } = await servers[0].comments.listThreads({ videoId: videoUUID }) | 897 | const { data } = await servers[0].comments.listThreads({ videoId: videoUUID }) |
897 | const commentId = data.find(c => c.text === 'my super first comment').id | 898 | const commentId = data.find(c => c.text === 'my super first comment').id |
diff --git a/server/tests/api/videos/resumable-upload.ts b/server/tests/api/videos/resumable-upload.ts index 1ba7cdbcc..d6f4da630 100644 --- a/server/tests/api/videos/resumable-upload.ts +++ b/server/tests/api/videos/resumable-upload.ts | |||
@@ -4,15 +4,9 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { pathExists, readdir, stat } from 'fs-extra' | 5 | import { pathExists, readdir, stat } from 'fs-extra' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { | 7 | import { buildAbsoluteFixturePath } from '@shared/core-utils' |
8 | buildAbsoluteFixturePath, | ||
9 | cleanupTests, | ||
10 | createSingleServer, | ||
11 | PeerTubeServer, | ||
12 | setAccessTokensToServers, | ||
13 | setDefaultVideoChannel | ||
14 | } from '@shared/extra-utils' | ||
15 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' | 8 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' |
9 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands' | ||
16 | 10 | ||
17 | const expect = chai.expect | 11 | const expect = chai.expect |
18 | 12 | ||
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index a0e4a156c..28bf018c5 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts | |||
@@ -2,17 +2,10 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { checkVideoFilesWereRemoved, completeVideoCheck, testImage } from '@server/tests/shared' |
6 | checkVideoFilesWereRemoved, | 6 | import { wait } from '@shared/core-utils' |
7 | cleanupTests, | ||
8 | completeVideoCheck, | ||
9 | createSingleServer, | ||
10 | PeerTubeServer, | ||
11 | setAccessTokensToServers, | ||
12 | testImage, | ||
13 | wait | ||
14 | } from '@shared/extra-utils' | ||
15 | import { Video, VideoPrivacy } from '@shared/models' | 7 | import { Video, VideoPrivacy } from '@shared/models' |
8 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' | ||
16 | 9 | ||
17 | const expect = chai.expect | 10 | const expect = chai.expect |
18 | 11 | ||
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts index 3bb0d131c..b7f26c35f 100644 --- a/server/tests/api/videos/video-captions.ts +++ b/server/tests/api/videos/video-captions.ts | |||
@@ -2,17 +2,16 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { checkVideoFilesWereRemoved, testCaptionFile } from '@server/tests/shared' | ||
6 | import { wait } from '@shared/core-utils' | ||
5 | import { | 7 | import { |
6 | checkVideoFilesWereRemoved, | ||
7 | cleanupTests, | 8 | cleanupTests, |
8 | createMultipleServers, | 9 | createMultipleServers, |
9 | doubleFollow, | 10 | doubleFollow, |
10 | PeerTubeServer, | 11 | PeerTubeServer, |
11 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
12 | testCaptionFile, | ||
13 | wait, | ||
14 | waitJobs | 13 | waitJobs |
15 | } from '@shared/extra-utils' | 14 | } from '@shared/server-commands' |
16 | 15 | ||
17 | const expect = chai.expect | 16 | const expect = chai.expect |
18 | 17 | ||
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts index d6665fe4e..6c229c6cf 100644 --- a/server/tests/api/videos/video-change-ownership.ts +++ b/server/tests/api/videos/video-change-ownership.ts | |||
@@ -12,7 +12,7 @@ import { | |||
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | setDefaultVideoChannel, | 13 | setDefaultVideoChannel, |
14 | waitJobs | 14 | waitJobs |
15 | } from '@shared/extra-utils' | 15 | } from '@shared/server-commands' |
16 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' | 16 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' |
17 | 17 | ||
18 | const expect = chai.expect | 18 | const expect = chai.expect |
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index c25754eb6..d435f3682 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts | |||
@@ -4,6 +4,9 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { basename } from 'path' | 5 | import { basename } from 'path' |
6 | import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants' | 6 | import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants' |
7 | import { testFileExistsOrNot, testImage } from '@server/tests/shared' | ||
8 | import { wait } from '@shared/core-utils' | ||
9 | import { User, VideoChannel } from '@shared/models' | ||
7 | import { | 10 | import { |
8 | cleanupTests, | 11 | cleanupTests, |
9 | createMultipleServers, | 12 | createMultipleServers, |
@@ -11,12 +14,8 @@ import { | |||
11 | PeerTubeServer, | 14 | PeerTubeServer, |
12 | setAccessTokensToServers, | 15 | setAccessTokensToServers, |
13 | setDefaultVideoChannel, | 16 | setDefaultVideoChannel, |
14 | testFileExistsOrNot, | ||
15 | testImage, | ||
16 | wait, | ||
17 | waitJobs | 17 | waitJobs |
18 | } from '@shared/extra-utils' | 18 | } from '@shared/server-commands' |
19 | import { User, VideoChannel } from '@shared/models' | ||
20 | 19 | ||
21 | const expect = chai.expect | 20 | const expect = chai.expect |
22 | 21 | ||
@@ -33,6 +32,7 @@ describe('Test video channels', function () { | |||
33 | let totoChannel: number | 32 | let totoChannel: number |
34 | let videoUUID: string | 33 | let videoUUID: string |
35 | let accountName: string | 34 | let accountName: string |
35 | let secondUserChannelName: string | ||
36 | 36 | ||
37 | const avatarPaths: { [ port: number ]: string } = {} | 37 | const avatarPaths: { [ port: number ]: string } = {} |
38 | const bannerPaths: { [ port: number ]: string } = {} | 38 | const bannerPaths: { [ port: number ]: string } = {} |
@@ -219,6 +219,35 @@ describe('Test video channels', function () { | |||
219 | } | 219 | } |
220 | }) | 220 | }) |
221 | 221 | ||
222 | it('Should update another accounts video channel', async function () { | ||
223 | this.timeout(15000) | ||
224 | |||
225 | const result = await servers[0].users.generate('second_user') | ||
226 | secondUserChannelName = result.userChannelName | ||
227 | |||
228 | await servers[0].videos.quickUpload({ name: 'video', token: result.token }) | ||
229 | |||
230 | const videoChannelAttributes = { | ||
231 | displayName: 'video channel updated', | ||
232 | description: 'video channel description updated', | ||
233 | support: 'support updated' | ||
234 | } | ||
235 | |||
236 | await servers[0].channels.update({ channelName: secondUserChannelName, attributes: videoChannelAttributes }) | ||
237 | |||
238 | await waitJobs(servers) | ||
239 | }) | ||
240 | |||
241 | it('Should have another accounts video channel updated', async function () { | ||
242 | for (const server of servers) { | ||
243 | const body = await server.channels.get({ channelName: `${secondUserChannelName}@${servers[0].host}` }) | ||
244 | |||
245 | expect(body.displayName).to.equal('video channel updated') | ||
246 | expect(body.description).to.equal('video channel description updated') | ||
247 | expect(body.support).to.equal('support updated') | ||
248 | } | ||
249 | }) | ||
250 | |||
222 | it('Should update the channel support field and update videos too', async function () { | 251 | it('Should update the channel support field and update videos too', async function () { |
223 | this.timeout(35000) | 252 | this.timeout(35000) |
224 | 253 | ||
@@ -368,12 +397,13 @@ describe('Test video channels', function () { | |||
368 | }) | 397 | }) |
369 | 398 | ||
370 | it('Should have video channel deleted', async function () { | 399 | it('Should have video channel deleted', async function () { |
371 | const body = await servers[0].channels.list({ start: 0, count: 10 }) | 400 | const body = await servers[0].channels.list({ start: 0, count: 10, sort: 'createdAt' }) |
372 | 401 | ||
373 | expect(body.total).to.equal(1) | 402 | expect(body.total).to.equal(2) |
374 | expect(body.data).to.be.an('array') | 403 | expect(body.data).to.be.an('array') |
375 | expect(body.data).to.have.lengthOf(1) | 404 | expect(body.data).to.have.lengthOf(2) |
376 | expect(body.data[0].displayName).to.equal('Main root channel') | 405 | expect(body.data[0].displayName).to.equal('Main root channel') |
406 | expect(body.data[1].displayName).to.equal('video channel updated') | ||
377 | }) | 407 | }) |
378 | 408 | ||
379 | it('Should create the main channel with an uuid if there is a conflict', async function () { | 409 | it('Should create the main channel with an uuid if there is a conflict', async function () { |
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts index 61ee54540..2ae523970 100644 --- a/server/tests/api/videos/video-comments.ts +++ b/server/tests/api/videos/video-comments.ts | |||
@@ -2,15 +2,8 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { dateIsValid, testImage } from '@server/tests/shared' |
6 | cleanupTests, | 6 | import { cleanupTests, CommentsCommand, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' |
7 | CommentsCommand, | ||
8 | createSingleServer, | ||
9 | dateIsValid, | ||
10 | PeerTubeServer, | ||
11 | setAccessTokensToServers, | ||
12 | testImage | ||
13 | } from '@shared/extra-utils' | ||
14 | 7 | ||
15 | const expect = chai.expect | 8 | const expect = chai.expect |
16 | 9 | ||
diff --git a/server/tests/api/videos/video-create-transcoding.ts b/server/tests/api/videos/video-create-transcoding.ts index c4627e0c1..62a6bab0d 100644 --- a/server/tests/api/videos/video-create-transcoding.ts +++ b/server/tests/api/videos/video-create-transcoding.ts | |||
@@ -2,20 +2,20 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { expectStartWith } from '@server/tests/shared' | ||
6 | import { areObjectStorageTestsDisabled } from '@shared/core-utils' | ||
7 | import { HttpStatusCode, VideoDetails } from '@shared/models' | ||
5 | import { | 8 | import { |
6 | areObjectStorageTestsDisabled, | ||
7 | cleanupTests, | 9 | cleanupTests, |
8 | createMultipleServers, | 10 | createMultipleServers, |
9 | doubleFollow, | 11 | doubleFollow, |
10 | expectNoFailedTranscodingJob, | 12 | expectNoFailedTranscodingJob, |
11 | expectStartWith, | ||
12 | makeRawRequest, | 13 | makeRawRequest, |
13 | ObjectStorageCommand, | 14 | ObjectStorageCommand, |
14 | PeerTubeServer, | 15 | PeerTubeServer, |
15 | setAccessTokensToServers, | 16 | setAccessTokensToServers, |
16 | waitJobs | 17 | waitJobs |
17 | } from '@shared/extra-utils' | 18 | } from '@shared/server-commands' |
18 | import { HttpStatusCode, VideoDetails } from '@shared/models' | ||
19 | 19 | ||
20 | const expect = chai.expect | 20 | const expect = chai.expect |
21 | 21 | ||
diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.ts index d22b4ed96..20b20488f 100644 --- a/server/tests/api/videos/video-description.ts +++ b/server/tests/api/videos/video-description.ts | |||
@@ -2,7 +2,14 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 5 | import { |
6 | cleanupTests, | ||
7 | createMultipleServers, | ||
8 | doubleFollow, | ||
9 | PeerTubeServer, | ||
10 | setAccessTokensToServers, | ||
11 | waitJobs | ||
12 | } from '@shared/server-commands' | ||
6 | 13 | ||
7 | const expect = chai.expect | 14 | const expect = chai.expect |
8 | 15 | ||
diff --git a/server/tests/api/videos/video-files.ts b/server/tests/api/videos/video-files.ts index fcb2ca2e4..b0ef4a2e9 100644 --- a/server/tests/api/videos/video-files.ts +++ b/server/tests/api/videos/video-files.ts | |||
@@ -2,7 +2,14 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 5 | import { |
6 | cleanupTests, | ||
7 | createMultipleServers, | ||
8 | doubleFollow, | ||
9 | PeerTubeServer, | ||
10 | setAccessTokensToServers, | ||
11 | waitJobs | ||
12 | } from '@shared/server-commands' | ||
6 | 13 | ||
7 | describe('Test videos files', function () { | 14 | describe('Test videos files', function () { |
8 | let servers: PeerTubeServer[] | 15 | let servers: PeerTubeServer[] |
diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts index a18c3d672..218ec08ae 100644 --- a/server/tests/api/videos/video-hls.ts +++ b/server/tests/api/videos/video-hls.ts | |||
@@ -3,26 +3,27 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { basename, join } from 'path' | 5 | import { basename, join } from 'path' |
6 | import { removeFragmentedMP4Ext, uuidRegex } from '@shared/core-utils' | ||
7 | import { | 6 | import { |
8 | areObjectStorageTestsDisabled, | ||
9 | checkDirectoryIsEmpty, | 7 | checkDirectoryIsEmpty, |
10 | checkResolutionsInMasterPlaylist, | 8 | checkResolutionsInMasterPlaylist, |
11 | checkSegmentHash, | 9 | checkSegmentHash, |
12 | checkTmpIsEmpty, | 10 | checkTmpIsEmpty, |
11 | expectStartWith, | ||
12 | hlsInfohashExist | ||
13 | } from '@server/tests/shared' | ||
14 | import { areObjectStorageTestsDisabled, removeFragmentedMP4Ext, uuidRegex } from '@shared/core-utils' | ||
15 | import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models' | ||
16 | import { | ||
13 | cleanupTests, | 17 | cleanupTests, |
14 | createMultipleServers, | 18 | createMultipleServers, |
15 | doubleFollow, | 19 | doubleFollow, |
16 | expectStartWith, | ||
17 | hlsInfohashExist, | ||
18 | makeRawRequest, | 20 | makeRawRequest, |
19 | ObjectStorageCommand, | 21 | ObjectStorageCommand, |
20 | PeerTubeServer, | 22 | PeerTubeServer, |
21 | setAccessTokensToServers, | 23 | setAccessTokensToServers, |
22 | waitJobs, | 24 | waitJobs, |
23 | webtorrentAdd | 25 | webtorrentAdd |
24 | } from '@shared/extra-utils' | 26 | } from '@shared/server-commands' |
25 | import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models' | ||
26 | import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants' | 27 | import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants' |
27 | 28 | ||
28 | const expect = chai.expect | 29 | const expect = chai.expect |
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts index b6168b54e..e8e0f01f1 100644 --- a/server/tests/api/videos/video-imports.ts +++ b/server/tests/api/videos/video-imports.ts | |||
@@ -4,21 +4,19 @@ import 'mocha' | |||
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { pathExists, readdir, remove } from 'fs-extra' | 5 | import { pathExists, readdir, remove } from 'fs-extra' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { FIXTURE_URLS, testCaptionFile, testImage } from '@server/tests/shared' | ||
8 | import { areHttpImportTestsDisabled } from '@shared/core-utils' | ||
9 | import { VideoPrivacy, VideoResolution } from '@shared/models' | ||
7 | import { | 10 | import { |
8 | areHttpImportTestsDisabled, | ||
9 | cleanupTests, | 11 | cleanupTests, |
10 | createMultipleServers, | 12 | createMultipleServers, |
11 | createSingleServer, | 13 | createSingleServer, |
12 | doubleFollow, | 14 | doubleFollow, |
13 | FIXTURE_URLS, | ||
14 | PeerTubeServer, | 15 | PeerTubeServer, |
15 | setAccessTokensToServers, | 16 | setAccessTokensToServers, |
16 | setDefaultVideoChannel, | 17 | setDefaultVideoChannel, |
17 | testCaptionFile, | ||
18 | testImage, | ||
19 | waitJobs | 18 | waitJobs |
20 | } from '@shared/extra-utils' | 19 | } from '@shared/server-commands' |
21 | import { VideoPrivacy, VideoResolution } from '@shared/models' | ||
22 | 20 | ||
23 | async function checkVideosServer1 (server: PeerTubeServer, idHttp: string, idMagnet: string, idTorrent: string) { | 21 | async function checkVideosServer1 (server: PeerTubeServer, idHttp: string, idMagnet: string, idTorrent: string) { |
24 | const videoHttp = await server.videos.get({ id: idHttp }) | 22 | const videoHttp = await server.videos.get({ id: idHttp }) |
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts index b5d183d62..99ea67a0f 100644 --- a/server/tests/api/videos/video-nsfw.ts +++ b/server/tests/api/videos/video-nsfw.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' |
6 | import { BooleanBothQuery, CustomConfig, ResultList, Video, VideosOverview } from '@shared/models' | 6 | import { BooleanBothQuery, CustomConfig, ResultList, Video, VideosOverview } from '@shared/models' |
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
diff --git a/server/tests/api/videos/video-playlist-thumbnails.ts b/server/tests/api/videos/video-playlist-thumbnails.ts index f0b2ca169..5fdb0fc03 100644 --- a/server/tests/api/videos/video-playlist-thumbnails.ts +++ b/server/tests/api/videos/video-playlist-thumbnails.ts | |||
@@ -2,6 +2,8 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { testImage } from '@server/tests/shared' | ||
6 | import { VideoPlaylistPrivacy } from '@shared/models' | ||
5 | import { | 7 | import { |
6 | cleanupTests, | 8 | cleanupTests, |
7 | createMultipleServers, | 9 | createMultipleServers, |
@@ -9,10 +11,8 @@ import { | |||
9 | PeerTubeServer, | 11 | PeerTubeServer, |
10 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
11 | setDefaultVideoChannel, | 13 | setDefaultVideoChannel, |
12 | testImage, | ||
13 | waitJobs | 14 | waitJobs |
14 | } from '../../../../shared/extra-utils' | 15 | } from '@shared/server-commands' |
15 | import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model' | ||
16 | 16 | ||
17 | const expect = chai.expect | 17 | const expect = chai.expect |
18 | 18 | ||
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index f42aee2ff..34327334f 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts | |||
@@ -2,19 +2,8 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { checkPlaylistFilesWereRemoved, testImage } from '@server/tests/shared' |
6 | checkPlaylistFilesWereRemoved, | 6 | import { wait } from '@shared/core-utils' |
7 | cleanupTests, | ||
8 | createMultipleServers, | ||
9 | doubleFollow, | ||
10 | PeerTubeServer, | ||
11 | PlaylistsCommand, | ||
12 | setAccessTokensToServers, | ||
13 | setDefaultVideoChannel, | ||
14 | testImage, | ||
15 | wait, | ||
16 | waitJobs | ||
17 | } from '@shared/extra-utils' | ||
18 | import { | 7 | import { |
19 | HttpStatusCode, | 8 | HttpStatusCode, |
20 | VideoPlaylist, | 9 | VideoPlaylist, |
@@ -24,6 +13,16 @@ import { | |||
24 | VideoPlaylistType, | 13 | VideoPlaylistType, |
25 | VideoPrivacy | 14 | VideoPrivacy |
26 | } from '@shared/models' | 15 | } from '@shared/models' |
16 | import { | ||
17 | cleanupTests, | ||
18 | createMultipleServers, | ||
19 | doubleFollow, | ||
20 | PeerTubeServer, | ||
21 | PlaylistsCommand, | ||
22 | setAccessTokensToServers, | ||
23 | setDefaultVideoChannel, | ||
24 | waitJobs | ||
25 | } from '@shared/server-commands' | ||
27 | 26 | ||
28 | const expect = chai.expect | 27 | const expect = chai.expect |
29 | 28 | ||
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts index b51b3bcdd..3051a443d 100644 --- a/server/tests/api/videos/video-privacy.ts +++ b/server/tests/api/videos/video-privacy.ts | |||
@@ -2,8 +2,9 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, createSingleServer, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 5 | import { wait } from '@shared/core-utils' |
6 | import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' | 6 | import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' |
7 | import { cleanupTests, createSingleServer, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' | ||
7 | 8 | ||
8 | const expect = chai.expect | 9 | const expect = chai.expect |
9 | 10 | ||
@@ -209,7 +210,7 @@ describe('Test video privacy', function () { | |||
209 | describe('Privacy update', function () { | 210 | describe('Privacy update', function () { |
210 | 211 | ||
211 | it('Should update the private and internal videos to public on server 1', async function () { | 212 | it('Should update the private and internal videos to public on server 1', async function () { |
212 | this.timeout(10000) | 213 | this.timeout(100000) |
213 | 214 | ||
214 | now = Date.now() | 215 | now = Date.now() |
215 | 216 | ||
@@ -230,6 +231,7 @@ describe('Test video privacy', function () { | |||
230 | await servers[0].videos.update({ id: internalVideoId, attributes }) | 231 | await servers[0].videos.update({ id: internalVideoId, attributes }) |
231 | } | 232 | } |
232 | 233 | ||
234 | await wait(10000) | ||
233 | await waitJobs(servers) | 235 | await waitJobs(servers) |
234 | }) | 236 | }) |
235 | 237 | ||
diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts index 3f7738784..00b4f6cbc 100644 --- a/server/tests/api/videos/video-schedule-update.ts +++ b/server/tests/api/videos/video-schedule-update.ts | |||
@@ -2,16 +2,16 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { wait } from '@shared/core-utils' | ||
6 | import { VideoPrivacy } from '@shared/models' | ||
5 | import { | 7 | import { |
6 | cleanupTests, | 8 | cleanupTests, |
7 | createMultipleServers, | 9 | createMultipleServers, |
8 | doubleFollow, | 10 | doubleFollow, |
9 | PeerTubeServer, | 11 | PeerTubeServer, |
10 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
11 | wait, | ||
12 | waitJobs | 13 | waitJobs |
13 | } from '@shared/extra-utils' | 14 | } from '@shared/server-commands' |
14 | import { VideoPrivacy } from '@shared/models' | ||
15 | 15 | ||
16 | const expect = chai.expect | 16 | const expect = chai.expect |
17 | 17 | ||
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts index 7ed55b8e8..d24a8f4e1 100644 --- a/server/tests/api/videos/video-transcoder.ts +++ b/server/tests/api/videos/video-transcoder.ts | |||
@@ -3,29 +3,21 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { omit } from 'lodash' | 5 | import { omit } from 'lodash' |
6 | import { getMaxBitrate, getMinLimitBitrate } from '@shared/core-utils' | 6 | import { canDoQuickTranscode } from '@server/helpers/ffprobe-utils' |
7 | import { generateHighBitrateVideo, generateVideoWithFramerate } from '@server/tests/shared' | ||
8 | import { buildAbsoluteFixturePath, getMaxBitrate, getMinLimitBitrate } from '@shared/core-utils' | ||
9 | import { getAudioStream, getMetadataFromFile, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '@shared/extra-utils' | ||
10 | import { HttpStatusCode, VideoState } from '@shared/models' | ||
7 | import { | 11 | import { |
8 | buildAbsoluteFixturePath, | ||
9 | cleanupTests, | 12 | cleanupTests, |
10 | createMultipleServers, | 13 | createMultipleServers, |
11 | doubleFollow, | 14 | doubleFollow, |
12 | generateHighBitrateVideo, | ||
13 | generateVideoWithFramerate, | ||
14 | makeGetRequest, | 15 | makeGetRequest, |
15 | PeerTubeServer, | 16 | PeerTubeServer, |
16 | setAccessTokensToServers, | 17 | setAccessTokensToServers, |
17 | waitJobs, | 18 | waitJobs, |
18 | webtorrentAdd | 19 | webtorrentAdd |
19 | } from '@shared/extra-utils' | 20 | } from '@shared/server-commands' |
20 | import { HttpStatusCode, VideoState } from '@shared/models' | ||
21 | import { | ||
22 | canDoQuickTranscode, | ||
23 | getAudioStream, | ||
24 | getMetadataFromFile, | ||
25 | getVideoFileBitrate, | ||
26 | getVideoFileFPS, | ||
27 | getVideoFileResolution | ||
28 | } from '../../../helpers/ffprobe-utils' | ||
29 | 21 | ||
30 | const expect = chai.expect | 22 | const expect = chai.expect |
31 | 23 | ||
diff --git a/server/tests/api/videos/videos-common-filters.ts b/server/tests/api/videos/videos-common-filters.ts index ca5f42173..0254662c5 100644 --- a/server/tests/api/videos/videos-common-filters.ts +++ b/server/tests/api/videos/videos-common-filters.ts | |||
@@ -12,7 +12,7 @@ import { | |||
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | setDefaultVideoChannel, | 13 | setDefaultVideoChannel, |
14 | waitJobs | 14 | waitJobs |
15 | } from '@shared/extra-utils' | 15 | } from '@shared/server-commands' |
16 | import { HttpStatusCode, UserRole, Video, VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models' | 16 | import { HttpStatusCode, UserRole, Video, VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models' |
17 | 17 | ||
18 | describe('Test videos filter', function () { | 18 | describe('Test videos filter', function () { |
diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts index e4bc0bb3a..4e5ba13aa 100644 --- a/server/tests/api/videos/videos-history.ts +++ b/server/tests/api/videos/videos-history.ts | |||
@@ -2,16 +2,16 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { wait } from '@shared/core-utils' | ||
6 | import { HttpStatusCode, Video } from '@shared/models' | ||
5 | import { | 7 | import { |
6 | cleanupTests, | 8 | cleanupTests, |
7 | createSingleServer, | 9 | createSingleServer, |
8 | HistoryCommand, | 10 | HistoryCommand, |
9 | killallServers, | 11 | killallServers, |
10 | PeerTubeServer, | 12 | PeerTubeServer, |
11 | setAccessTokensToServers, | 13 | setAccessTokensToServers |
12 | wait | 14 | } from '@shared/server-commands' |
13 | } from '@shared/extra-utils' | ||
14 | import { HttpStatusCode, Video } from '@shared/models' | ||
15 | 15 | ||
16 | const expect = chai.expect | 16 | const expect = chai.expect |
17 | 17 | ||
diff --git a/server/tests/api/videos/videos-overview.ts b/server/tests/api/videos/videos-overview.ts index 70aa66549..61fc0cb20 100644 --- a/server/tests/api/videos/videos-overview.ts +++ b/server/tests/api/videos/videos-overview.ts | |||
@@ -2,8 +2,9 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils' | 5 | import { wait } from '@shared/core-utils' |
6 | import { VideosOverview } from '@shared/models' | 6 | import { VideosOverview } from '@shared/models' |
7 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' | ||
7 | 8 | ||
8 | const expect = chai.expect | 9 | const expect = chai.expect |
9 | 10 | ||
diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts index 82268b1be..e6815a4a8 100644 --- a/server/tests/api/videos/videos-views-cleaner.ts +++ b/server/tests/api/videos/videos-views-cleaner.ts | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { wait } from '@shared/core-utils' | ||
5 | import { | 6 | import { |
6 | cleanupTests, | 7 | cleanupTests, |
7 | createMultipleServers, | 8 | createMultipleServers, |
@@ -9,9 +10,8 @@ import { | |||
9 | killallServers, | 10 | killallServers, |
10 | PeerTubeServer, | 11 | PeerTubeServer, |
11 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
12 | wait, | ||
13 | waitJobs | 13 | waitJobs |
14 | } from '../../../../shared/extra-utils' | 14 | } from '@shared/server-commands' |
15 | 15 | ||
16 | const expect = chai.expect | 16 | const expect = chai.expect |
17 | 17 | ||