aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/lib/activitypub/process/process-create.ts1
-rw-r--r--server/tests/api/activitypub/client.ts6
-rw-r--r--server/tests/api/activitypub/fetch.ts9
-rw-r--r--server/tests/api/activitypub/helpers.ts2
-rw-r--r--server/tests/api/activitypub/refresher.ts17
-rw-r--r--server/tests/api/activitypub/security.ts12
-rw-r--r--server/tests/api/check-params/accounts.ts10
-rw-r--r--server/tests/api/check-params/blocklist.ts8
-rw-r--r--server/tests/api/check-params/config.ts2
-rw-r--r--server/tests/api/check-params/follows.ts8
-rw-r--r--server/tests/api/check-params/jobs.ts18
-rw-r--r--server/tests/api/check-params/redundancy.ts2
-rw-r--r--server/tests/api/check-params/search.ts8
-rw-r--r--server/tests/api/check-params/services.ts10
-rw-r--r--server/tests/api/check-params/user-subscriptions.ts11
-rw-r--r--server/tests/api/check-params/users.ts12
-rw-r--r--server/tests/api/check-params/video-abuses.ts8
-rw-r--r--server/tests/api/check-params/video-blacklist.ts8
-rw-r--r--server/tests/api/check-params/video-captions.ts4
-rw-r--r--server/tests/api/check-params/video-channels.ts8
-rw-r--r--server/tests/api/check-params/video-comments.ts10
-rw-r--r--server/tests/api/check-params/video-imports.ts10
-rw-r--r--server/tests/api/check-params/videos-filter.ts2
-rw-r--r--server/tests/api/check-params/videos-history.ts2
-rw-r--r--server/tests/api/check-params/videos.ts10
-rw-r--r--server/tests/api/redundancy/redundancy.ts9
-rw-r--r--server/tests/api/search/search-activitypub-video-channels.ts6
-rw-r--r--server/tests/api/search/search-activitypub-videos.ts4
-rw-r--r--server/tests/api/search/search-videos.ts2
-rw-r--r--server/tests/api/server/config.ts7
-rw-r--r--server/tests/api/server/email.ts13
-rw-r--r--server/tests/api/server/follow-constraints.ts20
-rw-r--r--server/tests/api/server/follows.ts27
-rw-r--r--server/tests/api/server/handle-down.ts17
-rw-r--r--server/tests/api/server/jobs.ts12
-rw-r--r--server/tests/api/server/no-client.ts4
-rw-r--r--server/tests/api/server/redundancy.ts479
-rw-r--r--server/tests/api/server/reverse-proxy.ts4
-rw-r--r--server/tests/api/server/stats.ts10
-rw-r--r--server/tests/api/server/tracker.ts4
-rw-r--r--server/tests/api/users/blocklist.ts12
-rw-r--r--server/tests/api/users/user-subscriptions.ts19
-rw-r--r--server/tests/api/users/users-multiple-servers.ts10
-rw-r--r--server/tests/api/users/users-verification.ts8
-rw-r--r--server/tests/api/users/users.ts8
-rw-r--r--server/tests/api/videos/multiple-servers.ts6
-rw-r--r--server/tests/api/videos/services.ts12
-rw-r--r--server/tests/api/videos/single-server.ts2
-rw-r--r--server/tests/api/videos/video-abuse.ts6
-rw-r--r--server/tests/api/videos/video-blacklist-management.ts6
-rw-r--r--server/tests/api/videos/video-blacklist.ts6
-rw-r--r--server/tests/api/videos/video-captions.ts15
-rw-r--r--server/tests/api/videos/video-change-ownership.ts4
-rw-r--r--server/tests/api/videos/video-channels.ts6
-rw-r--r--server/tests/api/videos/video-comments.ts6
-rw-r--r--server/tests/api/videos/video-description.ts6
-rw-r--r--server/tests/api/videos/video-imports.ts6
-rw-r--r--server/tests/api/videos/video-nsfw.ts17
-rw-r--r--server/tests/api/videos/video-privacy.ts12
-rw-r--r--server/tests/api/videos/video-schedule-update.ts4
-rw-r--r--server/tests/api/videos/video-transcoder.ts5
-rw-r--r--server/tests/api/videos/videos-filter.ts2
-rw-r--r--server/tests/api/videos/videos-history.ts4
-rw-r--r--server/tests/api/videos/videos-overview.ts4
-rw-r--r--server/tests/cli/create-import-video-file-job.ts4
-rw-r--r--server/tests/cli/create-transcoding-job.ts4
-rw-r--r--server/tests/cli/optimize-old-videos.ts4
-rw-r--r--server/tests/cli/peertube.ts2
-rw-r--r--server/tests/cli/reset-password.ts2
-rw-r--r--server/tests/cli/update-host.ts8
-rw-r--r--server/tests/client.ts2
-rw-r--r--server/tests/feeds/feeds.ts6
-rw-r--r--server/tests/misc-endpoints.ts2
-rw-r--r--server/tests/real-world/populate-database.ts2
-rw-r--r--server/tests/real-world/real-world.ts4
-rw-r--r--server/tools/peertube-get-access-token.ts2
-rw-r--r--server/tools/peertube-import-videos.ts2
-rw-r--r--server/tools/peertube-upload.ts4
-rw-r--r--shared/utils/cli/cli.ts (renamed from server/tests/utils/cli/cli.ts)0
-rw-r--r--shared/utils/feeds/feeds.ts (renamed from server/tests/utils/feeds/feeds.ts)0
-rw-r--r--shared/utils/index.ts (renamed from server/tests/utils/index.ts)4
-rw-r--r--shared/utils/miscs/email.ts (renamed from server/tests/utils/miscs/email.ts)0
-rw-r--r--shared/utils/miscs/miscs.ts (renamed from server/tests/utils/miscs/miscs.ts)8
-rw-r--r--shared/utils/miscs/sql.ts (renamed from server/tests/utils/miscs/sql.ts)0
-rw-r--r--shared/utils/miscs/stubs.ts (renamed from server/tests/utils/miscs/stubs.ts)0
-rw-r--r--shared/utils/overviews/overviews.ts (renamed from server/tests/utils/overviews/overviews.ts)0
-rw-r--r--shared/utils/requests/activitypub.ts (renamed from server/tests/utils/requests/activitypub.ts)8
-rw-r--r--shared/utils/requests/check-api-params.ts (renamed from server/tests/utils/requests/check-api-params.ts)0
-rw-r--r--shared/utils/requests/requests.ts (renamed from server/tests/utils/requests/requests.ts)4
-rw-r--r--shared/utils/search/video-channels.ts (renamed from server/tests/utils/search/video-channels.ts)0
-rw-r--r--shared/utils/search/videos.ts (renamed from server/tests/utils/search/videos.ts)2
-rw-r--r--shared/utils/server/activitypub.ts (renamed from server/tests/utils/server/activitypub.ts)0
-rw-r--r--shared/utils/server/clients.ts (renamed from server/tests/utils/server/clients.ts)0
-rw-r--r--shared/utils/server/config.ts (renamed from server/tests/utils/server/config.ts)2
-rw-r--r--shared/utils/server/follows.ts (renamed from server/tests/utils/server/follows.ts)0
-rw-r--r--shared/utils/server/jobs.ts (renamed from server/tests/utils/server/jobs.ts)4
-rw-r--r--shared/utils/server/redundancy.ts (renamed from server/tests/utils/server/redundancy.ts)0
-rw-r--r--shared/utils/server/servers.ts (renamed from server/tests/utils/server/servers.ts)2
-rw-r--r--shared/utils/server/stats.ts (renamed from server/tests/utils/server/stats.ts)0
-rw-r--r--shared/utils/users/accounts.ts (renamed from server/tests/utils/users/accounts.ts)2
-rw-r--r--shared/utils/users/blocklist.ts (renamed from server/tests/utils/users/blocklist.ts)0
-rw-r--r--shared/utils/users/login.ts (renamed from server/tests/utils/users/login.ts)0
-rw-r--r--shared/utils/users/user-subscriptions.ts (renamed from server/tests/utils/users/user-subscriptions.ts)0
-rw-r--r--shared/utils/users/users.ts (renamed from server/tests/utils/users/users.ts)4
-rw-r--r--shared/utils/videos/services.ts (renamed from server/tests/utils/videos/services.ts)0
-rw-r--r--shared/utils/videos/video-abuses.ts (renamed from server/tests/utils/videos/video-abuses.ts)2
-rw-r--r--shared/utils/videos/video-blacklist.ts (renamed from server/tests/utils/videos/video-blacklist.ts)0
-rw-r--r--shared/utils/videos/video-captions.ts (renamed from server/tests/utils/videos/video-captions.ts)0
-rw-r--r--shared/utils/videos/video-change-ownership.ts (renamed from server/tests/utils/videos/video-change-ownership.ts)0
-rw-r--r--shared/utils/videos/video-channels.ts (renamed from server/tests/utils/videos/video-channels.ts)2
-rw-r--r--shared/utils/videos/video-comments.ts (renamed from server/tests/utils/videos/video-comments.ts)0
-rw-r--r--shared/utils/videos/video-history.ts (renamed from server/tests/utils/videos/video-history.ts)0
-rw-r--r--shared/utils/videos/video-imports.ts (renamed from server/tests/utils/videos/video-imports.ts)3
-rw-r--r--shared/utils/videos/videos.ts (renamed from server/tests/utils/videos/videos.ts)7
114 files changed, 867 insertions, 237 deletions
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts
index cd7ea01aa..df05ee452 100644
--- a/server/lib/activitypub/process/process-create.ts
+++ b/server/lib/activitypub/process/process-create.ts
@@ -13,7 +13,6 @@ import { forwardVideoRelatedActivity } from '../send/utils'
13import { Redis } from '../../redis' 13import { Redis } from '../../redis'
14import { createOrUpdateCacheFile } from '../cache-file' 14import { createOrUpdateCacheFile } from '../cache-file'
15import { getVideoDislikeActivityPubUrl } from '../url' 15import { getVideoDislikeActivityPubUrl } from '../url'
16import { VideoModel } from '../../../models/video/video'
17 16
18async function processCreateActivity (activity: ActivityCreate, byActor: ActorModel) { 17async function processCreateActivity (activity: ActivityCreate, byActor: ActorModel) {
19 const activityObject = activity.object 18 const activityObject = activity.object
diff --git a/server/tests/api/activitypub/client.ts b/server/tests/api/activitypub/client.ts
index ea0682634..6d90d8643 100644
--- a/server/tests/api/activitypub/client.ts
+++ b/server/tests/api/activitypub/client.ts
@@ -8,10 +8,10 @@ import {
8 flushTests, 8 flushTests,
9 killallServers, 9 killallServers,
10 makeActivityPubGetRequest, 10 makeActivityPubGetRequest,
11 runServer,
12 ServerInfo, 11 ServerInfo,
13 setAccessTokensToServers, uploadVideo 12 setAccessTokensToServers,
14} from '../../utils' 13 uploadVideo
14} from '../../../../shared/utils'
15 15
16const expect = chai.expect 16const expect = chai.expect
17 17
diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.ts
index a42c606c6..03609c1a9 100644
--- a/server/tests/api/activitypub/fetch.ts
+++ b/server/tests/api/activitypub/fetch.ts
@@ -11,12 +11,13 @@ import {
11 killallServers, 11 killallServers,
12 ServerInfo, 12 ServerInfo,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 setActorField,
15 setVideoField,
14 uploadVideo, 16 uploadVideo,
15 userLogin 17 userLogin,
16} from '../../utils' 18 waitJobs
19} from '../../../../shared/utils'
17import * as chai from 'chai' 20import * as chai from 'chai'
18import { setActorField, setVideoField } from '../../utils/miscs/sql'
19import { waitJobs } from '../../utils/server/jobs'
20import { Video } from '../../../../shared/models/videos' 21import { Video } from '../../../../shared/models/videos'
21 22
22const expect = chai.expect 23const expect = chai.expect
diff --git a/server/tests/api/activitypub/helpers.ts b/server/tests/api/activitypub/helpers.ts
index 51256a922..ac6e755c3 100644
--- a/server/tests/api/activitypub/helpers.ts
+++ b/server/tests/api/activitypub/helpers.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { buildRequestStub } from '../../utils' 5import { buildRequestStub } from '../../../../shared/utils/miscs/stubs'
6import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto' 6import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto'
7import { cloneDeep } from 'lodash' 7import { cloneDeep } from 'lodash'
8import { buildSignedActivity } from '../../../helpers/activitypub' 8import { buildSignedActivity } from '../../../helpers/activitypub'
diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.ts
index 67e04f79e..332ea7ed1 100644
--- a/server/tests/api/activitypub/refresher.ts
+++ b/server/tests/api/activitypub/refresher.ts
@@ -1,10 +1,19 @@
1/* tslint:disable:no-unused-expression */ 1/* tslint:disable:no-unused-expression */
2 2
3import 'mocha' 3import 'mocha'
4import { doubleFollow, getVideo, reRunServer } from '../../utils' 4import {
5import { flushAndRunMultipleServers, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo, wait } from '../../utils/index' 5 doubleFollow,
6import { waitJobs } from '../../utils/server/jobs' 6 flushAndRunMultipleServers,
7import { setVideoField } from '../../utils/miscs/sql' 7 getVideo,
8 killallServers,
9 reRunServer,
10 ServerInfo,
11 setAccessTokensToServers,
12 uploadVideo,
13 wait,
14 setVideoField,
15 waitJobs
16} from '../../../../shared/utils'
8 17
9describe('Test AP refresher', function () { 18describe('Test AP refresher', function () {
10 let servers: ServerInfo[] = [] 19 let servers: ServerInfo[] = []
diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts
index 7349749f1..342ae0fa1 100644
--- a/server/tests/api/activitypub/security.ts
+++ b/server/tests/api/activitypub/security.ts
@@ -2,13 +2,19 @@
2 2
3import 'mocha' 3import 'mocha'
4 4
5import { flushAndRunMultipleServers, flushTests, killallServers, ServerInfo } from '../../utils' 5import {
6 flushAndRunMultipleServers,
7 flushTests,
8 killallServers,
9 makeFollowRequest,
10 makePOSTAPRequest,
11 ServerInfo,
12 setActorField
13} from '../../../../shared/utils'
6import { HTTP_SIGNATURE } from '../../../initializers' 14import { HTTP_SIGNATURE } from '../../../initializers'
7import { buildDigest, buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activitypub-http-utils' 15import { buildDigest, buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activitypub-http-utils'
8import * as chai from 'chai' 16import * as chai from 'chai'
9import { setActorField } from '../../utils/miscs/sql'
10import { activityPubContextify, buildSignedActivity } from '../../../helpers/activitypub' 17import { activityPubContextify, buildSignedActivity } from '../../../helpers/activitypub'
11import { makeFollowRequest, makePOSTAPRequest } from '../../utils/requests/activitypub'
12 18
13const expect = chai.expect 19const expect = chai.expect
14 20
diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.ts
index 9e0b1e35c..567fd072c 100644
--- a/server/tests/api/check-params/accounts.ts
+++ b/server/tests/api/check-params/accounts.ts
@@ -2,9 +2,13 @@
2 2
3import 'mocha' 3import 'mocha'
4 4
5import { flushTests, killallServers, runServer, ServerInfo } from '../../utils' 5import { flushTests, killallServers, runServer, ServerInfo } from '../../../../shared/utils'
6import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 6import {
7import { getAccount } from '../../utils/users/accounts' 7 checkBadCountPagination,
8 checkBadSortPagination,
9 checkBadStartPagination
10} from '../../../../shared/utils/requests/check-api-params'
11import { getAccount } from '../../../../shared/utils/users/accounts'
8 12
9describe('Test users API validators', function () { 13describe('Test users API validators', function () {
10 const path = '/api/v1/accounts/' 14 const path = '/api/v1/accounts/'
diff --git a/server/tests/api/check-params/blocklist.ts b/server/tests/api/check-params/blocklist.ts
index c745ac975..c20453c16 100644
--- a/server/tests/api/check-params/blocklist.ts
+++ b/server/tests/api/check-params/blocklist.ts
@@ -13,8 +13,12 @@ import {
13 makePostBodyRequest, 13 makePostBodyRequest,
14 ServerInfo, 14 ServerInfo,
15 setAccessTokensToServers, userLogin 15 setAccessTokensToServers, userLogin
16} from '../../utils' 16} from '../../../../shared/utils'
17import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 17import {
18 checkBadCountPagination,
19 checkBadSortPagination,
20 checkBadStartPagination
21} from '../../../../shared/utils/requests/check-api-params'
18 22
19describe('Test blocklist API validators', function () { 23describe('Test blocklist API validators', function () {
20 let servers: ServerInfo[] 24 let servers: ServerInfo[]
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index d807f910b..ffae380c1 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -7,7 +7,7 @@ import { CustomConfig } from '../../../../shared/models/server/custom-config.mod
7import { 7import {
8 createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePutBodyRequest, runServer, ServerInfo, 8 createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePutBodyRequest, runServer, ServerInfo,
9 setAccessTokensToServers, userLogin, immutableAssign 9 setAccessTokensToServers, userLogin, immutableAssign
10} from '../../utils' 10} from '../../../../shared/utils'
11 11
12describe('Test config API validators', function () { 12describe('Test config API validators', function () {
13 const path = '/api/v1/config/custom' 13 const path = '/api/v1/config/custom'
diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts
index cdc95c81a..2ad1575a3 100644
--- a/server/tests/api/check-params/follows.ts
+++ b/server/tests/api/check-params/follows.ts
@@ -5,8 +5,12 @@ import 'mocha'
5import { 5import {
6 createUser, flushTests, killallServers, makeDeleteRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, 6 createUser, flushTests, killallServers, makeDeleteRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers,
7 userLogin 7 userLogin
8} from '../../utils' 8} from '../../../../shared/utils'
9import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 9import {
10 checkBadCountPagination,
11 checkBadSortPagination,
12 checkBadStartPagination
13} from '../../../../shared/utils/requests/check-api-params'
10 14
11describe('Test server follows API validators', function () { 15describe('Test server follows API validators', function () {
12 let server: ServerInfo 16 let server: ServerInfo
diff --git a/server/tests/api/check-params/jobs.ts b/server/tests/api/check-params/jobs.ts
index ce3ac8809..89760ff98 100644
--- a/server/tests/api/check-params/jobs.ts
+++ b/server/tests/api/check-params/jobs.ts
@@ -2,9 +2,21 @@
2 2
3import 'mocha' 3import 'mocha'
4 4
5import { createUser, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, userLogin } from '../../utils' 5import {
6import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 6 createUser,
7import { makeGetRequest } from '../../utils/requests/requests' 7 flushTests,
8 killallServers,
9 runServer,
10 ServerInfo,
11 setAccessTokensToServers,
12 userLogin
13} from '../../../../shared/utils'
14import {
15 checkBadCountPagination,
16 checkBadSortPagination,
17 checkBadStartPagination
18} from '../../../../shared/utils/requests/check-api-params'
19import { makeGetRequest } from '../../../../shared/utils/requests/requests'
8 20
9describe('Test jobs API validators', function () { 21describe('Test jobs API validators', function () {
10 const path = '/api/v1/jobs/failed' 22 const path = '/api/v1/jobs/failed'
diff --git a/server/tests/api/check-params/redundancy.ts b/server/tests/api/check-params/redundancy.ts
index aa588e3dd..ff4726ceb 100644
--- a/server/tests/api/check-params/redundancy.ts
+++ b/server/tests/api/check-params/redundancy.ts
@@ -12,7 +12,7 @@ import {
12 ServerInfo, 12 ServerInfo,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 userLogin 14 userLogin
15} from '../../utils' 15} from '../../../../shared/utils'
16 16
17describe('Test server redundancy API validators', function () { 17describe('Test server redundancy API validators', function () {
18 let servers: ServerInfo[] 18 let servers: ServerInfo[]
diff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.ts
index eabf602ac..aa81965f3 100644
--- a/server/tests/api/check-params/search.ts
+++ b/server/tests/api/check-params/search.ts
@@ -2,8 +2,12 @@
2 2
3import 'mocha' 3import 'mocha'
4 4
5import { flushTests, immutableAssign, killallServers, makeGetRequest, runServer, ServerInfo } from '../../utils' 5import { flushTests, immutableAssign, killallServers, makeGetRequest, runServer, ServerInfo } from '../../../../shared/utils'
6import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 6import {
7 checkBadCountPagination,
8 checkBadSortPagination,
9 checkBadStartPagination
10} from '../../../../shared/utils/requests/check-api-params'
7 11
8describe('Test videos API validator', function () { 12describe('Test videos API validator', function () {
9 let server: ServerInfo 13 let server: ServerInfo
diff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.ts
index fcde7e179..28591af9d 100644
--- a/server/tests/api/check-params/services.ts
+++ b/server/tests/api/check-params/services.ts
@@ -2,7 +2,15 @@
2 2
3import 'mocha' 3import 'mocha'
4 4
5import { flushTests, killallServers, makeGetRequest, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils' 5import {
6 flushTests,
7 killallServers,
8 makeGetRequest,
9 runServer,
10 ServerInfo,
11 setAccessTokensToServers,
12 uploadVideo
13} from '../../../../shared/utils'
6 14
7describe('Test services API validators', function () { 15describe('Test services API validators', function () {
8 let server: ServerInfo 16 let server: ServerInfo
diff --git a/server/tests/api/check-params/user-subscriptions.ts b/server/tests/api/check-params/user-subscriptions.ts
index 6af7ed43b..8a9ced7c1 100644
--- a/server/tests/api/check-params/user-subscriptions.ts
+++ b/server/tests/api/check-params/user-subscriptions.ts
@@ -13,9 +13,14 @@ import {
13 ServerInfo, 13 ServerInfo,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 userLogin 15 userLogin
16} from '../../utils' 16} from '../../../../shared/utils'
17import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 17
18import { waitJobs } from '../../utils/server/jobs' 18import {
19 checkBadCountPagination,
20 checkBadSortPagination,
21 checkBadStartPagination
22} from '../../../../shared/utils/requests/check-api-params'
23import { waitJobs } from '../../../../shared/utils/server/jobs'
19 24
20describe('Test user subscriptions API validators', function () { 25describe('Test user subscriptions API validators', function () {
21 const path = '/api/v1/users/me/subscriptions' 26 const path = '/api/v1/users/me/subscriptions'
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index ee225dc2e..05f42bca9 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -9,11 +9,15 @@ import {
9 createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest, 9 createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest,
10 makePostBodyRequest, makeUploadRequest, makePutBodyRequest, registerUser, removeUser, runServer, ServerInfo, setAccessTokensToServers, 10 makePostBodyRequest, makeUploadRequest, makePutBodyRequest, registerUser, removeUser, runServer, ServerInfo, setAccessTokensToServers,
11 updateUser, uploadVideo, userLogin, deleteMe, unblockUser, blockUser 11 updateUser, uploadVideo, userLogin, deleteMe, unblockUser, blockUser
12} from '../../utils' 12} from '../../../../shared/utils'
13import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 13import {
14import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../utils/videos/video-imports' 14 checkBadCountPagination,
15 checkBadSortPagination,
16 checkBadStartPagination
17} from '../../../../shared/utils/requests/check-api-params'
18import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../../../shared/utils/videos/video-imports'
15import { VideoPrivacy } from '../../../../shared/models/videos' 19import { VideoPrivacy } from '../../../../shared/models/videos'
16import { waitJobs } from '../../utils/server/jobs' 20import { waitJobs } from '../../../../shared/utils/server/jobs'
17import { expect } from 'chai' 21import { expect } from 'chai'
18 22
19describe('Test users API validators', function () { 23describe('Test users API validators', function () {
diff --git a/server/tests/api/check-params/video-abuses.ts b/server/tests/api/check-params/video-abuses.ts
index d2bed6a2a..a79ab4201 100644
--- a/server/tests/api/check-params/video-abuses.ts
+++ b/server/tests/api/check-params/video-abuses.ts
@@ -15,8 +15,12 @@ import {
15 updateVideoAbuse, 15 updateVideoAbuse,
16 uploadVideo, 16 uploadVideo,
17 userLogin 17 userLogin
18} from '../../utils' 18} from '../../../../shared/utils'
19import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 19import {
20 checkBadCountPagination,
21 checkBadSortPagination,
22 checkBadStartPagination
23} from '../../../../shared/utils/requests/check-api-params'
20import { VideoAbuseState } from '../../../../shared/models/videos' 24import { VideoAbuseState } from '../../../../shared/models/videos'
21 25
22describe('Test video abuses API validators', function () { 26describe('Test video abuses API validators', function () {
diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts
index 473216236..8e1206db3 100644
--- a/server/tests/api/check-params/video-blacklist.ts
+++ b/server/tests/api/check-params/video-blacklist.ts
@@ -15,8 +15,12 @@ import {
15 setAccessTokensToServers, 15 setAccessTokensToServers,
16 uploadVideo, 16 uploadVideo,
17 userLogin 17 userLogin
18} from '../../utils' 18} from '../../../../shared/utils'
19import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 19import {
20 checkBadCountPagination,
21 checkBadSortPagination,
22 checkBadStartPagination
23} from '../../../../shared/utils/requests/check-api-params'
20import { VideoDetails } from '../../../../shared/models/videos' 24import { VideoDetails } from '../../../../shared/models/videos'
21import { expect } from 'chai' 25import { expect } from 'chai'
22 26
diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts
index 8d46971a1..e4d36fd4f 100644
--- a/server/tests/api/check-params/video-captions.ts
+++ b/server/tests/api/check-params/video-captions.ts
@@ -13,9 +13,9 @@ import {
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 uploadVideo, 14 uploadVideo,
15 userLogin 15 userLogin
16} from '../../utils' 16} from '../../../../shared/utils'
17import { join } from 'path' 17import { join } from 'path'
18import { createVideoCaption } from '../../utils/videos/video-captions' 18import { createVideoCaption } from '../../../../shared/utils/videos/video-captions'
19 19
20describe('Test video captions API validator', function () { 20describe('Test video captions API validator', function () {
21 const path = '/api/v1/videos/' 21 const path = '/api/v1/videos/'
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index e5696224d..14e4deaf7 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -20,8 +20,12 @@ import {
20 ServerInfo, 20 ServerInfo,
21 setAccessTokensToServers, 21 setAccessTokensToServers,
22 userLogin 22 userLogin
23} from '../../utils' 23} from '../../../../shared/utils'
24import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 24import {
25 checkBadCountPagination,
26 checkBadSortPagination,
27 checkBadStartPagination
28} from '../../../../shared/utils/requests/check-api-params'
25import { User } from '../../../../shared/models/users' 29import { User } from '../../../../shared/models/users'
26import { join } from 'path' 30import { join } from 'path'
27 31
diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts
index 5241832fe..5981780ed 100644
--- a/server/tests/api/check-params/video-comments.ts
+++ b/server/tests/api/check-params/video-comments.ts
@@ -6,9 +6,13 @@ import {
6 createUser, 6 createUser,
7 flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, 7 flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers,
8 uploadVideo, userLogin 8 uploadVideo, userLogin
9} from '../../utils' 9} from '../../../../shared/utils'
10import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 10import {
11import { addVideoCommentThread } from '../../utils/videos/video-comments' 11 checkBadCountPagination,
12 checkBadSortPagination,
13 checkBadStartPagination
14} from '../../../../shared/utils/requests/check-api-params'
15import { addVideoCommentThread } from '../../../../shared/utils/videos/video-comments'
12 16
13const expect = chai.expect 17const expect = chai.expect
14 18
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index b51f3d2cd..7bf187007 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -18,9 +18,13 @@ import {
18 setAccessTokensToServers, 18 setAccessTokensToServers,
19 updateCustomSubConfig, 19 updateCustomSubConfig,
20 userLogin 20 userLogin
21} from '../../utils' 21} from '../../../../shared/utils'
22import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 22import {
23import { getMagnetURI, getYoutubeVideoUrl } from '../../utils/videos/video-imports' 23 checkBadCountPagination,
24 checkBadSortPagination,
25 checkBadStartPagination
26} from '../../../../shared/utils/requests/check-api-params'
27import { getMagnetURI, getYoutubeVideoUrl } from '../../../../shared/utils/videos/video-imports'
24 28
25describe('Test video imports API validator', function () { 29describe('Test video imports API validator', function () {
26 const path = '/api/v1/videos/imports' 30 const path = '/api/v1/videos/imports'
diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.ts
index 784cd8ba1..e998c8a3d 100644
--- a/server/tests/api/check-params/videos-filter.ts
+++ b/server/tests/api/check-params/videos-filter.ts
@@ -11,7 +11,7 @@ import {
11 ServerInfo, 11 ServerInfo,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 userLogin 13 userLogin
14} from '../../utils' 14} from '../../../../shared/utils'
15import { UserRole } from '../../../../shared/models/users' 15import { UserRole } from '../../../../shared/models/users'
16 16
17const expect = chai.expect 17const expect = chai.expect
diff --git a/server/tests/api/check-params/videos-history.ts b/server/tests/api/check-params/videos-history.ts
index 808c3b616..09c6f7861 100644
--- a/server/tests/api/check-params/videos-history.ts
+++ b/server/tests/api/check-params/videos-history.ts
@@ -11,7 +11,7 @@ import {
11 ServerInfo, 11 ServerInfo,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 uploadVideo 13 uploadVideo
14} from '../../utils' 14} from '../../../../shared/utils'
15 15
16const expect = chai.expect 16const expect = chai.expect
17 17
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index 699f135c7..d94eccf8e 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -8,9 +8,13 @@ import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enu
8import { 8import {
9 createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest, 9 createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest,
10 makeGetRequest, makeUploadRequest, makePutBodyRequest, removeVideo, runServer, ServerInfo, setAccessTokensToServers, userLogin 10 makeGetRequest, makeUploadRequest, makePutBodyRequest, removeVideo, runServer, ServerInfo, setAccessTokensToServers, userLogin
11} from '../../utils' 11} from '../../../../shared/utils'
12import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 12import {
13import { getAccountsList } from '../../utils/users/accounts' 13 checkBadCountPagination,
14 checkBadSortPagination,
15 checkBadStartPagination
16} from '../../../../shared/utils/requests/check-api-params'
17import { getAccountsList } from '../../../../shared/utils/users/accounts'
14 18
15const expect = chai.expect 19const expect = chai.expect
16 20
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts
index 5b29a503a..9d3ce8153 100644
--- a/server/tests/api/redundancy/redundancy.ts
+++ b/server/tests/api/redundancy/redundancy.ts
@@ -18,15 +18,16 @@ import {
18 wait, 18 wait,
19 waitUntilLog, 19 waitUntilLog,
20 checkVideoFilesWereRemoved, removeVideo, getVideoWithToken 20 checkVideoFilesWereRemoved, removeVideo, getVideoWithToken
21} from '../../utils' 21} from '../../../../shared/utils'
22import { waitJobs } from '../../utils/server/jobs' 22import { waitJobs } from '../../../../shared/utils/server/jobs'
23
23import * as magnetUtil from 'magnet-uri' 24import * as magnetUtil from 'magnet-uri'
24import { updateRedundancy } from '../../utils/server/redundancy' 25import { updateRedundancy } from '../../../../shared/utils/server/redundancy'
25import { ActorFollow } from '../../../../shared/models/actors' 26import { ActorFollow } from '../../../../shared/models/actors'
26import { readdir } from 'fs-extra' 27import { readdir } from 'fs-extra'
27import { join } from 'path' 28import { join } from 'path'
28import { VideoRedundancyStrategy } from '../../../../shared/models/redundancy' 29import { VideoRedundancyStrategy } from '../../../../shared/models/redundancy'
29import { getStats } from '../../utils/server/stats' 30import { getStats } from '../../../../shared/utils/server/stats'
30import { ServerStats } from '../../../../shared/models/server/server-stats.model' 31import { ServerStats } from '../../../../shared/models/server/server-stats.model'
31 32
32const expect = chai.expect 33const expect = chai.expect
diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts
index a287c5bdf..a411e973b 100644
--- a/server/tests/api/search/search-activitypub-video-channels.ts
+++ b/server/tests/api/search/search-activitypub-video-channels.ts
@@ -17,10 +17,10 @@ import {
17 uploadVideo, 17 uploadVideo,
18 userLogin, 18 userLogin,
19 wait 19 wait
20} from '../../utils' 20} from '../../../../shared/utils'
21import { waitJobs } from '../../utils/server/jobs' 21import { waitJobs } from '../../../../shared/utils/server/jobs'
22import { VideoChannel } from '../../../../shared/models/videos' 22import { VideoChannel } from '../../../../shared/models/videos'
23import { searchVideoChannel } from '../../utils/search/video-channels' 23import { searchVideoChannel } from '../../../../shared/utils/search/video-channels'
24 24
25const expect = chai.expect 25const expect = chai.expect
26 26
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts
index 28f4fac50..f881917e7 100644
--- a/server/tests/api/search/search-activitypub-videos.ts
+++ b/server/tests/api/search/search-activitypub-videos.ts
@@ -16,8 +16,8 @@ import {
16 uploadVideo, 16 uploadVideo,
17 wait, 17 wait,
18 searchVideo 18 searchVideo
19} from '../../utils' 19} from '../../../../shared/utils'
20import { waitJobs } from '../../utils/server/jobs' 20import { waitJobs } from '../../../../shared/utils/server/jobs'
21import { Video, VideoPrivacy } from '../../../../shared/models/videos' 21import { Video, VideoPrivacy } from '../../../../shared/models/videos'
22 22
23const expect = chai.expect 23const expect = chai.expect
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts
index f1392ffea..50da837da 100644
--- a/server/tests/api/search/search-videos.ts
+++ b/server/tests/api/search/search-videos.ts
@@ -13,7 +13,7 @@ import {
13 uploadVideo, 13 uploadVideo,
14 wait, 14 wait,
15 immutableAssign 15 immutableAssign
16} from '../../utils' 16} from '../../../../shared/utils'
17 17
18const expect = chai.expect 18const expect = chai.expect
19 19
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index facd1688d..c5c360a17 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -4,8 +4,11 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { About } from '../../../../shared/models/server/about.model' 5import { About } from '../../../../shared/models/server/about.model'
6import { CustomConfig } from '../../../../shared/models/server/custom-config.model' 6import { CustomConfig } from '../../../../shared/models/server/custom-config.model'
7import { deleteCustomConfig, getAbout, killallServers, reRunServer } from '../../utils'
8import { 7import {
8 deleteCustomConfig,
9 getAbout,
10 killallServers,
11 reRunServer,
9 flushTests, 12 flushTests,
10 getConfig, 13 getConfig,
11 getCustomConfig, 14 getCustomConfig,
@@ -13,7 +16,7 @@ import {
13 runServer, 16 runServer,
14 setAccessTokensToServers, 17 setAccessTokensToServers,
15 updateCustomConfig 18 updateCustomConfig
16} from '../../utils/index' 19} from '../../../../shared/utils'
17 20
18const expect = chai.expect 21const expect = chai.expect
19 22
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts
index 713a27143..13df772c6 100644
--- a/server/tests/api/server/email.ts
+++ b/server/tests/api/server/email.ts
@@ -14,11 +14,14 @@ import {
14 unblockUser, 14 unblockUser,
15 uploadVideo, 15 uploadVideo,
16 userLogin, 16 userLogin,
17 verifyEmail 17 verifyEmail,
18} from '../../utils' 18 flushTests,
19import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from '../../utils/index' 19 killallServers,
20import { mockSmtpServer } from '../../utils/miscs/email' 20 ServerInfo,
21import { waitJobs } from '../../utils/server/jobs' 21 setAccessTokensToServers
22} from '../../../../shared/utils'
23import { mockSmtpServer } from '../../../../shared/utils/miscs/email'
24import { waitJobs } from '../../../../shared/utils/server/jobs'
22 25
23const expect = chai.expect 26const expect = chai.expect
24 27
diff --git a/server/tests/api/server/follow-constraints.ts b/server/tests/api/server/follow-constraints.ts
index 3135fc568..8bb073c41 100644
--- a/server/tests/api/server/follow-constraints.ts
+++ b/server/tests/api/server/follow-constraints.ts
@@ -2,11 +2,21 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { doubleFollow, getAccountVideos, getVideo, getVideoChannelVideos, getVideoWithToken } from '../../utils' 5import {
6import { flushAndRunMultipleServers, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils/index' 6 doubleFollow,
7import { unfollow } from '../../utils/server/follows' 7 getAccountVideos,
8import { userLogin } from '../../utils/users/login' 8 getVideo,
9import { createUser } from '../../utils/users/users' 9 getVideoChannelVideos,
10 getVideoWithToken,
11 flushAndRunMultipleServers,
12 killallServers,
13 ServerInfo,
14 setAccessTokensToServers,
15 uploadVideo
16} from '../../../../shared/utils'
17import { unfollow } from '../../../../shared/utils/server/follows'
18import { userLogin } from '../../../../shared/utils/users/login'
19import { createUser } from '../../../../shared/utils/users/users'
10 20
11const expect = chai.expect 21const expect = chai.expect
12 22
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts
index e80e93e7f..b0fc5d293 100644
--- a/server/tests/api/server/follows.ts
+++ b/server/tests/api/server/follows.ts
@@ -4,7 +4,7 @@ import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { Video, VideoPrivacy } from '../../../../shared/models/videos' 5import { Video, VideoPrivacy } from '../../../../shared/models/videos'
6import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' 6import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
7import { completeVideoCheck } from '../../utils' 7import { completeVideoCheck } from '../../../../shared/utils'
8import { 8import {
9 flushAndRunMultipleServers, 9 flushAndRunMultipleServers,
10 getVideosList, 10 getVideosList,
@@ -12,21 +12,26 @@ import {
12 ServerInfo, 12 ServerInfo,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 uploadVideo 14 uploadVideo
15} from '../../utils/index' 15} from '../../../../shared/utils/index'
16import { dateIsValid } from '../../utils/miscs/miscs' 16import { dateIsValid } from '../../../../shared/utils/miscs/miscs'
17import { follow, getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, unfollow } from '../../utils/server/follows' 17import {
18import { expectAccountFollows } from '../../utils/users/accounts' 18 follow,
19import { userLogin } from '../../utils/users/login' 19 getFollowersListPaginationAndSort,
20import { createUser } from '../../utils/users/users' 20 getFollowingListPaginationAndSort,
21 unfollow
22} from '../../../../shared/utils/server/follows'
23import { expectAccountFollows } from '../../../../shared/utils/users/accounts'
24import { userLogin } from '../../../../shared/utils/users/login'
25import { createUser } from '../../../../shared/utils/users/users'
21import { 26import {
22 addVideoCommentReply, 27 addVideoCommentReply,
23 addVideoCommentThread, 28 addVideoCommentThread,
24 getVideoCommentThreads, 29 getVideoCommentThreads,
25 getVideoThreadComments 30 getVideoThreadComments
26} from '../../utils/videos/video-comments' 31} from '../../../../shared/utils/videos/video-comments'
27import { rateVideo } from '../../utils/videos/videos' 32import { rateVideo } from '../../../../shared/utils/videos/videos'
28import { waitJobs } from '../../utils/server/jobs' 33import { waitJobs } from '../../../../shared/utils/server/jobs'
29import { createVideoCaption, listVideoCaptions, testCaptionFile } from '../../utils/videos/video-captions' 34import { createVideoCaption, listVideoCaptions, testCaptionFile } from '../../../../shared/utils/videos/video-captions'
30import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model' 35import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model'
31 36
32const expect = chai.expect 37const expect = chai.expect
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts
index 0421b2b40..8e162b69e 100644
--- a/server/tests/api/server/handle-down.ts
+++ b/server/tests/api/server/handle-down.ts
@@ -5,24 +5,31 @@ import 'mocha'
5import { JobState, Video } from '../../../../shared/models' 5import { JobState, Video } from '../../../../shared/models'
6import { VideoPrivacy } from '../../../../shared/models/videos' 6import { VideoPrivacy } from '../../../../shared/models/videos'
7import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' 7import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
8import { completeVideoCheck, getVideo, immutableAssign, reRunServer, unfollow, updateVideo, viewVideo } from '../../utils' 8
9import { 9import {
10 completeVideoCheck,
11 getVideo,
12 immutableAssign,
13 reRunServer,
14 unfollow,
15 viewVideo,
10 flushAndRunMultipleServers, 16 flushAndRunMultipleServers,
11 getVideosList, 17 getVideosList,
12 killallServers, 18 killallServers,
13 ServerInfo, 19 ServerInfo,
14 setAccessTokensToServers, 20 setAccessTokensToServers,
15 uploadVideo, 21 uploadVideo,
22 updateVideo,
16 wait 23 wait
17} from '../../utils/index' 24} from '../../../../shared/utils'
18import { follow, getFollowersListPaginationAndSort } from '../../utils/server/follows' 25import { follow, getFollowersListPaginationAndSort } from '../../../../shared/utils/server/follows'
19import { getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs' 26import { getJobsListPaginationAndSort, waitJobs } from '../../../../shared/utils/server/jobs'
20import { 27import {
21 addVideoCommentReply, 28 addVideoCommentReply,
22 addVideoCommentThread, 29 addVideoCommentThread,
23 getVideoCommentThreads, 30 getVideoCommentThreads,
24 getVideoThreadComments 31 getVideoThreadComments
25} from '../../utils/videos/video-comments' 32} from '../../../../shared/utils/videos/video-comments'
26 33
27const expect = chai.expect 34const expect = chai.expect
28 35
diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts
index cd59d9a1b..52948b1d6 100644
--- a/server/tests/api/server/jobs.ts
+++ b/server/tests/api/server/jobs.ts
@@ -2,12 +2,12 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { killallServers, ServerInfo, setAccessTokensToServers } from '../../utils/index' 5import { killallServers, ServerInfo, setAccessTokensToServers } from '../../../../shared/utils/index'
6import { doubleFollow } from '../../utils/server/follows' 6import { doubleFollow } from '../../../../shared/utils/server/follows'
7import { getJobsList, getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs' 7import { getJobsList, getJobsListPaginationAndSort, waitJobs } from '../../../../shared/utils/server/jobs'
8import { flushAndRunMultipleServers } from '../../utils/server/servers' 8import { flushAndRunMultipleServers } from '../../../../shared/utils/server/servers'
9import { uploadVideo } from '../../utils/videos/videos' 9import { uploadVideo } from '../../../../shared/utils/videos/videos'
10import { dateIsValid } from '../../utils/miscs/miscs' 10import { dateIsValid } from '../../../../shared/utils/miscs/miscs'
11 11
12const expect = chai.expect 12const expect = chai.expect
13 13
diff --git a/server/tests/api/server/no-client.ts b/server/tests/api/server/no-client.ts
index 6d6ce8532..3b95ce945 100644
--- a/server/tests/api/server/no-client.ts
+++ b/server/tests/api/server/no-client.ts
@@ -4,8 +4,8 @@ import {
4 flushTests, 4 flushTests,
5 killallServers, 5 killallServers,
6 ServerInfo 6 ServerInfo
7} from '../../utils/index' 7} from '../../../../shared/utils'
8import { runServer } from '../../utils/server/servers' 8import { runServer } from '../../../../shared/utils/server/servers'
9 9
10describe('Start and stop server without web client routes', function () { 10describe('Start and stop server without web client routes', function () {
11 let server: ServerInfo 11 let server: ServerInfo
diff --git a/server/tests/api/server/redundancy.ts b/server/tests/api/server/redundancy.ts
new file mode 100644
index 000000000..8053d0491
--- /dev/null
+++ b/server/tests/api/server/redundancy.ts
@@ -0,0 +1,479 @@
1/* tslint:disable:no-unused-expression */
2
3import * as chai from 'chai'
4import 'mocha'
5import { VideoDetails } from '../../../../shared/models/videos'
6import {
7 doubleFollow,
8 flushAndRunMultipleServers,
9 getFollowingListPaginationAndSort,
10 getVideo,
11 immutableAssign,
12 killallServers, makeGetRequest,
13 root,
14 ServerInfo,
15 setAccessTokensToServers, unfollow,
16 uploadVideo,
17 viewVideo,
18 wait,
19 waitUntilLog,
20 checkVideoFilesWereRemoved, removeVideo
21} from '../../../../shared/utils'
22import { waitJobs } from '../../../../shared/utils/server/jobs'
23import * as magnetUtil from 'magnet-uri'
24import { updateRedundancy } from '../../../../shared/utils/server/redundancy'
25import { ActorFollow } from '../../../../shared/models/actors'
26import { readdir } from 'fs-extra'
27import { join } from 'path'
28import { VideoRedundancyStrategy } from '../../../../shared/models/redundancy'
29import { getStats } from '../../../../shared/utils/server/stats'
30import { ServerStats } from '../../../../shared/models/server/server-stats.model'
31
32const expect = chai.expect
33
34let servers: ServerInfo[] = []
35let video1Server2UUID: string
36
37function checkMagnetWebseeds (file: { magnetUri: string, resolution: { id: number } }, baseWebseeds: string[], server: ServerInfo) {
38 const parsed = magnetUtil.decode(file.magnetUri)
39
40 for (const ws of baseWebseeds) {
41 const found = parsed.urlList.find(url => url === `${ws}-${file.resolution.id}.mp4`)
42 expect(found, `Webseed ${ws} not found in ${file.magnetUri} on server ${server.url}`).to.not.be.undefined
43 }
44
45 expect(parsed.urlList).to.have.lengthOf(baseWebseeds.length)
46}
47
48async function runServers (strategy: VideoRedundancyStrategy, additionalParams: any = {}) {
49 const config = {
50 redundancy: {
51 videos: {
52 check_interval: '5 seconds',
53 strategies: [
54 immutableAssign({
55 min_lifetime: '1 hour',
56 strategy: strategy,
57 size: '100KB'
58 }, additionalParams)
59 ]
60 }
61 }
62 }
63 servers = await flushAndRunMultipleServers(3, config)
64
65 // Get the access tokens
66 await setAccessTokensToServers(servers)
67
68 {
69 const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 1 server 2' })
70 video1Server2UUID = res.body.video.uuid
71
72 await viewVideo(servers[ 1 ].url, video1Server2UUID)
73 }
74
75 await waitJobs(servers)
76
77 // Server 1 and server 2 follow each other
78 await doubleFollow(servers[ 0 ], servers[ 1 ])
79 // Server 1 and server 3 follow each other
80 await doubleFollow(servers[ 0 ], servers[ 2 ])
81 // Server 2 and server 3 follow each other
82 await doubleFollow(servers[ 1 ], servers[ 2 ])
83
84 await waitJobs(servers)
85}
86
87async function check1WebSeed (strategy: VideoRedundancyStrategy, videoUUID?: string) {
88 if (!videoUUID) videoUUID = video1Server2UUID
89
90 const webseeds = [
91 'http://localhost:9002/static/webseed/' + videoUUID
92 ]
93
94 for (const server of servers) {
95 {
96 const res = await getVideo(server.url, videoUUID)
97
98 const video: VideoDetails = res.body
99 for (const f of video.files) {
100 checkMagnetWebseeds(f, webseeds, server)
101 }
102 }
103 }
104}
105
106async function checkStatsWith2Webseed (strategy: VideoRedundancyStrategy) {
107 const res = await getStats(servers[0].url)
108 const data: ServerStats = res.body
109
110 expect(data.videosRedundancy).to.have.lengthOf(1)
111 const stat = data.videosRedundancy[0]
112
113 expect(stat.strategy).to.equal(strategy)
114 expect(stat.totalSize).to.equal(102400)
115 expect(stat.totalUsed).to.be.at.least(1).and.below(102401)
116 expect(stat.totalVideoFiles).to.equal(4)
117 expect(stat.totalVideos).to.equal(1)
118}
119
120async function checkStatsWith1Webseed (strategy: VideoRedundancyStrategy) {
121 const res = await getStats(servers[0].url)
122 const data: ServerStats = res.body
123
124 expect(data.videosRedundancy).to.have.lengthOf(1)
125
126 const stat = data.videosRedundancy[0]
127 expect(stat.strategy).to.equal(strategy)
128 expect(stat.totalSize).to.equal(102400)
129 expect(stat.totalUsed).to.equal(0)
130 expect(stat.totalVideoFiles).to.equal(0)
131 expect(stat.totalVideos).to.equal(0)
132}
133
134async function check2Webseeds (strategy: VideoRedundancyStrategy, videoUUID?: string) {
135 if (!videoUUID) videoUUID = video1Server2UUID
136
137 const webseeds = [
138 'http://localhost:9001/static/webseed/' + videoUUID,
139 'http://localhost:9002/static/webseed/' + videoUUID
140 ]
141
142 for (const server of servers) {
143 const res = await getVideo(server.url, videoUUID)
144
145 const video: VideoDetails = res.body
146
147 for (const file of video.files) {
148 checkMagnetWebseeds(file, webseeds, server)
149
150 // Only servers 1 and 2 have the video
151 if (server.serverNumber !== 3) {
152 await makeGetRequest({
153 url: server.url,
154 statusCodeExpected: 200,
155 path: '/static/webseed/' + `${videoUUID}-${file.resolution.id}.mp4`,
156 contentType: null
157 })
158 }
159 }
160 }
161
162 for (const directory of [ 'test1', 'test2' ]) {
163 const files = await readdir(join(root(), directory, 'videos'))
164 expect(files).to.have.length.at.least(4)
165
166 for (const resolution of [ 240, 360, 480, 720 ]) {
167 expect(files.find(f => f === `${videoUUID}-${resolution}.mp4`)).to.not.be.undefined
168 }
169 }
170}
171
172async function enableRedundancyOnServer1 () {
173 await updateRedundancy(servers[ 0 ].url, servers[ 0 ].accessToken, servers[ 1 ].host, true)
174
175 const res = await getFollowingListPaginationAndSort(servers[ 0 ].url, 0, 5, '-createdAt')
176 const follows: ActorFollow[] = res.body.data
177 const server2 = follows.find(f => f.following.host === 'localhost:9002')
178 const server3 = follows.find(f => f.following.host === 'localhost:9003')
179
180 expect(server3).to.not.be.undefined
181 expect(server3.following.hostRedundancyAllowed).to.be.false
182
183 expect(server2).to.not.be.undefined
184 expect(server2.following.hostRedundancyAllowed).to.be.true
185}
186
187async function disableRedundancyOnServer1 () {
188 await updateRedundancy(servers[ 0 ].url, servers[ 0 ].accessToken, servers[ 1 ].host, false)
189
190 const res = await getFollowingListPaginationAndSort(servers[ 0 ].url, 0, 5, '-createdAt')
191 const follows: ActorFollow[] = res.body.data
192 const server2 = follows.find(f => f.following.host === 'localhost:9002')
193 const server3 = follows.find(f => f.following.host === 'localhost:9003')
194
195 expect(server3).to.not.be.undefined
196 expect(server3.following.hostRedundancyAllowed).to.be.false
197
198 expect(server2).to.not.be.undefined
199 expect(server2.following.hostRedundancyAllowed).to.be.false
200}
201
202async function cleanServers () {
203 killallServers(servers)
204}
205
206describe('Test videos redundancy', function () {
207
208 describe('With most-views strategy', function () {
209 const strategy = 'most-views'
210
211 before(function () {
212 this.timeout(120000)
213
214 return runServers(strategy)
215 })
216
217 it('Should have 1 webseed on the first video', async function () {
218 await check1WebSeed(strategy)
219 await checkStatsWith1Webseed(strategy)
220 })
221
222 it('Should enable redundancy on server 1', function () {
223 return enableRedundancyOnServer1()
224 })
225
226 it('Should have 2 webseed on the first video', async function () {
227 this.timeout(40000)
228
229 await waitJobs(servers)
230 await waitUntilLog(servers[0], 'Duplicated ', 4)
231 await waitJobs(servers)
232
233 await check2Webseeds(strategy)
234 await checkStatsWith2Webseed(strategy)
235 })
236
237 it('Should undo redundancy on server 1 and remove duplicated videos', async function () {
238 this.timeout(40000)
239
240 await disableRedundancyOnServer1()
241
242 await waitJobs(servers)
243 await wait(5000)
244
245 await check1WebSeed(strategy)
246
247 await checkVideoFilesWereRemoved(video1Server2UUID, servers[0].serverNumber, [ 'videos' ])
248 })
249
250 after(function () {
251 return cleanServers()
252 })
253 })
254
255 describe('With trending strategy', function () {
256 const strategy = 'trending'
257
258 before(function () {
259 this.timeout(120000)
260
261 return runServers(strategy)
262 })
263
264 it('Should have 1 webseed on the first video', async function () {
265 await check1WebSeed(strategy)
266 await checkStatsWith1Webseed(strategy)
267 })
268
269 it('Should enable redundancy on server 1', function () {
270 return enableRedundancyOnServer1()
271 })
272
273 it('Should have 2 webseed on the first video', async function () {
274 this.timeout(40000)
275
276 await waitJobs(servers)
277 await waitUntilLog(servers[0], 'Duplicated ', 4)
278 await waitJobs(servers)
279
280 await check2Webseeds(strategy)
281 await checkStatsWith2Webseed(strategy)
282 })
283
284 it('Should unfollow on server 1 and remove duplicated videos', async function () {
285 this.timeout(40000)
286
287 await unfollow(servers[0].url, servers[0].accessToken, servers[1])
288
289 await waitJobs(servers)
290 await wait(5000)
291
292 await check1WebSeed(strategy)
293
294 await checkVideoFilesWereRemoved(video1Server2UUID, servers[0].serverNumber, [ 'videos' ])
295 })
296
297 after(function () {
298 return cleanServers()
299 })
300 })
301
302 describe('With recently added strategy', function () {
303 const strategy = 'recently-added'
304
305 before(function () {
306 this.timeout(120000)
307
308 return runServers(strategy, { min_views: 3 })
309 })
310
311 it('Should have 1 webseed on the first video', async function () {
312 await check1WebSeed(strategy)
313 await checkStatsWith1Webseed(strategy)
314 })
315
316 it('Should enable redundancy on server 1', function () {
317 return enableRedundancyOnServer1()
318 })
319
320 it('Should still have 1 webseed on the first video', async function () {
321 this.timeout(40000)
322
323 await waitJobs(servers)
324 await wait(15000)
325 await waitJobs(servers)
326
327 await check1WebSeed(strategy)
328 await checkStatsWith1Webseed(strategy)
329 })
330
331 it('Should view 2 times the first video to have > min_views config', async function () {
332 this.timeout(40000)
333
334 await viewVideo(servers[ 0 ].url, video1Server2UUID)
335 await viewVideo(servers[ 2 ].url, video1Server2UUID)
336
337 await wait(10000)
338 await waitJobs(servers)
339 })
340
341 it('Should have 2 webseed on the first video', async function () {
342 this.timeout(40000)
343
344 await waitJobs(servers)
345 await waitUntilLog(servers[0], 'Duplicated ', 4)
346 await waitJobs(servers)
347
348 await check2Webseeds(strategy)
349 await checkStatsWith2Webseed(strategy)
350 })
351
352 it('Should remove the video and the redundancy files', async function () {
353 this.timeout(20000)
354
355 await removeVideo(servers[1].url, servers[1].accessToken, video1Server2UUID)
356
357 await waitJobs(servers)
358
359 for (const server of servers) {
360 await checkVideoFilesWereRemoved(video1Server2UUID, server.serverNumber)
361 }
362 })
363
364 after(function () {
365 return cleanServers()
366 })
367 })
368
369 describe('Test expiration', function () {
370 const strategy = 'recently-added'
371
372 async function checkContains (servers: ServerInfo[], str: string) {
373 for (const server of servers) {
374 const res = await getVideo(server.url, video1Server2UUID)
375 const video: VideoDetails = res.body
376
377 for (const f of video.files) {
378 expect(f.magnetUri).to.contain(str)
379 }
380 }
381 }
382
383 async function checkNotContains (servers: ServerInfo[], str: string) {
384 for (const server of servers) {
385 const res = await getVideo(server.url, video1Server2UUID)
386 const video: VideoDetails = res.body
387
388 for (const f of video.files) {
389 expect(f.magnetUri).to.not.contain(str)
390 }
391 }
392 }
393
394 before(async function () {
395 this.timeout(120000)
396
397 await runServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
398
399 await enableRedundancyOnServer1()
400 })
401
402 it('Should still have 2 webseeds after 10 seconds', async function () {
403 this.timeout(40000)
404
405 await wait(10000)
406
407 try {
408 await checkContains(servers, 'http%3A%2F%2Flocalhost%3A9001')
409 } catch {
410 // Maybe a server deleted a redundancy in the scheduler
411 await wait(2000)
412
413 await checkContains(servers, 'http%3A%2F%2Flocalhost%3A9001')
414 }
415 })
416
417 it('Should stop server 1 and expire video redundancy', async function () {
418 this.timeout(40000)
419
420 killallServers([ servers[0] ])
421
422 await wait(15000)
423
424 await checkNotContains([ servers[1], servers[2] ], 'http%3A%2F%2Flocalhost%3A9001')
425 })
426
427 after(function () {
428 return killallServers([ servers[1], servers[2] ])
429 })
430 })
431
432 describe('Test file replacement', function () {
433 let video2Server2UUID: string
434 const strategy = 'recently-added'
435
436 before(async function () {
437 this.timeout(120000)
438
439 await runServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
440
441 await enableRedundancyOnServer1()
442
443 await waitJobs(servers)
444 await waitUntilLog(servers[0], 'Duplicated ', 4)
445 await waitJobs(servers)
446
447 await check2Webseeds(strategy)
448 await checkStatsWith2Webseed(strategy)
449
450 const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 2 server 2' })
451 video2Server2UUID = res.body.video.uuid
452 })
453
454 it('Should cache video 2 webseed on the first video', async function () {
455 this.timeout(120000)
456
457 await waitJobs(servers)
458
459 let checked = false
460
461 while (checked === false) {
462 await wait(1000)
463
464 try {
465 await check1WebSeed(strategy, video1Server2UUID)
466 await check2Webseeds(strategy, video2Server2UUID)
467
468 checked = true
469 } catch {
470 checked = false
471 }
472 }
473 })
474
475 after(function () {
476 return cleanServers()
477 })
478 })
479})
diff --git a/server/tests/api/server/reverse-proxy.ts b/server/tests/api/server/reverse-proxy.ts
index e2c2a293e..d4c08c346 100644
--- a/server/tests/api/server/reverse-proxy.ts
+++ b/server/tests/api/server/reverse-proxy.ts
@@ -15,7 +15,7 @@ import {
15 userLogin, 15 userLogin,
16 viewVideo, 16 viewVideo,
17 wait 17 wait
18} from '../../utils' 18} from '../../../../shared/utils'
19const expect = chai.expect 19const expect = chai.expect
20 20
21import { 21import {
@@ -23,7 +23,7 @@ import {
23 flushTests, 23 flushTests,
24 runServer, 24 runServer,
25 registerUser, getCustomConfig, setAccessTokensToServers, updateCustomConfig 25 registerUser, getCustomConfig, setAccessTokensToServers, updateCustomConfig
26} from '../../utils/index' 26} from '../../../../shared/utils/index'
27 27
28describe('Test application behind a reverse proxy', function () { 28describe('Test application behind a reverse proxy', function () {
29 let server = null 29 let server = null
diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.ts
index cb229e876..517b4e542 100644
--- a/server/tests/api/server/stats.ts
+++ b/server/tests/api/server/stats.ts
@@ -13,11 +13,11 @@ import {
13 uploadVideo, 13 uploadVideo,
14 viewVideo, 14 viewVideo,
15 wait 15 wait
16} from '../../utils' 16} from '../../../../shared/utils'
17import { flushTests, setAccessTokensToServers } from '../../utils/index' 17import { flushTests, setAccessTokensToServers } from '../../../../shared/utils/index'
18import { getStats } from '../../utils/server/stats' 18import { getStats } from '../../../../shared/utils/server/stats'
19import { addVideoCommentThread } from '../../utils/videos/video-comments' 19import { addVideoCommentThread } from '../../../../shared/utils/videos/video-comments'
20import { waitJobs } from '../../utils/server/jobs' 20import { waitJobs } from '../../../../shared/utils/server/jobs'
21 21
22const expect = chai.expect 22const expect = chai.expect
23 23
diff --git a/server/tests/api/server/tracker.ts b/server/tests/api/server/tracker.ts
index 856f2f4d1..25ca00029 100644
--- a/server/tests/api/server/tracker.ts
+++ b/server/tests/api/server/tracker.ts
@@ -2,8 +2,8 @@
2 2
3import * as magnetUtil from 'magnet-uri' 3import * as magnetUtil from 'magnet-uri'
4import 'mocha' 4import 'mocha'
5import { getVideo, killallServers, runServer, ServerInfo, uploadVideo } from '../../utils' 5import { getVideo, killallServers, runServer, ServerInfo, uploadVideo } from '../../../../shared/utils'
6import { flushTests, setAccessTokensToServers } from '../../utils/index' 6import { flushTests, setAccessTokensToServers } from '../../../../shared/utils/index'
7import { VideoDetails } from '../../../../shared/models/videos' 7import { VideoDetails } from '../../../../shared/models/videos'
8import * as WebTorrent from 'webtorrent' 8import * as WebTorrent from 'webtorrent'
9 9
diff --git a/server/tests/api/users/blocklist.ts b/server/tests/api/users/blocklist.ts
index eed4b9f3e..4bca27a94 100644
--- a/server/tests/api/users/blocklist.ts
+++ b/server/tests/api/users/blocklist.ts
@@ -12,16 +12,16 @@ import {
12 ServerInfo, 12 ServerInfo,
13 uploadVideo, 13 uploadVideo,
14 userLogin 14 userLogin
15} from '../../utils/index' 15} from '../../../../shared/utils/index'
16import { setAccessTokensToServers } from '../../utils/users/login' 16import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
17import { getVideosListWithToken, getVideosList } from '../../utils/videos/videos' 17import { getVideosListWithToken, getVideosList } from '../../../../shared/utils/videos/videos'
18import { 18import {
19 addVideoCommentReply, 19 addVideoCommentReply,
20 addVideoCommentThread, 20 addVideoCommentThread,
21 getVideoCommentThreads, 21 getVideoCommentThreads,
22 getVideoThreadComments 22 getVideoThreadComments
23} from '../../utils/videos/video-comments' 23} from '../../../../shared/utils/videos/video-comments'
24import { waitJobs } from '../../utils/server/jobs' 24import { waitJobs } from '../../../../shared/utils/server/jobs'
25import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' 25import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
26import { 26import {
27 addAccountToAccountBlocklist, 27 addAccountToAccountBlocklist,
@@ -36,7 +36,7 @@ import {
36 removeAccountFromServerBlocklist, 36 removeAccountFromServerBlocklist,
37 removeServerFromAccountBlocklist, 37 removeServerFromAccountBlocklist,
38 removeServerFromServerBlocklist 38 removeServerFromServerBlocklist
39} from '../../utils/users/blocklist' 39} from '../../../../shared/utils/users/blocklist'
40 40
41const expect = chai.expect 41const expect = chai.expect
42 42
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts
index 65b80540c..88a7187d6 100644
--- a/server/tests/api/users/user-subscriptions.ts
+++ b/server/tests/api/users/user-subscriptions.ts
@@ -2,18 +2,27 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { createUser, doubleFollow, flushAndRunMultipleServers, follow, getVideosList, unfollow, updateVideo, userLogin } from '../../utils' 5import {
6import { killallServers, ServerInfo, uploadVideo } from '../../utils/index' 6 createUser,
7import { setAccessTokensToServers } from '../../utils/users/login' 7 doubleFollow,
8 flushAndRunMultipleServers,
9 follow,
10 getVideosList,
11 unfollow,
12 updateVideo,
13 userLogin
14} from '../../../../shared/utils'
15import { killallServers, ServerInfo, uploadVideo } from '../../../../shared/utils/index'
16import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
8import { Video, VideoChannel } from '../../../../shared/models/videos' 17import { Video, VideoChannel } from '../../../../shared/models/videos'
9import { waitJobs } from '../../utils/server/jobs' 18import { waitJobs } from '../../../../shared/utils/server/jobs'
10import { 19import {
11 addUserSubscription, 20 addUserSubscription,
12 listUserSubscriptions, 21 listUserSubscriptions,
13 listUserSubscriptionVideos, 22 listUserSubscriptionVideos,
14 removeUserSubscription, 23 removeUserSubscription,
15 getUserSubscription, areSubscriptionsExist 24 getUserSubscription, areSubscriptionsExist
16} from '../../utils/users/user-subscriptions' 25} from '../../../../shared/utils/users/user-subscriptions'
17 26
18const expect = chai.expect 27const expect = chai.expect
19 28
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index d8699db17..006d6cdf0 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -13,13 +13,13 @@ import {
13 removeUser, 13 removeUser,
14 updateMyUser, 14 updateMyUser,
15 userLogin 15 userLogin
16} from '../../utils' 16} from '../../../../shared/utils'
17import { getMyUserInformation, killallServers, ServerInfo, testImage, updateMyAvatar, uploadVideo } from '../../utils/index' 17import { getMyUserInformation, killallServers, ServerInfo, testImage, updateMyAvatar, uploadVideo } from '../../../../shared/utils/index'
18import { checkActorFilesWereRemoved, getAccount, getAccountsList } from '../../utils/users/accounts' 18import { checkActorFilesWereRemoved, getAccount, getAccountsList } from '../../../../shared/utils/users/accounts'
19import { setAccessTokensToServers } from '../../utils/users/login' 19import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
20import { User } from '../../../../shared/models/users' 20import { User } from '../../../../shared/models/users'
21import { VideoChannel } from '../../../../shared/models/videos' 21import { VideoChannel } from '../../../../shared/models/videos'
22import { waitJobs } from '../../utils/server/jobs' 22import { waitJobs } from '../../../../shared/utils/server/jobs'
23 23
24const expect = chai.expect 24const expect = chai.expect
25 25
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts
index fa5f5e371..b1733e45e 100644
--- a/server/tests/api/users/users-verification.ts
+++ b/server/tests/api/users/users-verification.ts
@@ -5,10 +5,10 @@ import 'mocha'
5import { 5import {
6 registerUser, flushTests, getUserInformation, getMyUserInformation, killallServers, 6 registerUser, flushTests, getUserInformation, getMyUserInformation, killallServers,
7 userLogin, login, runServer, ServerInfo, verifyEmail, updateCustomSubConfig 7 userLogin, login, runServer, ServerInfo, verifyEmail, updateCustomSubConfig
8} from '../../utils' 8} from '../../../../shared/utils'
9import { setAccessTokensToServers } from '../../utils/users/login' 9import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
10import { mockSmtpServer } from '../../utils/miscs/email' 10import { mockSmtpServer } from '../../../../shared/utils/miscs/email'
11import { waitJobs } from '../../utils/server/jobs' 11import { waitJobs } from '../../../../shared/utils/server/jobs'
12 12
13const expect = chai.expect 13const expect = chai.expect
14 14
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index e7bb845b9..4914c8ed5 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -32,10 +32,10 @@ import {
32 updateUser, 32 updateUser,
33 uploadVideo, 33 uploadVideo,
34 userLogin 34 userLogin
35} from '../../utils/index' 35} from '../../../../shared/utils/index'
36import { follow } from '../../utils/server/follows' 36import { follow } from '../../../../shared/utils/server/follows'
37import { setAccessTokensToServers } from '../../utils/users/login' 37import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
38import { getMyVideos } from '../../utils/videos/videos' 38import { getMyVideos } from '../../../../shared/utils/videos/videos'
39 39
40const expect = chai.expect 40const expect = chai.expect
41 41
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index b9ace2885..aa38b6b33 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -31,15 +31,15 @@ import {
31 viewVideo, 31 viewVideo,
32 wait, 32 wait,
33 webtorrentAdd 33 webtorrentAdd
34} from '../../utils' 34} from '../../../../shared/utils'
35import { 35import {
36 addVideoCommentReply, 36 addVideoCommentReply,
37 addVideoCommentThread, 37 addVideoCommentThread,
38 deleteVideoComment, 38 deleteVideoComment,
39 getVideoCommentThreads, 39 getVideoCommentThreads,
40 getVideoThreadComments 40 getVideoThreadComments
41} from '../../utils/videos/video-comments' 41} from '../../../../shared/utils/videos/video-comments'
42import { waitJobs } from '../../utils/server/jobs' 42import { waitJobs } from '../../../../shared/utils/server/jobs'
43 43
44const expect = chai.expect 44const expect = chai.expect
45 45
diff --git a/server/tests/api/videos/services.ts b/server/tests/api/videos/services.ts
index 2f1424292..2da86964f 100644
--- a/server/tests/api/videos/services.ts
+++ b/server/tests/api/videos/services.ts
@@ -2,8 +2,16 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { flushTests, getOEmbed, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils/index' 5import {
6import { runServer } from '../../utils/server/servers' 6 flushTests,
7 getOEmbed,
8 getVideosList,
9 killallServers,
10 ServerInfo,
11 setAccessTokensToServers,
12 uploadVideo
13} from '../../../../shared/utils/index'
14import { runServer } from '../../../../shared/utils/server/servers'
7 15
8const expect = chai.expect 16const expect = chai.expect
9 17
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index 089c3df25..069dec67c 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -28,7 +28,7 @@ import {
28 uploadVideo, 28 uploadVideo,
29 viewVideo, 29 viewVideo,
30 wait 30 wait
31} from '../../utils' 31} from '../../../../shared/utils'
32 32
33const expect = chai.expect 33const expect = chai.expect
34 34
diff --git a/server/tests/api/videos/video-abuse.ts b/server/tests/api/videos/video-abuse.ts
index a17f3c8de..3a7b623da 100644
--- a/server/tests/api/videos/video-abuse.ts
+++ b/server/tests/api/videos/video-abuse.ts
@@ -14,9 +14,9 @@ import {
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 updateVideoAbuse, 15 updateVideoAbuse,
16 uploadVideo 16 uploadVideo
17} from '../../utils/index' 17} from '../../../../shared/utils/index'
18import { doubleFollow } from '../../utils/server/follows' 18import { doubleFollow } from '../../../../shared/utils/server/follows'
19import { waitJobs } from '../../utils/server/jobs' 19import { waitJobs } from '../../../../shared/utils/server/jobs'
20 20
21const expect = chai.expect 21const expect = chai.expect
22 22
diff --git a/server/tests/api/videos/video-blacklist-management.ts b/server/tests/api/videos/video-blacklist-management.ts
index fab577b30..61411e30d 100644
--- a/server/tests/api/videos/video-blacklist-management.ts
+++ b/server/tests/api/videos/video-blacklist-management.ts
@@ -16,9 +16,9 @@ import {
16 setAccessTokensToServers, 16 setAccessTokensToServers,
17 updateVideoBlacklist, 17 updateVideoBlacklist,
18 uploadVideo 18 uploadVideo
19} from '../../utils/index' 19} from '../../../../shared/utils/index'
20import { doubleFollow } from '../../utils/server/follows' 20import { doubleFollow } from '../../../../shared/utils/server/follows'
21import { waitJobs } from '../../utils/server/jobs' 21import { waitJobs } from '../../../../shared/utils/server/jobs'
22import { VideoAbuse } from '../../../../shared/models/videos' 22import { VideoAbuse } from '../../../../shared/models/videos'
23 23
24const expect = chai.expect 24const expect = chai.expect
diff --git a/server/tests/api/videos/video-blacklist.ts b/server/tests/api/videos/video-blacklist.ts
index de4c68f1d..1cce82d2a 100644
--- a/server/tests/api/videos/video-blacklist.ts
+++ b/server/tests/api/videos/video-blacklist.ts
@@ -11,9 +11,9 @@ import {
11 ServerInfo, 11 ServerInfo,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 uploadVideo 13 uploadVideo
14} from '../../utils/index' 14} from '../../../../shared/utils/index'
15import { doubleFollow } from '../../utils/server/follows' 15import { doubleFollow } from '../../../../shared/utils/server/follows'
16import { waitJobs } from '../../utils/server/jobs' 16import { waitJobs } from '../../../../shared/utils/server/jobs'
17 17
18const expect = chai.expect 18const expect = chai.expect
19 19
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts
index 6e441410d..57bee713f 100644
--- a/server/tests/api/videos/video-captions.ts
+++ b/server/tests/api/videos/video-captions.ts
@@ -2,10 +2,17 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { checkVideoFilesWereRemoved, doubleFollow, flushAndRunMultipleServers, removeVideo, uploadVideo, wait } from '../../utils' 5import {
6import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from '../../utils/index' 6 checkVideoFilesWereRemoved,
7import { waitJobs } from '../../utils/server/jobs' 7 doubleFollow,
8import { createVideoCaption, deleteVideoCaption, listVideoCaptions, testCaptionFile } from '../../utils/videos/video-captions' 8 flushAndRunMultipleServers,
9 removeVideo,
10 uploadVideo,
11 wait
12} from '../../../../shared/utils'
13import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from '../../../../shared/utils/index'
14import { waitJobs } from '../../../../shared/utils/server/jobs'
15import { createVideoCaption, deleteVideoCaption, listVideoCaptions, testCaptionFile } from '../../../../shared/utils/videos/video-captions'
9import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model' 16import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model'
10 17
11const expect = chai.expect 18const expect = chai.expect
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts
index 1578a471d..25675a966 100644
--- a/server/tests/api/videos/video-change-ownership.ts
+++ b/server/tests/api/videos/video-change-ownership.ts
@@ -18,8 +18,8 @@ import {
18 uploadVideo, 18 uploadVideo,
19 userLogin, 19 userLogin,
20 getVideo 20 getVideo
21} from '../../utils' 21} from '../../../../shared/utils'
22import { waitJobs } from '../../utils/server/jobs' 22import { waitJobs } from '../../../../shared/utils/server/jobs'
23import { User } from '../../../../shared/models/users' 23import { User } from '../../../../shared/models/users'
24import { VideoDetails } from '../../../../shared/models/videos' 24import { VideoDetails } from '../../../../shared/models/videos'
25 25
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 41429a3d8..63514d69c 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -13,7 +13,7 @@ import {
13 updateVideoChannelAvatar, 13 updateVideoChannelAvatar,
14 uploadVideo, 14 uploadVideo,
15 userLogin 15 userLogin
16} from '../../utils' 16} from '../../../../shared/utils'
17import { 17import {
18 addVideoChannel, 18 addVideoChannel,
19 deleteVideoChannel, 19 deleteVideoChannel,
@@ -26,8 +26,8 @@ import {
26 ServerInfo, 26 ServerInfo,
27 setAccessTokensToServers, 27 setAccessTokensToServers,
28 updateVideoChannel 28 updateVideoChannel
29} from '../../utils/index' 29} from '../../../../shared/utils/index'
30import { waitJobs } from '../../utils/server/jobs' 30import { waitJobs } from '../../../../shared/utils/server/jobs'
31 31
32const expect = chai.expect 32const expect = chai.expect
33 33
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts
index d6e07c5b3..ce1b17e35 100644
--- a/server/tests/api/videos/video-comments.ts
+++ b/server/tests/api/videos/video-comments.ts
@@ -3,7 +3,7 @@
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' 5import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
6import { testImage } from '../../utils' 6import { testImage } from '../../../../shared/utils'
7import { 7import {
8 dateIsValid, 8 dateIsValid,
9 flushTests, 9 flushTests,
@@ -13,14 +13,14 @@ import {
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 updateMyAvatar, 14 updateMyAvatar,
15 uploadVideo 15 uploadVideo
16} from '../../utils/index' 16} from '../../../../shared/utils/index'
17import { 17import {
18 addVideoCommentReply, 18 addVideoCommentReply,
19 addVideoCommentThread, 19 addVideoCommentThread,
20 deleteVideoComment, 20 deleteVideoComment,
21 getVideoCommentThreads, 21 getVideoCommentThreads,
22 getVideoThreadComments 22 getVideoThreadComments
23} from '../../utils/videos/video-comments' 23} from '../../../../shared/utils/videos/video-comments'
24 24
25const expect = chai.expect 25const expect = chai.expect
26 26
diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.ts
index dd5cd78c0..cbda0b9a6 100644
--- a/server/tests/api/videos/video-description.ts
+++ b/server/tests/api/videos/video-description.ts
@@ -12,9 +12,9 @@ import {
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 updateVideo, 13 updateVideo,
14 uploadVideo 14 uploadVideo
15} from '../../utils/index' 15} from '../../../../shared/utils/index'
16import { doubleFollow } from '../../utils/server/follows' 16import { doubleFollow } from '../../../../shared/utils/server/follows'
17import { waitJobs } from '../../utils/server/jobs' 17import { waitJobs } from '../../../../shared/utils/server/jobs'
18 18
19const expect = chai.expect 19const expect = chai.expect
20 20
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts
index aaee79a4a..cd4988553 100644
--- a/server/tests/api/videos/video-imports.ts
+++ b/server/tests/api/videos/video-imports.ts
@@ -14,9 +14,9 @@ import {
14 killallServers, 14 killallServers,
15 ServerInfo, 15 ServerInfo,
16 setAccessTokensToServers 16 setAccessTokensToServers
17} from '../../utils' 17} from '../../../../shared/utils'
18import { waitJobs } from '../../utils/server/jobs' 18import { waitJobs } from '../../../../shared/utils/server/jobs'
19import { getMagnetURI, getYoutubeVideoUrl, importVideo, getMyVideoImports } from '../../utils/videos/video-imports' 19import { getMagnetURI, getYoutubeVideoUrl, importVideo, getMyVideoImports } from '../../../../shared/utils/videos/video-imports'
20 20
21const expect = chai.expect 21const expect = chai.expect
22 22
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index eab7a6991..df1ee2eb9 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -2,10 +2,17 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { flushTests, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils/index' 5import {
6import { userLogin } from '../../utils/users/login' 6 flushTests,
7import { createUser } from '../../utils/users/users' 7 getVideosList,
8import { getMyVideos } from '../../utils/videos/videos' 8 killallServers,
9 ServerInfo,
10 setAccessTokensToServers,
11 uploadVideo
12} from '../../../../shared/utils/index'
13import { userLogin } from '../../../../shared/utils/users/login'
14import { createUser } from '../../../../shared/utils/users/users'
15import { getMyVideos } from '../../../../shared/utils/videos/videos'
9import { 16import {
10 getAccountVideos, 17 getAccountVideos,
11 getConfig, 18 getConfig,
@@ -18,7 +25,7 @@ import {
18 searchVideoWithToken, 25 searchVideoWithToken,
19 updateCustomConfig, 26 updateCustomConfig,
20 updateMyUser 27 updateMyUser
21} from '../../utils' 28} from '../../../../shared/utils'
22import { ServerConfig } from '../../../../shared/models' 29import { ServerConfig } from '../../../../shared/models'
23import { CustomConfig } from '../../../../shared/models/server/custom-config.model' 30import { CustomConfig } from '../../../../shared/models/server/custom-config.model'
24import { User } from '../../../../shared/models/users' 31import { User } from '../../../../shared/models/users'
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts
index 9fefca7e3..0b4e66369 100644
--- a/server/tests/api/videos/video-privacy.ts
+++ b/server/tests/api/videos/video-privacy.ts
@@ -10,12 +10,12 @@ import {
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 uploadVideo 12 uploadVideo
13} from '../../utils/index' 13} from '../../../../shared/utils/index'
14import { doubleFollow } from '../../utils/server/follows' 14import { doubleFollow } from '../../../../shared/utils/server/follows'
15import { userLogin } from '../../utils/users/login' 15import { userLogin } from '../../../../shared/utils/users/login'
16import { createUser } from '../../utils/users/users' 16import { createUser } from '../../../../shared/utils/users/users'
17import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../../utils/videos/videos' 17import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../../../../shared/utils/videos/videos'
18import { waitJobs } from '../../utils/server/jobs' 18import { waitJobs } from '../../../../shared/utils/server/jobs'
19 19
20const expect = chai.expect 20const expect = chai.expect
21 21
diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts
index b226a9d50..632c4244c 100644
--- a/server/tests/api/videos/video-schedule-update.ts
+++ b/server/tests/api/videos/video-schedule-update.ts
@@ -15,8 +15,8 @@ import {
15 updateVideo, 15 updateVideo,
16 uploadVideo, 16 uploadVideo,
17 wait 17 wait
18} from '../../utils' 18} from '../../../../shared/utils'
19import { waitJobs } from '../../utils/server/jobs' 19import { waitJobs } from '../../../../shared/utils/server/jobs'
20 20
21const expect = chai.expect 21const expect = chai.expect
22 22
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts
index 23920d452..68cf00194 100644
--- a/server/tests/api/videos/video-transcoder.ts
+++ b/server/tests/api/videos/video-transcoder.ts
@@ -19,9 +19,10 @@ import {
19 setAccessTokensToServers, 19 setAccessTokensToServers,
20 uploadVideo, 20 uploadVideo,
21 webtorrentAdd 21 webtorrentAdd
22} from '../../utils' 22} from '../../../../shared/utils'
23import { join } from 'path' 23import { join } from 'path'
24import { waitJobs } from '../../utils/server/jobs' 24import { waitJobs } from '../../../../shared/utils/server/jobs'
25import { pathExists } from 'fs-extra'
25import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants' 26import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants'
26 27
27const expect = chai.expect 28const expect = chai.expect
diff --git a/server/tests/api/videos/videos-filter.ts b/server/tests/api/videos/videos-filter.ts
index a7588129f..59e37ad86 100644
--- a/server/tests/api/videos/videos-filter.ts
+++ b/server/tests/api/videos/videos-filter.ts
@@ -13,7 +13,7 @@ import {
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 uploadVideo, 14 uploadVideo,
15 userLogin 15 userLogin
16} from '../../utils' 16} from '../../../../shared/utils'
17import { Video, VideoPrivacy } from '../../../../shared/models/videos' 17import { Video, VideoPrivacy } from '../../../../shared/models/videos'
18import { UserRole } from '../../../../shared/models/users' 18import { UserRole } from '../../../../shared/models/users'
19 19
diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts
index 6d289b288..40ae94f79 100644
--- a/server/tests/api/videos/videos-history.ts
+++ b/server/tests/api/videos/videos-history.ts
@@ -11,9 +11,9 @@ import {
11 ServerInfo, 11 ServerInfo,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 uploadVideo 13 uploadVideo
14} from '../../utils' 14} from '../../../../shared/utils'
15import { Video, VideoDetails } from '../../../../shared/models/videos' 15import { Video, VideoDetails } from '../../../../shared/models/videos'
16import { userWatchVideo } from '../../utils/videos/video-history' 16import { userWatchVideo } from '../../../../shared/utils/videos/video-history'
17 17
18const expect = chai.expect 18const expect = chai.expect
19 19
diff --git a/server/tests/api/videos/videos-overview.ts b/server/tests/api/videos/videos-overview.ts
index 7d1f29c92..7221bcae6 100644
--- a/server/tests/api/videos/videos-overview.ts
+++ b/server/tests/api/videos/videos-overview.ts
@@ -2,8 +2,8 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils' 5import { flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/utils'
6import { getVideosOverview } from '../../utils/overviews/overviews' 6import { getVideosOverview } from '../../../../shared/utils/overviews/overviews'
7import { VideosOverview } from '../../../../shared/models/overviews' 7import { VideosOverview } from '../../../../shared/models/overviews'
8 8
9const expect = chai.expect 9const expect = chai.expect
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts
index 13bcfd209..4acda47b1 100644
--- a/server/tests/cli/create-import-video-file-job.ts
+++ b/server/tests/cli/create-import-video-file-job.ts
@@ -15,8 +15,8 @@ import {
15 ServerInfo, 15 ServerInfo,
16 setAccessTokensToServers, 16 setAccessTokensToServers,
17 uploadVideo 17 uploadVideo
18} from '../utils' 18} from '../../../shared/utils'
19import { waitJobs } from '../utils/server/jobs' 19import { waitJobs } from '../../../shared/utils/server/jobs'
20 20
21const expect = chai.expect 21const expect = chai.expect
22 22
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts
index c2e3840c5..50be5fa19 100644
--- a/server/tests/cli/create-transcoding-job.ts
+++ b/server/tests/cli/create-transcoding-job.ts
@@ -15,8 +15,8 @@ import {
15 ServerInfo, 15 ServerInfo,
16 setAccessTokensToServers, 16 setAccessTokensToServers,
17 uploadVideo, wait 17 uploadVideo, wait
18} from '../utils' 18} from '../../../shared/utils'
19import { waitJobs } from '../utils/server/jobs' 19import { waitJobs } from '../../../shared/utils/server/jobs'
20 20
21const expect = chai.expect 21const expect = chai.expect
22 22
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts
index 66dd39cce..6f6bc25a6 100644
--- a/server/tests/cli/optimize-old-videos.ts
+++ b/server/tests/cli/optimize-old-videos.ts
@@ -15,8 +15,8 @@ import {
15 ServerInfo, 15 ServerInfo,
16 setAccessTokensToServers, 16 setAccessTokensToServers,
17 uploadVideo, viewVideo, wait 17 uploadVideo, viewVideo, wait
18} from '../utils' 18} from '../../../shared/utils'
19import { waitJobs } from '../utils/server/jobs' 19import { waitJobs } from '../../../shared/utils/server/jobs'
20import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../helpers/ffmpeg-utils' 20import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../helpers/ffmpeg-utils'
21import { VIDEO_TRANSCODING_FPS } from '../../initializers' 21import { VIDEO_TRANSCODING_FPS } from '../../initializers'
22import { join } from 'path' 22import { join } from 'path'
diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts
index 7a712bc4e..e2836d0c3 100644
--- a/server/tests/cli/peertube.ts
+++ b/server/tests/cli/peertube.ts
@@ -11,7 +11,7 @@ import {
11 runServer, 11 runServer,
12 ServerInfo, 12 ServerInfo,
13 setAccessTokensToServers 13 setAccessTokensToServers
14} from '../utils' 14} from '../../../shared/utils'
15 15
16describe('Test CLI wrapper', function () { 16describe('Test CLI wrapper', function () {
17 let server: ServerInfo 17 let server: ServerInfo
diff --git a/server/tests/cli/reset-password.ts b/server/tests/cli/reset-password.ts
index bf937d1c0..1b65f7e39 100644
--- a/server/tests/cli/reset-password.ts
+++ b/server/tests/cli/reset-password.ts
@@ -10,7 +10,7 @@ import {
10 runServer, 10 runServer,
11 ServerInfo, 11 ServerInfo,
12 setAccessTokensToServers 12 setAccessTokensToServers
13} from '../utils' 13} from '../../../shared/utils'
14 14
15describe('Test reset password scripts', function () { 15describe('Test reset password scripts', function () {
16 let server: ServerInfo 16 let server: ServerInfo
diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts
index b89e72ab7..811ea6a9f 100644
--- a/server/tests/cli/update-host.ts
+++ b/server/tests/cli/update-host.ts
@@ -3,8 +3,8 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { VideoDetails } from '../../../shared/models/videos' 5import { VideoDetails } from '../../../shared/models/videos'
6import { waitJobs } from '../utils/server/jobs' 6import { waitJobs } from '../../../shared/utils/server/jobs'
7import { addVideoCommentThread } from '../utils/videos/video-comments' 7import { addVideoCommentThread } from '../../../shared/utils/videos/video-comments'
8import { 8import {
9 addVideoChannel, 9 addVideoChannel,
10 createUser, 10 createUser,
@@ -21,8 +21,8 @@ import {
21 ServerInfo, 21 ServerInfo,
22 setAccessTokensToServers, 22 setAccessTokensToServers,
23 uploadVideo 23 uploadVideo
24} from '../utils' 24} from '../../../shared/utils'
25import { getAccountsList } from '../utils/users/accounts' 25import { getAccountsList } from '../../../shared/utils/users/accounts'
26 26
27const expect = chai.expect 27const expect = chai.expect
28 28
diff --git a/server/tests/client.ts b/server/tests/client.ts
index b33a653b1..06b4a9c5a 100644
--- a/server/tests/client.ts
+++ b/server/tests/client.ts
@@ -15,7 +15,7 @@ import {
15 updateCustomConfig, 15 updateCustomConfig,
16 updateCustomSubConfig, 16 updateCustomSubConfig,
17 uploadVideo 17 uploadVideo
18} from './utils' 18} from '../../shared/utils'
19 19
20const expect = chai.expect 20const expect = chai.expect
21 21
diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts
index 28fe3493b..a771474bc 100644
--- a/server/tests/feeds/feeds.ts
+++ b/server/tests/feeds/feeds.ts
@@ -13,10 +13,10 @@ import {
13 ServerInfo, 13 ServerInfo,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 uploadVideo, userLogin 15 uploadVideo, userLogin
16} from '../utils' 16} from '../../../shared/utils'
17import * as libxmljs from 'libxmljs' 17import * as libxmljs from 'libxmljs'
18import { addVideoCommentThread } from '../utils/videos/video-comments' 18import { addVideoCommentThread } from '../../../shared/utils/videos/video-comments'
19import { waitJobs } from '../utils/server/jobs' 19import { waitJobs } from '../../../shared/utils/server/jobs'
20import { User } from '../../../shared/models/users' 20import { User } from '../../../shared/models/users'
21 21
22chai.use(require('chai-xml')) 22chai.use(require('chai-xml'))
diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts
index 4de47d693..5f82719da 100644
--- a/server/tests/misc-endpoints.ts
+++ b/server/tests/misc-endpoints.ts
@@ -12,7 +12,7 @@ import {
12 ServerInfo, 12 ServerInfo,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 uploadVideo 14 uploadVideo
15} from './utils' 15} from '../../shared/utils'
16import { VideoPrivacy } from '../../shared/models/videos' 16import { VideoPrivacy } from '../../shared/models/videos'
17 17
18const expect = chai.expect 18const expect = chai.expect
diff --git a/server/tests/real-world/populate-database.ts b/server/tests/real-world/populate-database.ts
index a7fdbd1dc..016503498 100644
--- a/server/tests/real-world/populate-database.ts
+++ b/server/tests/real-world/populate-database.ts
@@ -10,7 +10,7 @@ import {
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 uploadVideo 12 uploadVideo
13} from '../utils' 13} from '../../../shared/utils'
14import * as Bluebird from 'bluebird' 14import * as Bluebird from 'bluebird'
15 15
16start() 16start()
diff --git a/server/tests/real-world/real-world.ts b/server/tests/real-world/real-world.ts
index a96469b11..ac3baaf9a 100644
--- a/server/tests/real-world/real-world.ts
+++ b/server/tests/real-world/real-world.ts
@@ -16,8 +16,8 @@ import {
16 updateVideo, 16 updateVideo,
17 uploadVideo, viewVideo, 17 uploadVideo, viewVideo,
18 wait 18 wait
19} from '../utils' 19} from '../../../shared/utils'
20import { getJobsListPaginationAndSort } from '../utils/server/jobs' 20import { getJobsListPaginationAndSort } from '../../../shared/utils/server/jobs'
21 21
22interface ServerInfo extends DefaultServerInfo { 22interface ServerInfo extends DefaultServerInfo {
23 requestsNumber: number 23 requestsNumber: number
diff --git a/server/tools/peertube-get-access-token.ts b/server/tools/peertube-get-access-token.ts
index eb2571a03..a68665f5b 100644
--- a/server/tools/peertube-get-access-token.ts
+++ b/server/tools/peertube-get-access-token.ts
@@ -6,7 +6,7 @@ import {
6 Server, 6 Server,
7 Client, 7 Client,
8 User 8 User
9} from '../tests/utils/index' 9} from '../../shared/utils'
10 10
11program 11program
12 .option('-u, --url <url>', 'Server url') 12 .option('-u, --url <url>', 'Server url')
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts
index 21505b79d..1fe0a9348 100644
--- a/server/tools/peertube-import-videos.ts
+++ b/server/tools/peertube-import-videos.ts
@@ -6,7 +6,7 @@ import { join } from 'path'
6import { VideoPrivacy } from '../../shared/models/videos' 6import { VideoPrivacy } from '../../shared/models/videos'
7import { doRequestAndSaveToFile } from '../helpers/requests' 7import { doRequestAndSaveToFile } from '../helpers/requests'
8import { CONSTRAINTS_FIELDS } from '../initializers' 8import { CONSTRAINTS_FIELDS } from '../initializers'
9import { getClient, getVideoCategories, login, searchVideoWithSort, uploadVideo } from '../tests/utils' 9import { getClient, getVideoCategories, login, searchVideoWithSort, uploadVideo } from '../../shared/utils/index'
10import { truncate } from 'lodash' 10import { truncate } from 'lodash'
11import * as prompt from 'prompt' 11import * as prompt from 'prompt'
12import { remove } from 'fs-extra' 12import { remove } from 'fs-extra'
diff --git a/server/tools/peertube-upload.ts b/server/tools/peertube-upload.ts
index 6248fb47d..cc7bd9b4c 100644
--- a/server/tools/peertube-upload.ts
+++ b/server/tools/peertube-upload.ts
@@ -1,8 +1,8 @@
1import * as program from 'commander' 1import * as program from 'commander'
2import { access, constants } from 'fs-extra' 2import { access, constants } from 'fs-extra'
3import { isAbsolute } from 'path' 3import { isAbsolute } from 'path'
4import { getClient, login } from '../tests/utils' 4import { getClient, login } from '../../shared/utils'
5import { uploadVideo } from '../tests/utils/index' 5import { uploadVideo } from '../../shared/utils/'
6import { VideoPrivacy } from '../../shared/models/videos' 6import { VideoPrivacy } from '../../shared/models/videos'
7import { netrc, getSettings } from './cli' 7import { netrc, getSettings } from './cli'
8 8
diff --git a/server/tests/utils/cli/cli.ts b/shared/utils/cli/cli.ts
index 54d05e9c6..54d05e9c6 100644
--- a/server/tests/utils/cli/cli.ts
+++ b/shared/utils/cli/cli.ts
diff --git a/server/tests/utils/feeds/feeds.ts b/shared/utils/feeds/feeds.ts
index af6df2b20..af6df2b20 100644
--- a/server/tests/utils/feeds/feeds.ts
+++ b/shared/utils/feeds/feeds.ts
diff --git a/server/tests/utils/index.ts b/shared/utils/index.ts
index 8349631c9..e08bbfd2a 100644
--- a/server/tests/utils/index.ts
+++ b/shared/utils/index.ts
@@ -2,11 +2,15 @@ export * from './server/activitypub'
2export * from './cli/cli' 2export * from './cli/cli'
3export * from './server/clients' 3export * from './server/clients'
4export * from './server/config' 4export * from './server/config'
5export * from './server/jobs'
5export * from './users/login' 6export * from './users/login'
6export * from './miscs/miscs' 7export * from './miscs/miscs'
7export * from './miscs/stubs' 8export * from './miscs/stubs'
9export * from './miscs/sql'
8export * from './server/follows' 10export * from './server/follows'
11export * from './requests/activitypub'
9export * from './requests/requests' 12export * from './requests/requests'
13export * from './requests/check-api-params'
10export * from './server/servers' 14export * from './server/servers'
11export * from './videos/services' 15export * from './videos/services'
12export * from './users/users' 16export * from './users/users'
diff --git a/server/tests/utils/miscs/email.ts b/shared/utils/miscs/email.ts
index 21accd09d..21accd09d 100644
--- a/server/tests/utils/miscs/email.ts
+++ b/shared/utils/miscs/email.ts
diff --git a/server/tests/utils/miscs/miscs.ts b/shared/utils/miscs/miscs.ts
index 589daa420..91a93b631 100644
--- a/server/tests/utils/miscs/miscs.ts
+++ b/shared/utils/miscs/miscs.ts
@@ -33,8 +33,8 @@ function webtorrentAdd (torrent: string, refreshWebTorrent = false) {
33} 33}
34 34
35function root () { 35function root () {
36 // We are in server/tests/utils/miscs 36 // We are in /shared/utils/miscs
37 return join(__dirname, '..', '..', '..', '..') 37 return join(__dirname, '..', '..', '..')
38} 38}
39 39
40async function testImage (url: string, imageName: string, imagePath: string, extension = '.jpg') { 40async function testImage (url: string, imageName: string, imagePath: string, extension = '.jpg') {
@@ -44,7 +44,7 @@ async function testImage (url: string, imageName: string, imagePath: string, ext
44 44
45 const body = res.body 45 const body = res.body
46 46
47 const data = await readFile(join(__dirname, '..', '..', 'fixtures', imageName + extension)) 47 const data = await readFile(join(root(), 'server', 'tests', 'fixtures', imageName + extension))
48 const minLength = body.length - ((20 * body.length) / 100) 48 const minLength = body.length - ((20 * body.length) / 100)
49 const maxLength = body.length + ((20 * body.length) / 100) 49 const maxLength = body.length + ((20 * body.length) / 100)
50 50
@@ -59,7 +59,7 @@ function buildAbsoluteFixturePath (path: string, customTravisPath = false) {
59 59
60 if (customTravisPath && process.env.TRAVIS) return join(process.env.HOME, 'fixtures', path) 60 if (customTravisPath && process.env.TRAVIS) return join(process.env.HOME, 'fixtures', path)
61 61
62 return join(__dirname, '..', '..', 'fixtures', path) 62 return join(root(), 'server', 'tests', 'fixtures', path)
63} 63}
64 64
65async function generateHighBitrateVideo () { 65async function generateHighBitrateVideo () {
diff --git a/server/tests/utils/miscs/sql.ts b/shared/utils/miscs/sql.ts
index 027f78131..027f78131 100644
--- a/server/tests/utils/miscs/sql.ts
+++ b/shared/utils/miscs/sql.ts
diff --git a/server/tests/utils/miscs/stubs.ts b/shared/utils/miscs/stubs.ts
index d1eb0e3b2..d1eb0e3b2 100644
--- a/server/tests/utils/miscs/stubs.ts
+++ b/shared/utils/miscs/stubs.ts
diff --git a/server/tests/utils/overviews/overviews.ts b/shared/utils/overviews/overviews.ts
index 23e3ceb1e..23e3ceb1e 100644
--- a/server/tests/utils/overviews/overviews.ts
+++ b/shared/utils/overviews/overviews.ts
diff --git a/server/tests/utils/requests/activitypub.ts b/shared/utils/requests/activitypub.ts
index 96fee60a8..e2348ace0 100644
--- a/server/tests/utils/requests/activitypub.ts
+++ b/shared/utils/requests/activitypub.ts
@@ -1,7 +1,7 @@
1import { doRequest } from '../../../helpers/requests' 1import { doRequest } from '../../../server/helpers/requests'
2import { HTTP_SIGNATURE } from '../../../initializers' 2import { HTTP_SIGNATURE } from '../../../server/initializers'
3import { buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activitypub-http-utils' 3import { buildGlobalHeaders } from '../../../server/lib/job-queue/handlers/utils/activitypub-http-utils'
4import { activityPubContextify } from '../../../helpers/activitypub' 4import { activityPubContextify } from '../../../server/helpers/activitypub'
5 5
6function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) { 6function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) {
7 const options = { 7 const options = {
diff --git a/server/tests/utils/requests/check-api-params.ts b/shared/utils/requests/check-api-params.ts
index a2a549682..a2a549682 100644
--- a/server/tests/utils/requests/check-api-params.ts
+++ b/shared/utils/requests/check-api-params.ts
diff --git a/server/tests/utils/requests/requests.ts b/shared/utils/requests/requests.ts
index 5796540f7..77e9f6164 100644
--- a/server/tests/utils/requests/requests.ts
+++ b/shared/utils/requests/requests.ts
@@ -1,5 +1,5 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { buildAbsoluteFixturePath } from '../miscs/miscs' 2import { buildAbsoluteFixturePath, root } from '../miscs/miscs'
3import { isAbsolute, join } from 'path' 3import { isAbsolute, join } from 'path'
4 4
5function makeGetRequest (options: { 5function makeGetRequest (options: {
@@ -142,7 +142,7 @@ function updateAvatarRequest (options: {
142 if (isAbsolute(options.fixture)) { 142 if (isAbsolute(options.fixture)) {
143 filePath = options.fixture 143 filePath = options.fixture
144 } else { 144 } else {
145 filePath = join(__dirname, '..', '..', 'fixtures', options.fixture) 145 filePath = join(root(), 'server', 'tests', 'fixtures', options.fixture)
146 } 146 }
147 147
148 return makeUploadRequest({ 148 return makeUploadRequest({
diff --git a/server/tests/utils/search/video-channels.ts b/shared/utils/search/video-channels.ts
index 0532134ae..0532134ae 100644
--- a/server/tests/utils/search/video-channels.ts
+++ b/shared/utils/search/video-channels.ts
diff --git a/server/tests/utils/search/videos.ts b/shared/utils/search/videos.ts
index 8c0037ccc..ba4627017 100644
--- a/server/tests/utils/search/videos.ts
+++ b/shared/utils/search/videos.ts
@@ -1,7 +1,7 @@
1/* tslint:disable:no-unused-expression */ 1/* tslint:disable:no-unused-expression */
2 2
3import * as request from 'supertest' 3import * as request from 'supertest'
4import { VideosSearchQuery } from '../../../../shared/models/search' 4import { VideosSearchQuery } from '../../models/search'
5import { immutableAssign } from '../miscs/miscs' 5import { immutableAssign } from '../miscs/miscs'
6 6
7function searchVideo (url: string, search: string) { 7function searchVideo (url: string, search: string) {
diff --git a/server/tests/utils/server/activitypub.ts b/shared/utils/server/activitypub.ts
index eccb198ca..eccb198ca 100644
--- a/server/tests/utils/server/activitypub.ts
+++ b/shared/utils/server/activitypub.ts
diff --git a/server/tests/utils/server/clients.ts b/shared/utils/server/clients.ts
index 273aac747..273aac747 100644
--- a/server/tests/utils/server/clients.ts
+++ b/shared/utils/server/clients.ts
diff --git a/server/tests/utils/server/config.ts b/shared/utils/server/config.ts
index aa3100d34..5b888b061 100644
--- a/server/tests/utils/server/config.ts
+++ b/shared/utils/server/config.ts
@@ -1,5 +1,5 @@
1import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests' 1import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests'
2import { CustomConfig } from '../../../../shared/models/server/custom-config.model' 2import { CustomConfig } from '../../models/server/custom-config.model'
3 3
4function getConfig (url: string) { 4function getConfig (url: string) {
5 const path = '/api/v1/config' 5 const path = '/api/v1/config'
diff --git a/server/tests/utils/server/follows.ts b/shared/utils/server/follows.ts
index 7741757a6..7741757a6 100644
--- a/server/tests/utils/server/follows.ts
+++ b/shared/utils/server/follows.ts
diff --git a/server/tests/utils/server/jobs.ts b/shared/utils/server/jobs.ts
index 26180ec72..7c7e89824 100644
--- a/server/tests/utils/server/jobs.ts
+++ b/shared/utils/server/jobs.ts
@@ -1,7 +1,7 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { Job, JobState } from '../../../../shared/models' 2import { Job, JobState } from '../../models'
3import { ServerInfo } from './servers'
4import { wait } from '../miscs/miscs' 3import { wait } from '../miscs/miscs'
4import { ServerInfo } from './servers'
5 5
6function getJobsList (url: string, accessToken: string, state: JobState) { 6function getJobsList (url: string, accessToken: string, state: JobState) {
7 const path = '/api/v1/jobs/' + state 7 const path = '/api/v1/jobs/' + state
diff --git a/server/tests/utils/server/redundancy.ts b/shared/utils/server/redundancy.ts
index c39ff2c8b..c39ff2c8b 100644
--- a/server/tests/utils/server/redundancy.ts
+++ b/shared/utils/server/redundancy.ts
diff --git a/server/tests/utils/server/servers.ts b/shared/utils/server/servers.ts
index f358a21f1..88d2b390c 100644
--- a/server/tests/utils/server/servers.ts
+++ b/shared/utils/server/servers.ts
@@ -115,7 +115,7 @@ function runServer (serverNumber: number, configOverride?: Object, args = []) {
115 } 115 }
116 116
117 return new Promise<ServerInfo>(res => { 117 return new Promise<ServerInfo>(res => {
118 server.app = fork(join(__dirname, '..', '..', '..', '..', 'dist', 'server.js'), args, options) 118 server.app = fork(join(root(), 'dist', 'server.js'), args, options)
119 server.app.stdout.on('data', function onStdout (data) { 119 server.app.stdout.on('data', function onStdout (data) {
120 let dontContinue = false 120 let dontContinue = false
121 121
diff --git a/server/tests/utils/server/stats.ts b/shared/utils/server/stats.ts
index 6f079ad18..6f079ad18 100644
--- a/server/tests/utils/server/stats.ts
+++ b/shared/utils/server/stats.ts
diff --git a/server/tests/utils/users/accounts.ts b/shared/utils/users/accounts.ts
index 257fa5b27..388eb6973 100644
--- a/server/tests/utils/users/accounts.ts
+++ b/shared/utils/users/accounts.ts
@@ -3,7 +3,7 @@
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { existsSync, readdir } from 'fs-extra' 4import { existsSync, readdir } from 'fs-extra'
5import { join } from 'path' 5import { join } from 'path'
6import { Account } from '../../../../shared/models/actors' 6import { Account } from '../../models/actors'
7import { root } from '../miscs/miscs' 7import { root } from '../miscs/miscs'
8import { makeGetRequest } from '../requests/requests' 8import { makeGetRequest } from '../requests/requests'
9 9
diff --git a/server/tests/utils/users/blocklist.ts b/shared/utils/users/blocklist.ts
index 5feb84179..5feb84179 100644
--- a/server/tests/utils/users/blocklist.ts
+++ b/shared/utils/users/blocklist.ts
diff --git a/server/tests/utils/users/login.ts b/shared/utils/users/login.ts
index ddeb9df2a..ddeb9df2a 100644
--- a/server/tests/utils/users/login.ts
+++ b/shared/utils/users/login.ts
diff --git a/server/tests/utils/users/user-subscriptions.ts b/shared/utils/users/user-subscriptions.ts
index 7148fbfca..7148fbfca 100644
--- a/server/tests/utils/users/user-subscriptions.ts
+++ b/shared/utils/users/user-subscriptions.ts
diff --git a/server/tests/utils/users/users.ts b/shared/utils/users/users.ts
index f12992315..554e42c01 100644
--- a/server/tests/utils/users/users.ts
+++ b/shared/utils/users/users.ts
@@ -1,8 +1,8 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { makePostBodyRequest, makePutBodyRequest, updateAvatarRequest } from '../requests/requests' 2import { makePostBodyRequest, makePutBodyRequest, updateAvatarRequest } from '../requests/requests'
3 3
4import { UserRole } from '../../../../shared/index' 4import { UserRole } from '../../index'
5import { NSFWPolicyType } from '../../../../shared/models/videos/nsfw-policy.type' 5import { NSFWPolicyType } from '../../models/videos/nsfw-policy.type'
6 6
7function createUser ( 7function createUser (
8 url: string, 8 url: string,
diff --git a/server/tests/utils/videos/services.ts b/shared/utils/videos/services.ts
index 1a53dd4cf..1a53dd4cf 100644
--- a/server/tests/utils/videos/services.ts
+++ b/shared/utils/videos/services.ts
diff --git a/server/tests/utils/videos/video-abuses.ts b/shared/utils/videos/video-abuses.ts
index 4ad82ad8c..7f011ec0f 100644
--- a/server/tests/utils/videos/video-abuses.ts
+++ b/shared/utils/videos/video-abuses.ts
@@ -1,5 +1,5 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { VideoAbuseUpdate } from '../../../../shared/models/videos/abuse/video-abuse-update.model' 2import { VideoAbuseUpdate } from '../../models/videos/abuse/video-abuse-update.model'
3import { makeDeleteRequest, makePutBodyRequest } from '../requests/requests' 3import { makeDeleteRequest, makePutBodyRequest } from '../requests/requests'
4 4
5function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 200) { 5function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 200) {
diff --git a/server/tests/utils/videos/video-blacklist.ts b/shared/utils/videos/video-blacklist.ts
index 2c176fde0..2c176fde0 100644
--- a/server/tests/utils/videos/video-blacklist.ts
+++ b/shared/utils/videos/video-blacklist.ts
diff --git a/server/tests/utils/videos/video-captions.ts b/shared/utils/videos/video-captions.ts
index 8d67f617b..8d67f617b 100644
--- a/server/tests/utils/videos/video-captions.ts
+++ b/shared/utils/videos/video-captions.ts
diff --git a/server/tests/utils/videos/video-change-ownership.ts b/shared/utils/videos/video-change-ownership.ts
index f288692ea..f288692ea 100644
--- a/server/tests/utils/videos/video-change-ownership.ts
+++ b/shared/utils/videos/video-change-ownership.ts
diff --git a/server/tests/utils/videos/video-channels.ts b/shared/utils/videos/video-channels.ts
index 70e8d1a6b..3935c261e 100644
--- a/server/tests/utils/videos/video-channels.ts
+++ b/shared/utils/videos/video-channels.ts
@@ -1,5 +1,5 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { VideoChannelCreate, VideoChannelUpdate } from '../../../../shared/models/videos' 2import { VideoChannelCreate, VideoChannelUpdate } from '../../models/videos'
3import { updateAvatarRequest } from '../requests/requests' 3import { updateAvatarRequest } from '../requests/requests'
4 4
5function getVideoChannelsList (url: string, start: number, count: number, sort?: string) { 5function getVideoChannelsList (url: string, start: number, count: number, sort?: string) {
diff --git a/server/tests/utils/videos/video-comments.ts b/shared/utils/videos/video-comments.ts
index 0ebf69ced..0ebf69ced 100644
--- a/server/tests/utils/videos/video-comments.ts
+++ b/shared/utils/videos/video-comments.ts
diff --git a/server/tests/utils/videos/video-history.ts b/shared/utils/videos/video-history.ts
index 7635478f7..7635478f7 100644
--- a/server/tests/utils/videos/video-history.ts
+++ b/shared/utils/videos/video-history.ts
diff --git a/server/tests/utils/videos/video-imports.ts b/shared/utils/videos/video-imports.ts
index eb985a5b1..3fa49b432 100644
--- a/server/tests/utils/videos/video-imports.ts
+++ b/shared/utils/videos/video-imports.ts
@@ -1,4 +1,5 @@
1import { VideoImportCreate } from '../../../../shared/models/videos' 1
2import { VideoImportCreate } from '../../models/videos'
2import { makeGetRequest, makeUploadRequest } from '../requests/requests' 3import { makeGetRequest, makeUploadRequest } from '../requests/requests'
3 4
4function getYoutubeVideoUrl () { 5function getYoutubeVideoUrl () {
diff --git a/server/tests/utils/videos/videos.ts b/shared/utils/videos/videos.ts
index d6c3e5dac..f5fcc6a8a 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/shared/utils/videos/videos.ts
@@ -16,8 +16,9 @@ import {
16 ServerInfo, 16 ServerInfo,
17 testImage 17 testImage
18} from '../' 18} from '../'
19import { VideoDetails, VideoPrivacy } from '../../../../shared/models/videos' 19
20import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../initializers/constants' 20import { VideoDetails, VideoPrivacy } from '../../models/videos'
21import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../server/initializers/constants'
21import { dateIsValid, webtorrentAdd } from '../miscs/miscs' 22import { dateIsValid, webtorrentAdd } from '../miscs/miscs'
22 23
23type VideoAttributes = { 24type VideoAttributes = {
@@ -416,7 +417,7 @@ function rateVideo (url: string, accessToken: string, id: number, rating: string
416function parseTorrentVideo (server: ServerInfo, videoUUID: string, resolution: number) { 417function parseTorrentVideo (server: ServerInfo, videoUUID: string, resolution: number) {
417 return new Promise<any>((res, rej) => { 418 return new Promise<any>((res, rej) => {
418 const torrentName = videoUUID + '-' + resolution + '.torrent' 419 const torrentName = videoUUID + '-' + resolution + '.torrent'
419 const torrentPath = join(__dirname, '..', '..', '..', '..', 'test' + server.serverNumber, 'torrents', torrentName) 420 const torrentPath = join(root(), 'test' + server.serverNumber, 'torrents', torrentName)
420 readFile(torrentPath, (err, data) => { 421 readFile(torrentPath, (err, data) => {
421 if (err) return rej(err) 422 if (err) return rej(err)
422 423