From c55e3d7227fe1453869e309025996b9d75256d5d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 17 Dec 2021 11:58:15 +0100 Subject: Move test functions outside extra-utils --- server/tests/api/activitypub/cleaner.ts | 2 +- server/tests/api/activitypub/fetch.ts | 9 +++++++- server/tests/api/activitypub/helpers.ts | 3 ++- server/tests/api/activitypub/refresher.ts | 4 ++-- server/tests/api/activitypub/security.ts | 3 ++- server/tests/api/check-params/abuses.ts | 6 ++---- server/tests/api/check-params/accounts.ts | 10 ++------- server/tests/api/check-params/blocklist.ts | 6 ++---- server/tests/api/check-params/contact-form.ts | 10 ++------- server/tests/api/check-params/follows.ts | 6 ++---- server/tests/api/check-params/jobs.ts | 12 ++--------- server/tests/api/check-params/live.ts | 4 ++-- server/tests/api/check-params/my-user.ts | 9 +++----- server/tests/api/check-params/plugins.ts | 6 ++---- server/tests/api/check-params/redundancy.ts | 6 ++---- server/tests/api/check-params/search.ts | 12 ++--------- server/tests/api/check-params/transcoding.ts | 9 +++++++- server/tests/api/check-params/upload-quota.ts | 4 ++-- .../tests/api/check-params/user-notifications.ts | 10 ++++----- .../tests/api/check-params/user-subscriptions.ts | 4 +--- server/tests/api/check-params/users-admin.ts | 7 ++---- server/tests/api/check-params/users.ts | 10 ++------- server/tests/api/check-params/video-blacklist.ts | 6 ++---- server/tests/api/check-params/video-captions.ts | 4 ++-- server/tests/api/check-params/video-channels.ts | 8 +++---- server/tests/api/check-params/video-comments.ts | 6 ++---- server/tests/api/check-params/video-files.ts | 9 +++++++- server/tests/api/check-params/video-imports.ts | 9 +++----- server/tests/api/check-params/video-playlists.ts | 22 +++++++++---------- server/tests/api/check-params/videos-history.ts | 5 ++--- server/tests/api/check-params/videos.ts | 10 +++------ server/tests/api/live/live-constraints.ts | 6 +++--- server/tests/api/live/live-permanent.ts | 4 ++-- server/tests/api/live/live-rtmps.ts | 4 ++-- server/tests/api/live/live-save-replay.ts | 6 +++--- server/tests/api/live/live-socket-messages.ts | 4 ++-- server/tests/api/live/live-views.ts | 4 ++-- server/tests/api/live/live.ts | 25 ++++++++++------------ .../tests/api/moderation/blocklist-notification.ts | 9 +++++++- server/tests/api/moderation/video-blacklist.ts | 4 ++-- .../tests/api/notifications/admin-notifications.ts | 9 ++++---- .../api/notifications/comments-notifications.ts | 8 +++---- .../api/notifications/moderation-notifications.ts | 11 ++++------ .../tests/api/notifications/notifications-api.ts | 8 +++---- .../tests/api/notifications/user-notifications.ts | 11 ++++------ server/tests/api/object-storage/live.ts | 6 +++--- server/tests/api/object-storage/video-imports.ts | 7 +++--- server/tests/api/object-storage/videos.ts | 9 +++----- .../tests/api/redundancy/redundancy-constraints.ts | 9 +++++++- server/tests/api/redundancy/redundancy.ts | 23 +++++++++----------- .../search/search-activitypub-video-channels.ts | 4 ++-- .../search/search-activitypub-video-playlists.ts | 4 ++-- .../tests/api/search/search-activitypub-videos.ts | 4 ++-- server/tests/api/search/search-videos.ts | 4 ++-- server/tests/api/server/auto-follows.ts | 12 +++-------- server/tests/api/server/config-defaults.ts | 10 ++------- server/tests/api/server/config.ts | 4 ++-- server/tests/api/server/contact-form.ts | 6 +++--- server/tests/api/server/email.ts | 3 ++- server/tests/api/server/follows.ts | 14 ++---------- server/tests/api/server/handle-down.ts | 6 +++--- server/tests/api/server/jobs.ts | 2 +- server/tests/api/server/plugins.ts | 8 +++---- server/tests/api/server/proxy.ts | 5 ++--- server/tests/api/server/reverse-proxy.ts | 3 ++- server/tests/api/server/slow-follows.ts | 9 +++++++- server/tests/api/server/stats.ts | 4 ++-- server/tests/api/users/users-multiple-servers.ts | 8 ++++--- server/tests/api/users/users-verification.ts | 3 ++- server/tests/api/users/users.ts | 4 ++-- server/tests/api/videos/audio-only.ts | 9 +++++++- server/tests/api/videos/multiple-servers.ts | 15 +++++++------ server/tests/api/videos/resumable-upload.ts | 10 ++------- server/tests/api/videos/single-server.ts | 13 +++-------- server/tests/api/videos/video-captions.ts | 5 ++--- server/tests/api/videos/video-channels.ts | 7 +++--- server/tests/api/videos/video-comments.ts | 11 ++-------- .../tests/api/videos/video-create-transcoding.ts | 6 +++--- server/tests/api/videos/video-description.ts | 9 +++++++- server/tests/api/videos/video-files.ts | 9 +++++++- server/tests/api/videos/video-hls.ts | 11 +++++----- server/tests/api/videos/video-imports.ts | 8 +++---- .../tests/api/videos/video-playlist-thumbnails.ts | 6 +++--- server/tests/api/videos/video-playlists.ts | 23 ++++++++++---------- server/tests/api/videos/video-privacy.ts | 11 ++-------- server/tests/api/videos/video-schedule-update.ts | 4 ++-- server/tests/api/videos/video-transcoder.ts | 18 +++++----------- server/tests/api/videos/videos-history.ts | 6 +++--- server/tests/api/videos/videos-overview.ts | 3 ++- server/tests/api/videos/videos-views-cleaner.ts | 4 ++-- 90 files changed, 311 insertions(+), 392 deletions(-) (limited to 'server/tests/api') diff --git a/server/tests/api/activitypub/cleaner.ts b/server/tests/api/activitypub/cleaner.ts index c3368c7eb..7a443b553 100644 --- a/server/tests/api/activitypub/cleaner.ts +++ b/server/tests/api/activitypub/cleaner.ts @@ -2,13 +2,13 @@ import 'mocha' import * as chai from 'chai' +import { wait } from '@shared/core-utils' import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, - wait, waitJobs } from '@shared/server-commands' diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.ts index 93bf01842..cc71e82ea 100644 --- a/server/tests/api/activitypub/fetch.ts +++ b/server/tests/api/activitypub/fetch.ts @@ -2,7 +2,14 @@ import 'mocha' import * as chai from 'chai' -import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' +import { + cleanupTests, + createMultipleServers, + doubleFollow, + PeerTubeServer, + setAccessTokensToServers, + waitJobs +} from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/activitypub/helpers.ts b/server/tests/api/activitypub/helpers.ts index 5aa94af5d..25e1d9823 100644 --- a/server/tests/api/activitypub/helpers.ts +++ b/server/tests/api/activitypub/helpers.ts @@ -3,7 +3,8 @@ import 'mocha' import { expect } from 'chai' import { cloneDeep } from 'lodash' -import { buildAbsoluteFixturePath, buildRequestStub } from '@shared/server-commands' +import { buildRequestStub } from '@server/tests/shared' +import { buildAbsoluteFixturePath } from '@shared/core-utils' import { buildSignedActivity } from '../../../helpers/activitypub' import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto' diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.ts index 669a86fca..71e1c40ba 100644 --- a/server/tests/api/activitypub/refresher.ts +++ b/server/tests/api/activitypub/refresher.ts @@ -1,6 +1,8 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' +import { wait } from '@shared/core-utils' +import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' import { cleanupTests, createMultipleServers, @@ -9,10 +11,8 @@ import { PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel, - wait, waitJobs } from '@shared/server-commands' -import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' describe('Test AP refresher', function () { let servers: PeerTubeServer[] = [] diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts index 3b871ae12..c4cb5ea0d 100644 --- a/server/tests/api/activitypub/security.ts +++ b/server/tests/api/activitypub/security.ts @@ -6,9 +6,10 @@ import { activityPubContextify, buildSignedActivity } from '@server/helpers/acti import { buildDigest } from '@server/helpers/peertube-crypto' import { HTTP_SIGNATURE } from '@server/initializers/constants' import { buildGlobalHeaders } from '@server/lib/job-queue/handlers/utils/activitypub-http-utils' -import { buildAbsoluteFixturePath, cleanupTests, createMultipleServers, killallServers, PeerTubeServer, wait } from '@shared/server-commands' import { makeFollowRequest, makePOSTAPRequest } from '@server/tests/shared' +import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' import { HttpStatusCode } from '@shared/models' +import { cleanupTests, createMultipleServers, killallServers, PeerTubeServer } from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/check-params/abuses.ts b/server/tests/api/check-params/abuses.ts index 58167cbab..c4b051723 100644 --- a/server/tests/api/check-params/abuses.ts +++ b/server/tests/api/check-params/abuses.ts @@ -1,11 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' +import { AbuseCreate, AbuseState, HttpStatusCode } from '@shared/models' import { AbusesCommand, - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, cleanupTests, createSingleServer, doubleFollow, @@ -15,7 +14,6 @@ import { setAccessTokensToServers, waitJobs } from '@shared/server-commands' -import { AbuseCreate, AbuseState, HttpStatusCode } from '@shared/models' describe('Test abuses API validators', function () { const basePath = '/api/v1/abuses/' diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.ts index fc8e63ed4..07f879e0e 100644 --- a/server/tests/api/check-params/accounts.ts +++ b/server/tests/api/check-params/accounts.ts @@ -1,15 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, - cleanupTests, - createSingleServer, - PeerTubeServer -} from '@shared/server-commands' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' import { HttpStatusCode } from '@shared/models' +import { cleanupTests, createSingleServer, PeerTubeServer } from '@shared/server-commands' describe('Test accounts API validators', function () { const path = '/api/v1/accounts/' diff --git a/server/tests/api/check-params/blocklist.ts b/server/tests/api/check-params/blocklist.ts index 2dc3a166d..36526d494 100644 --- a/server/tests/api/check-params/blocklist.ts +++ b/server/tests/api/check-params/blocklist.ts @@ -1,10 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' +import { HttpStatusCode } from '@shared/models' import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, cleanupTests, createMultipleServers, doubleFollow, @@ -14,7 +13,6 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' -import { HttpStatusCode } from '@shared/models' describe('Test blocklist API validators', function () { let servers: PeerTubeServer[] diff --git a/server/tests/api/check-params/contact-form.ts b/server/tests/api/check-params/contact-form.ts index a2e51e14d..9db442b0b 100644 --- a/server/tests/api/check-params/contact-form.ts +++ b/server/tests/api/check-params/contact-form.ts @@ -1,15 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' +import { MockSmtpServer } from '@server/tests/shared' import { HttpStatusCode } from '@shared/models' -import { - cleanupTests, - ContactFormCommand, - createSingleServer, - killallServers, - MockSmtpServer, - PeerTubeServer -} from '@shared/server-commands' +import { cleanupTests, ContactFormCommand, createSingleServer, killallServers, PeerTubeServer } from '@shared/server-commands' describe('Test contact form API validators', function () { let server: PeerTubeServer diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts index 6121d2202..d4dae5a75 100644 --- a/server/tests/api/check-params/follows.ts +++ b/server/tests/api/check-params/follows.ts @@ -1,10 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' +import { HttpStatusCode } from '@shared/models' import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, cleanupTests, createSingleServer, makeDeleteRequest, @@ -13,7 +12,6 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' -import { HttpStatusCode } from '@shared/models' describe('Test server follows API validators', function () { let server: PeerTubeServer diff --git a/server/tests/api/check-params/jobs.ts b/server/tests/api/check-params/jobs.ts index b7c603755..d85961d62 100644 --- a/server/tests/api/check-params/jobs.ts +++ b/server/tests/api/check-params/jobs.ts @@ -1,17 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, - cleanupTests, - createSingleServer, - makeGetRequest, - PeerTubeServer, - setAccessTokensToServers -} from '@shared/server-commands' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' import { HttpStatusCode } from '@shared/models' +import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' describe('Test jobs API validators', function () { const path = '/api/v1/jobs/failed' diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts index 8b79d97e0..8aee6164c 100644 --- a/server/tests/api/check-params/live.ts +++ b/server/tests/api/check-params/live.ts @@ -2,8 +2,9 @@ import 'mocha' import { omit } from 'lodash' +import { buildAbsoluteFixturePath } from '@shared/core-utils' +import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' import { - buildAbsoluteFixturePath, cleanupTests, createSingleServer, LiveCommand, @@ -14,7 +15,6 @@ import { setAccessTokensToServers, stopFfmpeg } from '@shared/server-commands' -import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' describe('Test video lives API validator', function () { const path = '/api/v1/videos/live' diff --git a/server/tests/api/check-params/my-user.ts b/server/tests/api/check-params/my-user.ts index c8ac71476..95f2122ae 100644 --- a/server/tests/api/check-params/my-user.ts +++ b/server/tests/api/check-params/my-user.ts @@ -1,22 +1,19 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, MockSmtpServer } from '@server/tests/shared' +import { buildAbsoluteFixturePath } from '@shared/core-utils' +import { HttpStatusCode, UserRole, VideoCreateResult } from '@shared/models' import { - buildAbsoluteFixturePath, - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, cleanupTests, createSingleServer, makeGetRequest, makePutBodyRequest, makeUploadRequest, - MockSmtpServer, PeerTubeServer, setAccessTokensToServers, UsersCommand } from '@shared/server-commands' -import { HttpStatusCode, UserRole, VideoCreateResult } from '@shared/models' describe('Test my user API validators', function () { const path = '/api/v1/users/' diff --git a/server/tests/api/check-params/plugins.ts b/server/tests/api/check-params/plugins.ts index 79e487590..c3f15b86e 100644 --- a/server/tests/api/check-params/plugins.ts +++ b/server/tests/api/check-params/plugins.ts @@ -1,10 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' +import { HttpStatusCode, PeerTubePlugin, PluginType } from '@shared/models' import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, cleanupTests, createSingleServer, makeGetRequest, @@ -13,7 +12,6 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' -import { HttpStatusCode, PeerTubePlugin, PluginType } from '@shared/models' describe('Test server plugins API validators', function () { let server: PeerTubeServer diff --git a/server/tests/api/check-params/redundancy.ts b/server/tests/api/check-params/redundancy.ts index f3bfcb16c..04519cf23 100644 --- a/server/tests/api/check-params/redundancy.ts +++ b/server/tests/api/check-params/redundancy.ts @@ -1,10 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' +import { HttpStatusCode, VideoCreateResult } from '@shared/models' import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, cleanupTests, createMultipleServers, doubleFollow, @@ -16,7 +15,6 @@ import { setAccessTokensToServers, waitJobs } from '@shared/server-commands' -import { HttpStatusCode, VideoCreateResult } from '@shared/models' describe('Test server redundancy API validators', function () { let servers: PeerTubeServer[] diff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.ts index edeeed571..ca0fbf31d 100644 --- a/server/tests/api/check-params/search.ts +++ b/server/tests/api/check-params/search.ts @@ -1,17 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, - cleanupTests, - createSingleServer, - makeGetRequest, - PeerTubeServer, - setAccessTokensToServers -} from '@shared/server-commands' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' import { HttpStatusCode } from '@shared/models' +import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) { return server.config.updateCustomSubConfig({ diff --git a/server/tests/api/check-params/transcoding.ts b/server/tests/api/check-params/transcoding.ts index 11ade9071..333012940 100644 --- a/server/tests/api/check-params/transcoding.ts +++ b/server/tests/api/check-params/transcoding.ts @@ -1,8 +1,15 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' import { HttpStatusCode, UserRole } from '@shared/models' +import { + cleanupTests, + createMultipleServers, + doubleFollow, + PeerTubeServer, + setAccessTokensToServers, + waitJobs +} from '@shared/server-commands' describe('Test transcoding API validators', function () { let servers: PeerTubeServer[] diff --git a/server/tests/api/check-params/upload-quota.ts b/server/tests/api/check-params/upload-quota.ts index 02898bb87..deb4a7aa3 100644 --- a/server/tests/api/check-params/upload-quota.ts +++ b/server/tests/api/check-params/upload-quota.ts @@ -2,18 +2,18 @@ import 'mocha' import { expect } from 'chai' +import { FIXTURE_URLS } from '@server/tests/shared' import { randomInt } from '@shared/core-utils' +import { HttpStatusCode, VideoImportState, VideoPrivacy } from '@shared/models' import { cleanupTests, createSingleServer, - FIXTURE_URLS, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel, VideosCommand, waitJobs } from '@shared/server-commands' -import { HttpStatusCode, VideoImportState, VideoPrivacy } from '@shared/models' describe('Test upload quota', function () { let server: PeerTubeServer diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts index 912d4a992..4bc8084a1 100644 --- a/server/tests/api/check-params/user-notifications.ts +++ b/server/tests/api/check-params/user-notifications.ts @@ -2,20 +2,18 @@ import 'mocha' import { io } from 'socket.io-client' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' +import { wait } from '@shared/core-utils' +import { HttpStatusCode, UserNotificationSetting, UserNotificationSettingValue } from '@shared/models' import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, cleanupTests, createSingleServer, makeGetRequest, makePostBodyRequest, makePutBodyRequest, PeerTubeServer, - setAccessTokensToServers, - wait + setAccessTokensToServers } from '@shared/server-commands' -import { HttpStatusCode, UserNotificationSetting, UserNotificationSettingValue } from '@shared/models' describe('Test user notifications API validators', function () { let server: PeerTubeServer diff --git a/server/tests/api/check-params/user-subscriptions.ts b/server/tests/api/check-params/user-subscriptions.ts index 95226dff5..a13ed5aa3 100644 --- a/server/tests/api/check-params/user-subscriptions.ts +++ b/server/tests/api/check-params/user-subscriptions.ts @@ -2,9 +2,6 @@ import 'mocha' import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, cleanupTests, createSingleServer, makeDeleteRequest, @@ -15,6 +12,7 @@ import { waitJobs } from '@shared/server-commands' import { HttpStatusCode } from '@shared/models' +import { checkBadStartPagination, checkBadCountPagination, checkBadSortPagination } from '@server/tests/shared' describe('Test user subscriptions API validators', function () { const path = '/api/v1/users/me/subscriptions' diff --git a/server/tests/api/check-params/users-admin.ts b/server/tests/api/check-params/users-admin.ts index c98b5e189..d8353f83b 100644 --- a/server/tests/api/check-params/users-admin.ts +++ b/server/tests/api/check-params/users-admin.ts @@ -2,21 +2,18 @@ import 'mocha' import { omit } from 'lodash' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, MockSmtpServer } from '@server/tests/shared' +import { HttpStatusCode, UserAdminFlag, UserRole } from '@shared/models' import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, cleanupTests, createSingleServer, killallServers, makeGetRequest, makePostBodyRequest, makePutBodyRequest, - MockSmtpServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' -import { HttpStatusCode, UserAdminFlag, UserRole } from '@shared/models' describe('Test users admin API validators', function () { const path = '/api/v1/users/' diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index 254177afd..84254945c 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts @@ -2,15 +2,9 @@ import 'mocha' import { omit } from 'lodash' -import { - cleanupTests, - createSingleServer, - makePostBodyRequest, - MockSmtpServer, - PeerTubeServer, - setAccessTokensToServers -} from '@shared/server-commands' +import { MockSmtpServer } from '@server/tests/shared' import { HttpStatusCode, UserRole } from '@shared/models' +import { cleanupTests, createSingleServer, makePostBodyRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' describe('Test users API validators', function () { const path = '/api/v1/users/' diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts index 7eb3c1cae..1aab60826 100644 --- a/server/tests/api/check-params/video-blacklist.ts +++ b/server/tests/api/check-params/video-blacklist.ts @@ -2,11 +2,10 @@ import 'mocha' import { expect } from 'chai' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' +import { HttpStatusCode, VideoBlacklistType } from '@shared/models' import { BlacklistCommand, - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, cleanupTests, createMultipleServers, doubleFollow, @@ -16,7 +15,6 @@ import { setAccessTokensToServers, waitJobs } from '@shared/server-commands' -import { HttpStatusCode, VideoBlacklistType } from '@shared/models' describe('Test video blacklist API validators', function () { let servers: PeerTubeServer[] diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts index 34c1a9673..8a8840793 100644 --- a/server/tests/api/check-params/video-captions.ts +++ b/server/tests/api/check-params/video-captions.ts @@ -1,8 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' +import { buildAbsoluteFixturePath } from '@shared/core-utils' +import { HttpStatusCode, VideoCreateResult } from '@shared/models' import { - buildAbsoluteFixturePath, cleanupTests, createSingleServer, makeDeleteRequest, @@ -11,7 +12,6 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' -import { HttpStatusCode, VideoCreateResult } from '@shared/models' describe('Test video captions API validator', function () { 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 747a5d3ec..1e9732fe9 100644 --- a/server/tests/api/check-params/video-channels.ts +++ b/server/tests/api/check-params/video-channels.ts @@ -3,12 +3,11 @@ import 'mocha' import * as chai from 'chai' import { omit } from 'lodash' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' +import { buildAbsoluteFixturePath } from '@shared/core-utils' +import { HttpStatusCode, VideoChannelUpdate } from '@shared/models' import { - buildAbsoluteFixturePath, ChannelsCommand, - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, cleanupTests, createSingleServer, makeGetRequest, @@ -18,7 +17,6 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' -import { HttpStatusCode, VideoChannelUpdate } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts index 05cf61cba..63c3582e9 100644 --- a/server/tests/api/check-params/video-comments.ts +++ b/server/tests/api/check-params/video-comments.ts @@ -2,10 +2,9 @@ import 'mocha' import * as chai from 'chai' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' +import { HttpStatusCode, VideoCreateResult } from '@shared/models' import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, cleanupTests, createSingleServer, makeDeleteRequest, @@ -14,7 +13,6 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' -import { HttpStatusCode, VideoCreateResult } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/check-params/video-files.ts b/server/tests/api/check-params/video-files.ts index 90ab4460c..8c0795092 100644 --- a/server/tests/api/check-params/video-files.ts +++ b/server/tests/api/check-params/video-files.ts @@ -1,8 +1,15 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' import { HttpStatusCode, UserRole } from '@shared/models' +import { + cleanupTests, + createMultipleServers, + doubleFollow, + PeerTubeServer, + setAccessTokensToServers, + waitJobs +} from '@shared/server-commands' describe('Test videos files', function () { let servers: PeerTubeServer[] diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts index 7cefb2a54..ddea68db4 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts @@ -2,21 +2,18 @@ import 'mocha' import { omit } from 'lodash' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, FIXTURE_URLS } from '@server/tests/shared' +import { buildAbsoluteFixturePath } from '@shared/core-utils' +import { HttpStatusCode, VideoPrivacy } from '@shared/models' import { - buildAbsoluteFixturePath, - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, cleanupTests, createSingleServer, - FIXTURE_URLS, makeGetRequest, makePostBodyRequest, makeUploadRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' -import { HttpStatusCode, VideoPrivacy } from '@shared/models' describe('Test video imports API validator', function () { const path = '/api/v1/videos/imports' diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts index ac3c13f78..4b17ce7db 100644 --- a/server/tests/api/check-params/video-playlists.ts +++ b/server/tests/api/check-params/video-playlists.ts @@ -1,18 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, - cleanupTests, - createSingleServer, - makeGetRequest, - PeerTubeServer, - PlaylistsCommand, - setAccessTokensToServers, - setDefaultVideoChannel -} from '@shared/server-commands' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' import { HttpStatusCode, VideoPlaylistCreate, @@ -23,6 +12,15 @@ import { VideoPlaylistReorder, VideoPlaylistType } from '@shared/models' +import { + cleanupTests, + createSingleServer, + makeGetRequest, + PeerTubeServer, + PlaylistsCommand, + setAccessTokensToServers, + setDefaultVideoChannel +} from '@shared/server-commands' describe('Test video playlists API validator', function () { let server: PeerTubeServer diff --git a/server/tests/api/check-params/videos-history.ts b/server/tests/api/check-params/videos-history.ts index e4b4c4b2a..31a0752c7 100644 --- a/server/tests/api/check-params/videos-history.ts +++ b/server/tests/api/check-params/videos-history.ts @@ -1,9 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' +import { checkBadCountPagination, checkBadStartPagination } from '@server/tests/shared' +import { HttpStatusCode } from '@shared/models' import { - checkBadCountPagination, - checkBadStartPagination, cleanupTests, createSingleServer, makeGetRequest, @@ -12,7 +12,6 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' -import { HttpStatusCode } from '@shared/models' describe('Test videos history API validator', function () { const myHistoryPath = '/api/v1/users/me/history/videos' diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index 3b2607eed..4cc70f5cc 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts @@ -4,12 +4,10 @@ import 'mocha' import * as chai from 'chai' import { omit } from 'lodash' import { join } from 'path' -import { randomInt } from '@shared/core-utils' +import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, checkUploadVideoParam } from '@server/tests/shared' +import { randomInt, root } from '@shared/core-utils' +import { HttpStatusCode, PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@shared/models' import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination, - checkUploadVideoParam, cleanupTests, createSingleServer, makeDeleteRequest, @@ -17,10 +15,8 @@ import { makePutBodyRequest, makeUploadRequest, PeerTubeServer, - root, setAccessTokensToServers } from '@shared/server-commands' -import { HttpStatusCode, PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts index 89880c46b..909399836 100644 --- a/server/tests/api/live/live-constraints.ts +++ b/server/tests/api/live/live-constraints.ts @@ -2,9 +2,9 @@ import 'mocha' import * as chai from 'chai' +import { wait } from '@shared/core-utils' import { VideoPrivacy } from '@shared/models' import { - checkLiveCleanupAfterSave, cleanupTests, ConfigCommand, createMultipleServers, @@ -12,9 +12,9 @@ import { PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel, - wait, waitJobs -} from '../../../../shared/server-commands' +} from '@shared/server-commands' +import { checkLiveCleanupAfterSave } from '../../shared' const expect = chai.expect diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts index 12a4d64d8..c2392603b 100644 --- a/server/tests/api/live/live-permanent.ts +++ b/server/tests/api/live/live-permanent.ts @@ -2,6 +2,7 @@ import 'mocha' import * as chai from 'chai' +import { wait } from '@shared/core-utils' import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models' import { cleanupTests, @@ -12,9 +13,8 @@ import { setAccessTokensToServers, setDefaultVideoChannel, stopFfmpeg, - wait, waitJobs -} from '../../../../shared/server-commands' +} from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/live/live-rtmps.ts b/server/tests/api/live/live-rtmps.ts index 31e8f906e..935061971 100644 --- a/server/tests/api/live/live-rtmps.ts +++ b/server/tests/api/live/live-rtmps.ts @@ -2,9 +2,9 @@ import 'mocha' import * as chai from 'chai' +import { buildAbsoluteFixturePath } from '@shared/core-utils' import { VideoPrivacy } from '@shared/models' import { - buildAbsoluteFixturePath, cleanupTests, createSingleServer, PeerTubeServer, @@ -14,7 +14,7 @@ import { stopFfmpeg, testFfmpegStreamError, waitUntilLivePublishedOnAllServers -} from '../../../../shared/server-commands' +} from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts index 9fb6b4e54..95a342b01 100644 --- a/server/tests/api/live/live-save-replay.ts +++ b/server/tests/api/live/live-save-replay.ts @@ -3,8 +3,10 @@ import 'mocha' import * as chai from 'chai' import { FfmpegCommand } from 'fluent-ffmpeg' +import { checkLiveCleanupAfterSave } from '@server/tests/shared' +import { wait } from '@shared/core-utils' +import { HttpStatusCode, LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models' import { - checkLiveCleanupAfterSave, cleanupTests, ConfigCommand, createMultipleServers, @@ -14,12 +16,10 @@ import { setDefaultVideoChannel, stopFfmpeg, testFfmpegStreamError, - wait, waitJobs, waitUntilLivePublishedOnAllServers, waitUntilLiveSavedOnAllServers } from '@shared/server-commands' -import { HttpStatusCode, LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/live/live-socket-messages.ts b/server/tests/api/live/live-socket-messages.ts index 42cf9c5f6..50b16443e 100644 --- a/server/tests/api/live/live-socket-messages.ts +++ b/server/tests/api/live/live-socket-messages.ts @@ -2,6 +2,7 @@ import 'mocha' import * as chai from 'chai' +import { wait } from '@shared/core-utils' import { VideoPrivacy, VideoState } from '@shared/models' import { cleanupTests, @@ -11,10 +12,9 @@ import { setAccessTokensToServers, setDefaultVideoChannel, stopFfmpeg, - wait, waitJobs, waitUntilLivePublishedOnAllServers -} from '../../../../shared/server-commands' +} from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/live/live-views.ts b/server/tests/api/live/live-views.ts index 5de4436be..446d0913c 100644 --- a/server/tests/api/live/live-views.ts +++ b/server/tests/api/live/live-views.ts @@ -3,6 +3,7 @@ import 'mocha' import * as chai from 'chai' import { FfmpegCommand } from 'fluent-ffmpeg' +import { wait } from '@shared/core-utils' import { VideoPrivacy } from '@shared/models' import { cleanupTests, @@ -12,10 +13,9 @@ import { setAccessTokensToServers, setDefaultVideoChannel, stopFfmpeg, - wait, waitJobs, waitUntilLivePublishedOnAllServers -} from '../../../../shared/server-commands' +} from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index 3869fd6c7..3f9355d2d 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts @@ -4,10 +4,18 @@ import 'mocha' import * as chai from 'chai' import { basename, join } from 'path' import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils' +import { checkLiveCleanupAfterSave, checkLiveSegmentHash, checkResolutionsInMasterPlaylist, testImage } from '@server/tests/shared' +import { wait } from '@shared/core-utils' +import { + HttpStatusCode, + LiveVideo, + LiveVideoCreate, + VideoDetails, + VideoPrivacy, + VideoState, + VideoStreamingPlaylistType +} from '@shared/models' import { - checkLiveCleanupAfterSave, - checkLiveSegmentHash, - checkResolutionsInMasterPlaylist, cleanupTests, createMultipleServers, doubleFollow, @@ -20,20 +28,9 @@ import { setDefaultVideoChannel, stopFfmpeg, testFfmpegStreamError, - testImage, - wait, waitJobs, waitUntilLivePublishedOnAllServers } from '@shared/server-commands' -import { - HttpStatusCode, - LiveVideo, - LiveVideoCreate, - VideoDetails, - VideoPrivacy, - VideoState, - VideoStreamingPlaylistType -} from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/moderation/blocklist-notification.ts b/server/tests/api/moderation/blocklist-notification.ts index d1e2ea56e..87d147998 100644 --- a/server/tests/api/moderation/blocklist-notification.ts +++ b/server/tests/api/moderation/blocklist-notification.ts @@ -2,8 +2,15 @@ import 'mocha' import * as chai from 'chai' -import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' import { UserNotificationType } from '@shared/models' +import { + cleanupTests, + createMultipleServers, + doubleFollow, + PeerTubeServer, + setAccessTokensToServers, + waitJobs +} from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/moderation/video-blacklist.ts b/server/tests/api/moderation/video-blacklist.ts index 4e2887fa0..322e93815 100644 --- a/server/tests/api/moderation/video-blacklist.ts +++ b/server/tests/api/moderation/video-blacklist.ts @@ -3,18 +3,18 @@ import 'mocha' import * as chai from 'chai' import { orderBy } from 'lodash' +import { FIXTURE_URLS } from '@server/tests/shared' +import { UserAdminFlag, UserRole, VideoBlacklist, VideoBlacklistType } from '@shared/models' import { BlacklistCommand, cleanupTests, createMultipleServers, doubleFollow, - FIXTURE_URLS, killallServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' -import { UserAdminFlag, UserRole, VideoBlacklist, VideoBlacklistType } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/notifications/admin-notifications.ts b/server/tests/api/notifications/admin-notifications.ts index 18962a71e..f037e7aae 100644 --- a/server/tests/api/notifications/admin-notifications.ts +++ b/server/tests/api/notifications/admin-notifications.ts @@ -6,14 +6,13 @@ import { CheckerBaseParams, checkNewPeerTubeVersion, checkNewPluginVersion, - cleanupTests, MockJoinPeerTubeVersions, MockSmtpServer, - PeerTubeServer, - prepareNotificationsTest, - wait -} from '@shared/server-commands' + prepareNotificationsTest +} from '@server/tests/shared' +import { wait } from '@shared/core-utils' import { PluginType, UserNotification, UserNotificationType } from '@shared/models' +import { cleanupTests, PeerTubeServer } from '@shared/server-commands' describe('Test admin notifications', function () { let server: PeerTubeServer diff --git a/server/tests/api/notifications/comments-notifications.ts b/server/tests/api/notifications/comments-notifications.ts index 919be4bca..b82f1712a 100644 --- a/server/tests/api/notifications/comments-notifications.ts +++ b/server/tests/api/notifications/comments-notifications.ts @@ -6,13 +6,11 @@ import { checkCommentMention, CheckerBaseParams, checkNewCommentOnMyVideo, - cleanupTests, MockSmtpServer, - PeerTubeServer, - prepareNotificationsTest, - waitJobs -} from '@shared/server-commands' + prepareNotificationsTest +} from '@server/tests/shared' import { UserNotification } from '@shared/models' +import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts index 4da9d2684..e6e1d5f7b 100644 --- a/server/tests/api/notifications/moderation-notifications.ts +++ b/server/tests/api/notifications/moderation-notifications.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { buildUUID } from '@shared/core-utils/uuid' import { checkAbuseStateChange, checkAutoInstanceFollowing, @@ -16,15 +15,13 @@ import { checkUserRegistered, checkVideoAutoBlacklistForModerators, checkVideoIsPublished, - cleanupTests, MockInstancesIndex, MockSmtpServer, - PeerTubeServer, - prepareNotificationsTest, - wait, - waitJobs -} from '@shared/server-commands' + prepareNotificationsTest +} from '@server/tests/shared' +import { buildUUID, wait } from '@shared/core-utils' import { AbuseState, CustomConfig, UserNotification, UserRole, VideoPrivacy } from '@shared/models' +import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' describe('Test moderation notifications', function () { let servers: PeerTubeServer[] = [] diff --git a/server/tests/api/notifications/notifications-api.ts b/server/tests/api/notifications/notifications-api.ts index aeb73350b..ac08449f8 100644 --- a/server/tests/api/notifications/notifications-api.ts +++ b/server/tests/api/notifications/notifications-api.ts @@ -5,14 +5,12 @@ import * as chai from 'chai' import { CheckerBaseParams, checkNewVideoFromSubscription, - cleanupTests, getAllNotificationsSettings, MockSmtpServer, - PeerTubeServer, - prepareNotificationsTest, - waitJobs -} from '@shared/server-commands' + prepareNotificationsTest +} from '@server/tests/shared' import { UserNotification, UserNotificationSettingValue } from '@shared/models' +import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts index a2fcdf2ef..bb3024617 100644 --- a/server/tests/api/notifications/user-notifications.ts +++ b/server/tests/api/notifications/user-notifications.ts @@ -2,23 +2,20 @@ import 'mocha' import * as chai from 'chai' -import { buildUUID } from '@shared/core-utils/uuid' import { CheckerBaseParams, checkMyVideoImportIsFinished, checkNewActorFollow, checkNewVideoFromSubscription, checkVideoIsPublished, - cleanupTests, FIXTURE_URLS, MockSmtpServer, - PeerTubeServer, prepareNotificationsTest, - uploadRandomVideoOnServers, - wait, - waitJobs -} from '@shared/server-commands' + uploadRandomVideoOnServers +} from '@server/tests/shared' +import { buildUUID, wait } from '@shared/core-utils' import { UserNotification, UserNotificationType, VideoPrivacy } from '@shared/models' +import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/object-storage/live.ts b/server/tests/api/object-storage/live.ts index 2c341c139..0cb0a6e34 100644 --- a/server/tests/api/object-storage/live.ts +++ b/server/tests/api/object-storage/live.ts @@ -3,11 +3,12 @@ import 'mocha' import * as chai from 'chai' import { FfmpegCommand } from 'fluent-ffmpeg' +import { expectStartWith } from '@server/tests/shared' +import { areObjectStorageTestsDisabled } from '@shared/core-utils' +import { HttpStatusCode, LiveVideoCreate, VideoFile, VideoPrivacy } from '@shared/models' import { - areObjectStorageTestsDisabled, createMultipleServers, doubleFollow, - expectStartWith, killallServers, makeRawRequest, ObjectStorageCommand, @@ -19,7 +20,6 @@ import { waitUntilLivePublishedOnAllServers, waitUntilLiveSavedOnAllServers } from '@shared/server-commands' -import { HttpStatusCode, LiveVideoCreate, VideoFile, VideoPrivacy } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/object-storage/video-imports.ts b/server/tests/api/object-storage/video-imports.ts index adca16e8f..fb81832af 100644 --- a/server/tests/api/object-storage/video-imports.ts +++ b/server/tests/api/object-storage/video-imports.ts @@ -2,11 +2,11 @@ import 'mocha' import * as chai from 'chai' +import { expectStartWith, FIXTURE_URLS } from '@server/tests/shared' +import { areObjectStorageTestsDisabled } from '@shared/core-utils' +import { HttpStatusCode, VideoPrivacy } from '@shared/models' import { - areObjectStorageTestsDisabled, createSingleServer, - expectStartWith, - FIXTURE_URLS, killallServers, makeRawRequest, ObjectStorageCommand, @@ -15,7 +15,6 @@ import { setDefaultVideoChannel, waitJobs } from '@shared/server-commands' -import { HttpStatusCode, VideoPrivacy } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/object-storage/videos.ts b/server/tests/api/object-storage/videos.ts index bf469015f..498efcb17 100644 --- a/server/tests/api/object-storage/videos.ts +++ b/server/tests/api/object-storage/videos.ts @@ -3,25 +3,22 @@ import 'mocha' import * as chai from 'chai' import { merge } from 'lodash' +import { checkTmpIsEmpty, expectLogDoesNotContain, expectStartWith, MockObjectStorage } from '@server/tests/shared' +import { areObjectStorageTestsDisabled } from '@shared/core-utils' +import { HttpStatusCode, VideoDetails } from '@shared/models' import { - areObjectStorageTestsDisabled, - checkTmpIsEmpty, cleanupTests, createMultipleServers, createSingleServer, doubleFollow, - expectLogDoesNotContain, - expectStartWith, killallServers, makeRawRequest, - MockObjectStorage, ObjectStorageCommand, PeerTubeServer, setAccessTokensToServers, waitJobs, webtorrentAdd } from '@shared/server-commands' -import { HttpStatusCode, VideoDetails } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/redundancy/redundancy-constraints.ts b/server/tests/api/redundancy/redundancy-constraints.ts index 1a8d8183b..17c6b25a5 100644 --- a/server/tests/api/redundancy/redundancy-constraints.ts +++ b/server/tests/api/redundancy/redundancy-constraints.ts @@ -2,8 +2,15 @@ import 'mocha' import { expect } from 'chai' -import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' import { VideoPrivacy } from '@shared/models' +import { + cleanupTests, + createSingleServer, + killallServers, + PeerTubeServer, + setAccessTokensToServers, + waitJobs +} from '@shared/server-commands' describe('Test redundancy constraints', function () { let remoteServer: PeerTubeServer diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts index 556cfbc31..3f2286278 100644 --- a/server/tests/api/redundancy/redundancy.ts +++ b/server/tests/api/redundancy/redundancy.ts @@ -5,29 +5,26 @@ import * as chai from 'chai' import { readdir } from 'fs-extra' import magnetUtil from 'magnet-uri' import { basename, join } from 'path' +import { checkSegmentHash, checkVideoFilesWereRemoved, saveVideoInServers } from '@server/tests/shared' +import { root, wait } from '@shared/core-utils' +import { + HttpStatusCode, + VideoDetails, + VideoFile, + VideoPrivacy, + VideoRedundancyStrategy, + VideoRedundancyStrategyWithManual +} from '@shared/models' import { - checkSegmentHash, - checkVideoFilesWereRemoved, cleanupTests, createMultipleServers, doubleFollow, killallServers, makeRawRequest, PeerTubeServer, - root, - saveVideoInServers, setAccessTokensToServers, - wait, waitJobs } from '@shared/server-commands' -import { - HttpStatusCode, - VideoDetails, - VideoFile, - VideoPrivacy, - VideoRedundancyStrategy, - VideoRedundancyStrategyWithManual -} from '@shared/models' const 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 1f29f840a..2e0abc6ba 100644 --- a/server/tests/api/search/search-activitypub-video-channels.ts +++ b/server/tests/api/search/search-activitypub-video-channels.ts @@ -2,16 +2,16 @@ import 'mocha' import * as chai from 'chai' +import { wait } from '@shared/core-utils' +import { VideoChannel } from '@shared/models' import { cleanupTests, createMultipleServers, PeerTubeServer, SearchCommand, setAccessTokensToServers, - wait, waitJobs } from '@shared/server-commands' -import { VideoChannel } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/search/search-activitypub-video-playlists.ts b/server/tests/api/search/search-activitypub-video-playlists.ts index 550af8ed2..d9243ac53 100644 --- a/server/tests/api/search/search-activitypub-video-playlists.ts +++ b/server/tests/api/search/search-activitypub-video-playlists.ts @@ -2,6 +2,8 @@ import 'mocha' import * as chai from 'chai' +import { wait } from '@shared/core-utils' +import { VideoPlaylistPrivacy } from '@shared/models' import { cleanupTests, createMultipleServers, @@ -9,10 +11,8 @@ import { SearchCommand, setAccessTokensToServers, setDefaultVideoChannel, - wait, waitJobs } from '@shared/server-commands' -import { VideoPlaylistPrivacy } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts index 5aa3738c9..60b95ae4c 100644 --- a/server/tests/api/search/search-activitypub-videos.ts +++ b/server/tests/api/search/search-activitypub-videos.ts @@ -2,16 +2,16 @@ import 'mocha' import * as chai from 'chai' +import { wait } from '@shared/core-utils' +import { VideoPrivacy } from '@shared/models' import { cleanupTests, createMultipleServers, PeerTubeServer, SearchCommand, setAccessTokensToServers, - wait, waitJobs } from '@shared/server-commands' -import { VideoPrivacy } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts index bf2375ffa..c544705d3 100644 --- a/server/tests/api/search/search-videos.ts +++ b/server/tests/api/search/search-videos.ts @@ -10,10 +10,10 @@ import { SearchCommand, setAccessTokensToServers, setDefaultVideoChannel, - stopFfmpeg, - wait + stopFfmpeg } from '@shared/server-commands' import { VideoPrivacy } from '@shared/models' +import { wait } from '@shared/core-utils' const expect = chai.expect diff --git a/server/tests/api/server/auto-follows.ts b/server/tests/api/server/auto-follows.ts index 74bb96040..6d2333a6b 100644 --- a/server/tests/api/server/auto-follows.ts +++ b/server/tests/api/server/auto-follows.ts @@ -2,15 +2,9 @@ import 'mocha' import * as chai from 'chai' -import { - cleanupTests, - createMultipleServers, - MockInstancesIndex, - PeerTubeServer, - setAccessTokensToServers, - wait, - waitJobs -} from '@shared/server-commands' +import { MockInstancesIndex } from '@server/tests/shared' +import { wait } from '@shared/core-utils' +import { cleanupTests, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/server/config-defaults.ts b/server/tests/api/server/config-defaults.ts index 4ceda7de3..3ff09bf7e 100644 --- a/server/tests/api/server/config-defaults.ts +++ b/server/tests/api/server/config-defaults.ts @@ -2,15 +2,9 @@ import 'mocha' import * as chai from 'chai' -import { - cleanupTests, - createSingleServer, - FIXTURE_URLS, - PeerTubeServer, - setAccessTokensToServers, - setDefaultVideoChannel -} from '@shared/server-commands' +import { FIXTURE_URLS } from '@server/tests/shared' import { VideoDetails, VideoPrivacy } from '@shared/models' +import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index 2e6617a15..2356f701c 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts @@ -2,16 +2,16 @@ import 'mocha' import * as chai from 'chai' +import { parallelTests } from '@shared/core-utils' +import { CustomConfig, HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, killallServers, makeGetRequest, - parallelTests, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' -import { CustomConfig, HttpStatusCode } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.ts index 109251453..f3facb04a 100644 --- a/server/tests/api/server/contact-form.ts +++ b/server/tests/api/server/contact-form.ts @@ -2,17 +2,17 @@ import 'mocha' import * as chai from 'chai' +import { MockSmtpServer } from '@server/tests/shared' +import { wait } from '@shared/core-utils' +import { HttpStatusCode } from '@shared/models' import { cleanupTests, ContactFormCommand, createSingleServer, - MockSmtpServer, PeerTubeServer, setAccessTokensToServers, - wait, waitJobs } from '@shared/server-commands' -import { HttpStatusCode } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts index 6fa6053cb..20b5e378c 100644 --- a/server/tests/api/server/email.ts +++ b/server/tests/api/server/email.ts @@ -2,8 +2,9 @@ import 'mocha' import * as chai from 'chai' -import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' +import { MockSmtpServer } from '@server/tests/shared' import { HttpStatusCode } from '@shared/models' +import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index e128c36a5..cd34df15d 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts @@ -2,19 +2,9 @@ import 'mocha' import * as chai from 'chai' -import { - cleanupTests, - createMultipleServers, - dateIsValid, - expectAccountFollows, - expectChannelsFollows, - PeerTubeServer, - setAccessTokensToServers, - testCaptionFile, - waitJobs -} from '@shared/server-commands' +import { completeVideoCheck, dateIsValid, expectAccountFollows, expectChannelsFollows, testCaptionFile } from '@server/tests/shared' import { VideoCreateResult, VideoPrivacy } from '@shared/models' -import { completeVideoCheck } from '@server/tests/shared/video' +import { cleanupTests, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index b134e074b..7c3836681 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts @@ -2,6 +2,9 @@ import 'mocha' import * as chai from 'chai' +import { completeVideoCheck } from '@server/tests/shared' +import { wait } from '@shared/core-utils' +import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models' import { cleanupTests, CommentsCommand, @@ -9,11 +12,8 @@ import { killallServers, PeerTubeServer, setAccessTokensToServers, - wait, waitJobs } from '@shared/server-commands' -import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models' -import { completeVideoCheck } from '@server/tests/shared/video' const expect = chai.expect diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts index 5b38f6741..4294e1fd5 100644 --- a/server/tests/api/server/jobs.ts +++ b/server/tests/api/server/jobs.ts @@ -2,10 +2,10 @@ import 'mocha' import * as chai from 'chai' +import { dateIsValid } from '@server/tests/shared' import { cleanupTests, createMultipleServers, - dateIsValid, doubleFollow, PeerTubeServer, setAccessTokensToServers, diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts index fbcd89101..e82096c48 100644 --- a/server/tests/api/server/plugins.ts +++ b/server/tests/api/server/plugins.ts @@ -2,17 +2,17 @@ import 'mocha' import * as chai from 'chai' +import { testHelloWorldRegisteredSettings } from '@server/tests/shared' +import { wait } from '@shared/core-utils' +import { HttpStatusCode, PluginType } from '@shared/models' import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, PluginsCommand, - setAccessTokensToServers, - testHelloWorldRegisteredSettings, - wait + setAccessTokensToServers } from '@shared/server-commands' -import { HttpStatusCode, PluginType } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/server/proxy.ts b/server/tests/api/server/proxy.ts index 626a0d860..c40a4f9b8 100644 --- a/server/tests/api/server/proxy.ts +++ b/server/tests/api/server/proxy.ts @@ -2,18 +2,17 @@ import 'mocha' import * as chai from 'chai' +import { FIXTURE_URLS, MockProxy } from '@server/tests/shared' +import { HttpStatusCode, VideoPrivacy } from '@shared/models' import { cleanupTests, createMultipleServers, doubleFollow, - FIXTURE_URLS, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel, waitJobs } from '@shared/server-commands' -import { MockProxy } from '@shared/server-commands/mock-servers/mock-proxy' -import { HttpStatusCode, VideoPrivacy } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/server/reverse-proxy.ts b/server/tests/api/server/reverse-proxy.ts index fc9b88a6a..968d98e96 100644 --- a/server/tests/api/server/reverse-proxy.ts +++ b/server/tests/api/server/reverse-proxy.ts @@ -1,8 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import { expect } from 'chai' -import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/server-commands' +import { wait } from '@shared/core-utils' import { HttpStatusCode } from '@shared/models' +import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' describe('Test application behind a reverse proxy', function () { let server: PeerTubeServer diff --git a/server/tests/api/server/slow-follows.ts b/server/tests/api/server/slow-follows.ts index 5f24c351b..666a7c2e6 100644 --- a/server/tests/api/server/slow-follows.ts +++ b/server/tests/api/server/slow-follows.ts @@ -2,8 +2,15 @@ import 'mocha' import * as chai from 'chai' -import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' import { Job } from '@shared/models' +import { + cleanupTests, + createMultipleServers, + doubleFollow, + PeerTubeServer, + setAccessTokensToServers, + waitJobs +} from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.ts index 65ef4607b..f0334532b 100644 --- a/server/tests/api/server/stats.ts +++ b/server/tests/api/server/stats.ts @@ -2,16 +2,16 @@ import 'mocha' import * as chai from 'chai' +import { wait } from '@shared/core-utils' +import { ActivityType, VideoPlaylistPrivacy } from '@shared/models' import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, - wait, waitJobs } from '@shared/server-commands' -import { ActivityType, VideoPlaylistPrivacy } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts index e6699a059..5b2bbc520 100644 --- a/server/tests/api/users/users-multiple-servers.ts +++ b/server/tests/api/users/users-multiple-servers.ts @@ -6,16 +6,18 @@ import { checkActorFilesWereRemoved, checkTmpIsEmpty, checkVideoFilesWereRemoved, + saveVideoInServers, + testImage +} from '@server/tests/shared' +import { MyUser } from '@shared/models' +import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, - saveVideoInServers, setAccessTokensToServers, - testImage, waitJobs } from '@shared/server-commands' -import { MyUser } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts index 9b23ba797..0f3cc401a 100644 --- a/server/tests/api/users/users-verification.ts +++ b/server/tests/api/users/users-verification.ts @@ -2,8 +2,9 @@ import 'mocha' import * as chai from 'chai' -import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' +import { MockSmtpServer } from '@server/tests/shared' import { HttpStatusCode } from '@shared/models' +import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index fc44a6acd..ff9172a82 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts @@ -2,6 +2,8 @@ import 'mocha' import * as chai from 'chai' +import { testImage } from '@server/tests/shared' +import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models' import { cleanupTests, createSingleServer, @@ -9,10 +11,8 @@ import { makePutBodyRequest, PeerTubeServer, setAccessTokensToServers, - testImage, waitJobs } from '@shared/server-commands' -import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/videos/audio-only.ts b/server/tests/api/videos/audio-only.ts index 4b27f2fbe..e58360ffe 100644 --- a/server/tests/api/videos/audio-only.ts +++ b/server/tests/api/videos/audio-only.ts @@ -3,7 +3,14 @@ import 'mocha' import * as chai from 'chai' import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' -import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' +import { + cleanupTests, + createMultipleServers, + doubleFollow, + PeerTubeServer, + setAccessTokensToServers, + waitJobs +} from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index cb83fa0f0..9fa03f1a9 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts @@ -4,23 +4,24 @@ import 'mocha' import * as chai from 'chai' import request from 'supertest' import { - buildAbsoluteFixturePath, checkTmpIsEmpty, checkVideoFilesWereRemoved, + completeVideoCheck, + dateIsValid, + saveVideoInServers, + testImage +} from '@server/tests/shared' +import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' +import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@shared/models' +import { cleanupTests, createMultipleServers, - dateIsValid, doubleFollow, PeerTubeServer, - saveVideoInServers, setAccessTokensToServers, - testImage, - wait, waitJobs, webtorrentAdd } from '@shared/server-commands' -import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@shared/models' -import { completeVideoCheck } from '@server/tests/shared/video' const expect = chai.expect diff --git a/server/tests/api/videos/resumable-upload.ts b/server/tests/api/videos/resumable-upload.ts index 0842817dc..d6f4da630 100644 --- a/server/tests/api/videos/resumable-upload.ts +++ b/server/tests/api/videos/resumable-upload.ts @@ -4,15 +4,9 @@ import 'mocha' import * as chai from 'chai' import { pathExists, readdir, stat } from 'fs-extra' import { join } from 'path' -import { - buildAbsoluteFixturePath, - cleanupTests, - createSingleServer, - PeerTubeServer, - setAccessTokensToServers, - setDefaultVideoChannel -} from '@shared/server-commands' +import { buildAbsoluteFixturePath } from '@shared/core-utils' import { HttpStatusCode, VideoPrivacy } from '@shared/models' +import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index e5e12dd19..28bf018c5 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts @@ -2,17 +2,10 @@ import 'mocha' import * as chai from 'chai' -import { - checkVideoFilesWereRemoved, - cleanupTests, - createSingleServer, - PeerTubeServer, - setAccessTokensToServers, - testImage, - wait -} from '@shared/server-commands' +import { checkVideoFilesWereRemoved, completeVideoCheck, testImage } from '@server/tests/shared' +import { wait } from '@shared/core-utils' import { Video, VideoPrivacy } from '@shared/models' -import { completeVideoCheck } from '@server/tests/shared/video' +import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts index 9f00312aa..b7f26c35f 100644 --- a/server/tests/api/videos/video-captions.ts +++ b/server/tests/api/videos/video-captions.ts @@ -2,15 +2,14 @@ import 'mocha' import * as chai from 'chai' +import { checkVideoFilesWereRemoved, testCaptionFile } from '@server/tests/shared' +import { wait } from '@shared/core-utils' import { - checkVideoFilesWereRemoved, cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, - testCaptionFile, - wait, waitJobs } from '@shared/server-commands' diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index 2ac577a59..d435f3682 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts @@ -4,6 +4,9 @@ import 'mocha' import * as chai from 'chai' import { basename } from 'path' import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants' +import { testFileExistsOrNot, testImage } from '@server/tests/shared' +import { wait } from '@shared/core-utils' +import { User, VideoChannel } from '@shared/models' import { cleanupTests, createMultipleServers, @@ -11,12 +14,8 @@ import { PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel, - testFileExistsOrNot, - testImage, - wait, waitJobs } from '@shared/server-commands' -import { User, VideoChannel } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts index bb4f92a9b..2ae523970 100644 --- a/server/tests/api/videos/video-comments.ts +++ b/server/tests/api/videos/video-comments.ts @@ -2,15 +2,8 @@ import 'mocha' import * as chai from 'chai' -import { - cleanupTests, - CommentsCommand, - createSingleServer, - dateIsValid, - PeerTubeServer, - setAccessTokensToServers, - testImage -} from '@shared/server-commands' +import { dateIsValid, testImage } from '@server/tests/shared' +import { cleanupTests, CommentsCommand, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/videos/video-create-transcoding.ts b/server/tests/api/videos/video-create-transcoding.ts index e81f54714..62a6bab0d 100644 --- a/server/tests/api/videos/video-create-transcoding.ts +++ b/server/tests/api/videos/video-create-transcoding.ts @@ -2,20 +2,20 @@ import 'mocha' import * as chai from 'chai' +import { expectStartWith } from '@server/tests/shared' +import { areObjectStorageTestsDisabled } from '@shared/core-utils' +import { HttpStatusCode, VideoDetails } from '@shared/models' import { - areObjectStorageTestsDisabled, cleanupTests, createMultipleServers, doubleFollow, expectNoFailedTranscodingJob, - expectStartWith, makeRawRequest, ObjectStorageCommand, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' -import { HttpStatusCode, VideoDetails } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.ts index 23c55f728..20b20488f 100644 --- a/server/tests/api/videos/video-description.ts +++ b/server/tests/api/videos/video-description.ts @@ -2,7 +2,14 @@ import 'mocha' import * as chai from 'chai' -import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' +import { + cleanupTests, + createMultipleServers, + doubleFollow, + PeerTubeServer, + setAccessTokensToServers, + waitJobs +} from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/videos/video-files.ts b/server/tests/api/videos/video-files.ts index 0b5121740..b0ef4a2e9 100644 --- a/server/tests/api/videos/video-files.ts +++ b/server/tests/api/videos/video-files.ts @@ -2,7 +2,14 @@ import 'mocha' import { expect } from 'chai' -import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' +import { + cleanupTests, + createMultipleServers, + doubleFollow, + PeerTubeServer, + setAccessTokensToServers, + waitJobs +} from '@shared/server-commands' describe('Test videos files', function () { let servers: PeerTubeServer[] diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts index d050a7a7e..218ec08ae 100644 --- a/server/tests/api/videos/video-hls.ts +++ b/server/tests/api/videos/video-hls.ts @@ -3,18 +3,20 @@ import 'mocha' import * as chai from 'chai' import { basename, join } from 'path' -import { removeFragmentedMP4Ext, uuidRegex } from '@shared/core-utils' import { - areObjectStorageTestsDisabled, checkDirectoryIsEmpty, checkResolutionsInMasterPlaylist, checkSegmentHash, checkTmpIsEmpty, + expectStartWith, + hlsInfohashExist +} from '@server/tests/shared' +import { areObjectStorageTestsDisabled, removeFragmentedMP4Ext, uuidRegex } from '@shared/core-utils' +import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models' +import { cleanupTests, createMultipleServers, doubleFollow, - expectStartWith, - hlsInfohashExist, makeRawRequest, ObjectStorageCommand, PeerTubeServer, @@ -22,7 +24,6 @@ import { waitJobs, webtorrentAdd } from '@shared/server-commands' -import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models' import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants' const expect = chai.expect diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts index 2518743f7..e8e0f01f1 100644 --- a/server/tests/api/videos/video-imports.ts +++ b/server/tests/api/videos/video-imports.ts @@ -4,21 +4,19 @@ import 'mocha' import { expect } from 'chai' import { pathExists, readdir, remove } from 'fs-extra' import { join } from 'path' +import { FIXTURE_URLS, testCaptionFile, testImage } from '@server/tests/shared' +import { areHttpImportTestsDisabled } from '@shared/core-utils' +import { VideoPrivacy, VideoResolution } from '@shared/models' import { - areHttpImportTestsDisabled, cleanupTests, createMultipleServers, createSingleServer, doubleFollow, - FIXTURE_URLS, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel, - testCaptionFile, - testImage, waitJobs } from '@shared/server-commands' -import { VideoPrivacy, VideoResolution } from '@shared/models' async function checkVideosServer1 (server: PeerTubeServer, idHttp: string, idMagnet: string, idTorrent: string) { const videoHttp = await server.videos.get({ id: idHttp }) diff --git a/server/tests/api/videos/video-playlist-thumbnails.ts b/server/tests/api/videos/video-playlist-thumbnails.ts index e6b6c34eb..5fdb0fc03 100644 --- a/server/tests/api/videos/video-playlist-thumbnails.ts +++ b/server/tests/api/videos/video-playlist-thumbnails.ts @@ -2,6 +2,8 @@ import 'mocha' import * as chai from 'chai' +import { testImage } from '@server/tests/shared' +import { VideoPlaylistPrivacy } from '@shared/models' import { cleanupTests, createMultipleServers, @@ -9,10 +11,8 @@ import { PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel, - testImage, waitJobs -} from '../../../../shared/server-commands' -import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model' +} from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index 6279f5cd0..34327334f 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts @@ -2,8 +2,18 @@ import 'mocha' import * as chai from 'chai' +import { checkPlaylistFilesWereRemoved, testImage } from '@server/tests/shared' +import { wait } from '@shared/core-utils' +import { + HttpStatusCode, + VideoPlaylist, + VideoPlaylistCreateResult, + VideoPlaylistElementType, + VideoPlaylistPrivacy, + VideoPlaylistType, + VideoPrivacy +} from '@shared/models' import { - checkPlaylistFilesWereRemoved, cleanupTests, createMultipleServers, doubleFollow, @@ -11,19 +21,8 @@ import { PlaylistsCommand, setAccessTokensToServers, setDefaultVideoChannel, - testImage, - wait, waitJobs } from '@shared/server-commands' -import { - HttpStatusCode, - VideoPlaylist, - VideoPlaylistCreateResult, - VideoPlaylistElementType, - VideoPlaylistPrivacy, - VideoPlaylistType, - VideoPrivacy -} from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts index 13eb941ea..3051a443d 100644 --- a/server/tests/api/videos/video-privacy.ts +++ b/server/tests/api/videos/video-privacy.ts @@ -2,16 +2,9 @@ import 'mocha' import * as chai from 'chai' -import { - cleanupTests, - createSingleServer, - doubleFollow, - PeerTubeServer, - setAccessTokensToServers, - wait, - waitJobs -} from '@shared/server-commands' +import { wait } from '@shared/core-utils' import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' +import { cleanupTests, createSingleServer, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts index 9408574ad..00b4f6cbc 100644 --- a/server/tests/api/videos/video-schedule-update.ts +++ b/server/tests/api/videos/video-schedule-update.ts @@ -2,16 +2,16 @@ import 'mocha' import * as chai from 'chai' +import { wait } from '@shared/core-utils' +import { VideoPrivacy } from '@shared/models' import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, - wait, waitJobs } from '@shared/server-commands' -import { VideoPrivacy } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts index f4b0bc53a..d24a8f4e1 100644 --- a/server/tests/api/videos/video-transcoder.ts +++ b/server/tests/api/videos/video-transcoder.ts @@ -3,29 +3,21 @@ import 'mocha' import * as chai from 'chai' import { omit } from 'lodash' -import { getMaxBitrate, getMinLimitBitrate } from '@shared/core-utils' +import { canDoQuickTranscode } from '@server/helpers/ffprobe-utils' +import { generateHighBitrateVideo, generateVideoWithFramerate } from '@server/tests/shared' +import { buildAbsoluteFixturePath, getMaxBitrate, getMinLimitBitrate } from '@shared/core-utils' +import { getAudioStream, getMetadataFromFile, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '@shared/extra-utils' +import { HttpStatusCode, VideoState } from '@shared/models' import { - buildAbsoluteFixturePath, cleanupTests, createMultipleServers, doubleFollow, - generateHighBitrateVideo, - generateVideoWithFramerate, makeGetRequest, PeerTubeServer, setAccessTokensToServers, waitJobs, webtorrentAdd } from '@shared/server-commands' -import { HttpStatusCode, VideoState } from '@shared/models' -import { - canDoQuickTranscode, - getAudioStream, - getMetadataFromFile, - getVideoFileBitrate, - getVideoFileFPS, - getVideoFileResolution -} from '../../../helpers/ffprobe-utils' const expect = chai.expect diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts index 813fc4f45..4e5ba13aa 100644 --- a/server/tests/api/videos/videos-history.ts +++ b/server/tests/api/videos/videos-history.ts @@ -2,16 +2,16 @@ import 'mocha' import * as chai from 'chai' +import { wait } from '@shared/core-utils' +import { HttpStatusCode, Video } from '@shared/models' import { cleanupTests, createSingleServer, HistoryCommand, killallServers, PeerTubeServer, - setAccessTokensToServers, - wait + setAccessTokensToServers } from '@shared/server-commands' -import { HttpStatusCode, Video } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/videos/videos-overview.ts b/server/tests/api/videos/videos-overview.ts index 08a4efb63..61fc0cb20 100644 --- a/server/tests/api/videos/videos-overview.ts +++ b/server/tests/api/videos/videos-overview.ts @@ -2,8 +2,9 @@ import 'mocha' import * as chai from 'chai' -import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/server-commands' +import { wait } from '@shared/core-utils' import { VideosOverview } from '@shared/models' +import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' const expect = chai.expect diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts index 7f7597af4..e6815a4a8 100644 --- a/server/tests/api/videos/videos-views-cleaner.ts +++ b/server/tests/api/videos/videos-views-cleaner.ts @@ -2,6 +2,7 @@ import 'mocha' import * as chai from 'chai' +import { wait } from '@shared/core-utils' import { cleanupTests, createMultipleServers, @@ -9,9 +10,8 @@ import { killallServers, PeerTubeServer, setAccessTokensToServers, - wait, waitJobs -} from '../../../../shared/server-commands' +} from '@shared/server-commands' const expect = chai.expect -- cgit v1.2.3