]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Move test functions outside extra-utils
authorChocobozzz <me@florianbigard.com>
Fri, 17 Dec 2021 10:58:15 +0000 (11:58 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 17 Dec 2021 11:24:03 +0000 (12:24 +0100)
202 files changed:
server/controllers/api/users/token.ts
server/controllers/api/video-playlist.ts
server/controllers/api/videos/live.ts
server/controllers/api/videos/upload.ts
server/helpers/custom-validators/misc.ts
server/helpers/image-utils.ts
server/helpers/peertube-crypto.ts
server/helpers/utils.ts
server/helpers/webtorrent.ts
server/initializers/constants.ts
server/initializers/migrations/0080-video-channels.ts
server/initializers/migrations/0345-video-playlists.ts
server/initializers/migrations/0560-user-feed-token.ts
server/lib/activitypub/actors/shared/object-to-model-attributes.ts
server/lib/auth/oauth.ts
server/lib/client-html.ts
server/lib/hls.ts
server/lib/local-actor.ts
server/lib/paths.ts
server/lib/user.ts
server/lib/video-path-manager.ts
server/models/user/user-notification.ts
server/models/video/formatter/video-format-utils.ts
server/models/video/video-caption.ts
server/models/video/video-playlist.ts
server/models/video/video-streaming-playlist.ts
server/models/video/video.ts
server/tests/api/activitypub/cleaner.ts
server/tests/api/activitypub/fetch.ts
server/tests/api/activitypub/helpers.ts
server/tests/api/activitypub/refresher.ts
server/tests/api/activitypub/security.ts
server/tests/api/check-params/abuses.ts
server/tests/api/check-params/accounts.ts
server/tests/api/check-params/blocklist.ts
server/tests/api/check-params/contact-form.ts
server/tests/api/check-params/follows.ts
server/tests/api/check-params/jobs.ts
server/tests/api/check-params/live.ts
server/tests/api/check-params/my-user.ts
server/tests/api/check-params/plugins.ts
server/tests/api/check-params/redundancy.ts
server/tests/api/check-params/search.ts
server/tests/api/check-params/transcoding.ts
server/tests/api/check-params/upload-quota.ts
server/tests/api/check-params/user-notifications.ts
server/tests/api/check-params/user-subscriptions.ts
server/tests/api/check-params/users-admin.ts
server/tests/api/check-params/users.ts
server/tests/api/check-params/video-blacklist.ts
server/tests/api/check-params/video-captions.ts
server/tests/api/check-params/video-channels.ts
server/tests/api/check-params/video-comments.ts
server/tests/api/check-params/video-files.ts
server/tests/api/check-params/video-imports.ts
server/tests/api/check-params/video-playlists.ts
server/tests/api/check-params/videos-history.ts
server/tests/api/check-params/videos.ts
server/tests/api/live/live-constraints.ts
server/tests/api/live/live-permanent.ts
server/tests/api/live/live-rtmps.ts
server/tests/api/live/live-save-replay.ts
server/tests/api/live/live-socket-messages.ts
server/tests/api/live/live-views.ts
server/tests/api/live/live.ts
server/tests/api/moderation/blocklist-notification.ts
server/tests/api/moderation/video-blacklist.ts
server/tests/api/notifications/admin-notifications.ts
server/tests/api/notifications/comments-notifications.ts
server/tests/api/notifications/moderation-notifications.ts
server/tests/api/notifications/notifications-api.ts
server/tests/api/notifications/user-notifications.ts
server/tests/api/object-storage/live.ts
server/tests/api/object-storage/video-imports.ts
server/tests/api/object-storage/videos.ts
server/tests/api/redundancy/redundancy-constraints.ts
server/tests/api/redundancy/redundancy.ts
server/tests/api/search/search-activitypub-video-channels.ts
server/tests/api/search/search-activitypub-video-playlists.ts
server/tests/api/search/search-activitypub-videos.ts
server/tests/api/search/search-videos.ts
server/tests/api/server/auto-follows.ts
server/tests/api/server/config-defaults.ts
server/tests/api/server/config.ts
server/tests/api/server/contact-form.ts
server/tests/api/server/email.ts
server/tests/api/server/follows.ts
server/tests/api/server/handle-down.ts
server/tests/api/server/jobs.ts
server/tests/api/server/plugins.ts
server/tests/api/server/proxy.ts
server/tests/api/server/reverse-proxy.ts
server/tests/api/server/slow-follows.ts
server/tests/api/server/stats.ts
server/tests/api/users/users-multiple-servers.ts
server/tests/api/users/users-verification.ts
server/tests/api/users/users.ts
server/tests/api/videos/audio-only.ts
server/tests/api/videos/multiple-servers.ts
server/tests/api/videos/resumable-upload.ts
server/tests/api/videos/single-server.ts
server/tests/api/videos/video-captions.ts
server/tests/api/videos/video-channels.ts
server/tests/api/videos/video-comments.ts
server/tests/api/videos/video-create-transcoding.ts
server/tests/api/videos/video-description.ts
server/tests/api/videos/video-files.ts
server/tests/api/videos/video-hls.ts
server/tests/api/videos/video-imports.ts
server/tests/api/videos/video-playlist-thumbnails.ts
server/tests/api/videos/video-playlists.ts
server/tests/api/videos/video-privacy.ts
server/tests/api/videos/video-schedule-update.ts
server/tests/api/videos/video-transcoder.ts
server/tests/api/videos/videos-history.ts
server/tests/api/videos/videos-overview.ts
server/tests/api/videos/videos-views-cleaner.ts
server/tests/cli/create-import-video-file-job.ts
server/tests/cli/create-move-video-storage-job.ts
server/tests/cli/create-transcoding-job.ts
server/tests/cli/peertube.ts
server/tests/cli/plugins.ts
server/tests/cli/print-transcode-command.ts
server/tests/cli/prune-storage.ts
server/tests/cli/reset-password.ts
server/tests/external-plugins/auto-block-videos.ts
server/tests/external-plugins/auto-mute.ts
server/tests/helpers/image.ts
server/tests/helpers/request.ts
server/tests/plugins/external-auth.ts
server/tests/plugins/filter-hooks.ts
server/tests/plugins/html-injection.ts
server/tests/plugins/id-and-pass-auth.ts
server/tests/plugins/plugin-helpers.ts
server/tests/shared/actors.ts [moved from shared/server-commands/users/actors.ts with 97% similarity]
server/tests/shared/captions.ts [moved from shared/server-commands/videos/captions.ts with 100% similarity]
server/tests/shared/checks.ts [moved from shared/server-commands/miscs/checks.ts with 63% similarity]
server/tests/shared/directories.ts [moved from shared/server-commands/server/directories.ts with 95% similarity]
server/tests/shared/generate.ts [moved from shared/server-commands/miscs/generate.ts with 94% similarity]
server/tests/shared/index.ts
server/tests/shared/live.ts [new file with mode: 0644]
server/tests/shared/mock-servers/index.ts [moved from shared/server-commands/mock-servers/index.ts with 77% similarity]
server/tests/shared/mock-servers/mock-429.ts [moved from shared/server-commands/mock-servers/mock-429.ts with 90% similarity]
server/tests/shared/mock-servers/mock-email.ts [moved from shared/server-commands/mock-servers/mock-email.ts with 93% similarity]
server/tests/shared/mock-servers/mock-instances-index.ts [moved from shared/server-commands/mock-servers/mock-instances-index.ts with 94% similarity]
server/tests/shared/mock-servers/mock-joinpeertube-versions.ts [moved from shared/server-commands/mock-servers/mock-joinpeertube-versions.ts with 94% similarity]
server/tests/shared/mock-servers/mock-object-storage.ts [moved from shared/server-commands/mock-servers/mock-object-storage.ts with 88% similarity]
server/tests/shared/mock-servers/mock-plugin-blocklist.ts [moved from shared/server-commands/mock-servers/mock-plugin-blocklist.ts with 90% similarity]
server/tests/shared/mock-servers/mock-proxy.ts [moved from shared/server-commands/mock-servers/mock-proxy.ts with 89% similarity]
server/tests/shared/mock-servers/shared.ts [moved from shared/server-commands/mock-servers/utils.ts with 100% similarity]
server/tests/shared/notifications.ts [moved from shared/server-commands/users/notifications.ts with 98% similarity]
server/tests/shared/playlists.ts [moved from shared/server-commands/videos/playlists.ts with 93% similarity]
server/tests/shared/plugins.ts [moved from shared/server-commands/server/plugins.ts with 91% similarity]
server/tests/shared/requests.ts
server/tests/shared/streaming-playlists.ts [moved from shared/server-commands/videos/streaming-playlists.ts with 95% similarity]
server/tests/shared/tests.ts [new file with mode: 0644]
server/tests/shared/tracker.ts [moved from shared/server-commands/server/tracker.ts with 87% similarity]
server/tests/shared/videos.ts [moved from server/tests/shared/video.ts with 64% similarity]
shared/core-utils/common/array.ts [moved from shared/core-utils/utils/array.ts with 100% similarity]
shared/core-utils/common/crypto.ts [moved from shared/core-utils/crypto.ts with 72% similarity]
shared/core-utils/common/env.ts [new file with mode: 0644]
shared/core-utils/common/index.ts
shared/core-utils/common/object.ts [new file with mode: 0644]
shared/core-utils/common/path.ts [moved from shared/core-utils/path.ts with 65% similarity]
shared/core-utils/common/time.ts [new file with mode: 0644]
shared/core-utils/common/version.ts [moved from shared/core-utils/common/miscs.ts with 53% similarity]
shared/core-utils/index.ts
shared/core-utils/utils/index.ts [deleted file]
shared/core-utils/utils/object.ts [deleted file]
shared/core-utils/videos/index.ts
shared/core-utils/videos/uuid.ts [moved from shared/core-utils/uuid.ts with 100% similarity]
shared/extra-utils/file.ts [new file with mode: 0644]
shared/extra-utils/index.ts
shared/models/users/index.ts
shared/server-commands/index.ts
shared/server-commands/logs/logs-command.ts
shared/server-commands/miscs/index.ts
shared/server-commands/miscs/sql-command.ts
shared/server-commands/miscs/tests.ts [deleted file]
shared/server-commands/requests/check-api-params.ts [deleted file]
shared/server-commands/requests/index.ts
shared/server-commands/requests/requests.ts
shared/server-commands/server/config-command.ts
shared/server-commands/server/index.ts
shared/server-commands/server/jobs-command.ts
shared/server-commands/server/jobs.ts
shared/server-commands/server/server.ts
shared/server-commands/server/servers-command.ts
shared/server-commands/server/servers.ts
shared/server-commands/shared/abstract-command.ts
shared/server-commands/users/accounts-command.ts
shared/server-commands/users/index.ts
shared/server-commands/users/notifications-command.ts
shared/server-commands/users/users-command.ts
shared/server-commands/videos/blacklist-command.ts
shared/server-commands/videos/captions-command.ts
shared/server-commands/videos/channels-command.ts
shared/server-commands/videos/index.ts
shared/server-commands/videos/live-command.ts
shared/server-commands/videos/live.ts
shared/server-commands/videos/videos-command.ts
shared/server-commands/videos/videos.ts [deleted file]

index 42f4f6096ff26af67b461a13ee9adeb64d7c39d4..5ada4a8052aee41d7ebc9f59db469fc85cbb9501 100644 (file)
@@ -1,13 +1,13 @@
 import express from 'express'
 import RateLimit from 'express-rate-limit'
 import { logger } from '@server/helpers/logger'
-import { buildUUID } from '@shared/core-utils/uuid'
 import { CONFIG } from '@server/initializers/config'
 import { getAuthNameFromRefreshGrant, getBypassFromExternalAuth, getBypassFromPasswordGrant } from '@server/lib/auth/external-auth'
 import { handleOAuthToken } from '@server/lib/auth/oauth'
 import { BypassLogin, revokeToken } from '@server/lib/auth/oauth-model'
 import { Hooks } from '@server/lib/plugins/hooks'
 import { asyncMiddleware, authenticate, openapiOperationDoc } from '@server/middlewares'
+import { buildUUID } from '@shared/core-utils'
 import { ScopedToken } from '@shared/models/users/user-scoped-token'
 
 const tokensRouter = express.Router()
index f8f07b1c6363b35c1c8621159522bfcf43791743..dc19477643ecc27645ba17b753d87c1ffb2ca3d9 100644 (file)
@@ -1,10 +1,10 @@
 import express from 'express'
 import { join } from 'path'
-import { uuidToShort } from '@shared/core-utils/uuid'
 import { scheduleRefreshIfNeeded } from '@server/lib/activitypub/playlists'
 import { Hooks } from '@server/lib/plugins/hooks'
 import { getServerActor } from '@server/models/application/application'
 import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models'
+import { uuidToShort } from '@shared/core-utils'
 import { VideoPlaylistCreateResult, VideoPlaylistElementCreateResult } from '@shared/models'
 import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
 import { VideoPlaylistCreate } from '../../../shared/models/videos/playlist/video-playlist-create.model'
index e466d041bed3c3520d6177c6882d9c45839b4f88..4ee39aa4ff7b920354016a18864eafe9ab8af823 100644 (file)
@@ -1,6 +1,5 @@
 import express from 'express'
 import { createReqFiles } from '@server/helpers/express-utils'
-import { buildUUID, uuidToShort } from '@shared/core-utils/uuid'
 import { CONFIG } from '@server/initializers/config'
 import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants'
 import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url'
@@ -10,6 +9,7 @@ import { buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } fro
 import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator } from '@server/middlewares/validators/videos/video-live'
 import { VideoLiveModel } from '@server/models/video/video-live'
 import { MVideoDetails, MVideoFullLight } from '@server/types/models'
+import { buildUUID, uuidToShort } from '@shared/core-utils'
 import { LiveVideoCreate, LiveVideoUpdate, VideoState } from '../../../../shared'
 import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
 import { logger } from '../../../helpers/logger'
index a4d0f980fb21b3be5ffdb17889cdd731c97e7198..9f620c04d3abf79b6b38ea889824abdee6edc043 100644 (file)
@@ -1,9 +1,7 @@
 import express from 'express'
 import { move } from 'fs-extra'
 import { basename } from 'path'
-import { getLowercaseExtension } from '@shared/core-utils'
 import { getResumableUploadPath } from '@server/helpers/upload'
-import { uuidToShort } from '@shared/core-utils/uuid'
 import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
 import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url'
 import { generateWebTorrentVideoFilename } from '@server/lib/paths'
@@ -20,6 +18,7 @@ import { VideoPathManager } from '@server/lib/video-path-manager'
 import { buildNextVideoState } from '@server/lib/video-state'
 import { openapiOperationDoc } from '@server/middlewares/doc'
 import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
+import { getLowercaseExtension, uuidToShort } from '@shared/core-utils'
 import { VideoCreate, VideoState } from '../../../../shared'
 import { HttpStatusCode } from '../../../../shared/models'
 import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'
index eaabdbbea2b94d72e45cf903eca8274cdf535a32..65578c1438ec2000449d22fefd8f9c1270e7c08c 100644 (file)
@@ -2,7 +2,7 @@ import 'multer'
 import { UploadFilesForCheck } from 'express'
 import { sep } from 'path'
 import validator from 'validator'
-import { isShortUUID, shortToUUID } from '@shared/core-utils/uuid'
+import { isShortUUID, shortToUUID } from '@shared/core-utils'
 
 function exists (value: any) {
   return value !== undefined && value !== null
index ced288045159dee629c2759a01da997e83f59fac..c4704b189fad7967364910a0d2673a0a2bd9f803 100644 (file)
@@ -1,9 +1,8 @@
 import { copy, readFile, remove, rename } from 'fs-extra'
 import Jimp, { read } from 'jimp'
-import { getLowercaseExtension } from '@shared/core-utils'
+import { buildUUID, getLowercaseExtension } from '@shared/core-utils'
 import { convertWebPToJPG, processGIF } from './ffmpeg-utils'
 import { logger } from './logger'
-import { buildUUID } from '@shared/core-utils/uuid'
 
 function generateImageFilename (extension = '.jpg') {
   return buildUUID() + extension
index 31705e7fa700bb373e16fa13b51a0a093d5b5ade..66a353204a20d71555c33e41846f6dd9227d030d 100644 (file)
@@ -4,7 +4,7 @@ import { Request } from 'express'
 import { cloneDeep } from 'lodash'
 import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants'
 import { MActor } from '../types/models'
-import { sha256 } from '@shared/core-utils/crypto'
+import { sha256 } from '@shared/core-utils/common/crypto'
 import { createPrivateKey, getPublicKey, promisify1, promisify2 } from './core-utils'
 import { jsonld } from './custom-jsonld-signature'
 import { logger } from './logger'
index 882f808abaa9583fd68b3ec87335f0355a21236d..d6a3dae9555ed3682cb2be7bab7d0f837bf31a7b 100644 (file)
@@ -3,7 +3,7 @@ import { Instance as ParseTorrent } from 'parse-torrent'
 import { join } from 'path'
 import { ResultList } from '../../shared'
 import { CONFIG } from '../initializers/config'
-import { sha256 } from '@shared/core-utils/crypto'
+import { sha256 } from '@shared/core-utils/common/crypto'
 import { execPromise, execPromise2, randomBytesPromise } from './core-utils'
 import { logger } from './logger'
 
index 67cb3971d4a685e3d910f584daa30dac71643f5e..03663d73c46c9857c4ce19e481bf048f468f5bdb 100644 (file)
@@ -15,7 +15,7 @@ import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/types/models/vide
 import { MStreamingPlaylistVideo } from '@server/types/models/video/video-streaming-playlist'
 import { CONFIG } from '../initializers/config'
 import { promisify2 } from './core-utils'
-import { sha1 } from '@shared/core-utils/crypto'
+import { sha1 } from '@shared/core-utils/common/crypto'
 import { logger } from './logger'
 import { generateVideoImportTmpPath } from './utils'
 import { extractVideo } from './video'
index 258ccdb51e9fe711d507b4eeb07734041a97687e..57f7af789ca16969de4b63899222c8960f5070a5 100644 (file)
@@ -2,7 +2,7 @@ import { CronRepeatOptions, EveryRepeatOptions } from 'bull'
 import { randomBytes } from 'crypto'
 import { invert } from 'lodash'
 import { join } from 'path'
-import { randomInt } from '../../shared/core-utils/common/miscs'
+import { randomInt, root } from '@shared/core-utils'
 import {
   AbuseState,
   JobType,
@@ -18,7 +18,6 @@ import { FollowState } from '../../shared/models/actors'
 import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
 import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model'
 import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model'
-import { root } from '../../shared/core-utils'
 // Do not use barrels, remain constants as independent as possible
 import { isTestInstance, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
 import { CONFIG, registerConfigChangedHandler } from './config'
index 82971c9f57adf0e4f830f690e0c159c6221e8c4e..221475bb14efe0a7c95bdf6190269b245145b0f1 100644 (file)
@@ -1,4 +1,4 @@
-import { buildUUID } from '@shared/core-utils/uuid'
+import { buildUUID } from '@shared/core-utils'
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
index 5cc52e7ee9a81a6ca666cecf7d62a802fa7ab235..fb27c93012c53a1ecbc8fa47851dc3d4c04208e9 100644 (file)
@@ -1,5 +1,5 @@
 import * as Sequelize from 'sequelize'
-import { buildUUID } from '@shared/core-utils/uuid'
+import { buildUUID } from '@shared/core-utils'
 import { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos'
 import { WEBSERVER } from '../constants'
 
index 961777e357334b23df27939090c972ca0ec8be54..4ed4d9681740ee008d7d39f2076c358823a35cbd 100644 (file)
@@ -1,5 +1,5 @@
 import * as Sequelize from 'sequelize'
-import { buildUUID } from '@shared/core-utils/uuid'
+import { buildUUID } from '@shared/core-utils'
 
 async function up (utils: {
   transaction: Sequelize.Transaction
index 1ad89ac568dfc1e720b5fe4847e28f5ad1bce255..38d93c1085190f4db6cbd0dbcb2b6e5415572516 100644 (file)
@@ -1,9 +1,8 @@
-import { getLowercaseExtension } from '@shared/core-utils'
 import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc'
-import { buildUUID } from '@shared/core-utils/uuid'
 import { MIMETYPES } from '@server/initializers/constants'
 import { ActorModel } from '@server/models/actor/actor'
 import { FilteredModelAttributes } from '@server/types'
+import { buildUUID, getLowercaseExtension } from '@shared/core-utils'
 import { ActivityPubActor, ActorImageType } from '@shared/models'
 
 function getActorAttributesFromObject (
index 47bc8c05566774098671fec01393457e97ed2707..dc0022852dbc10100653a3f919adfcf273f38e4f 100644 (file)
@@ -8,7 +8,7 @@ import {
   UnauthorizedClientError,
   UnsupportedGrantTypeError
 } from 'oauth2-server'
-import { sha1 } from '@shared/core-utils/crypto'
+import { sha1 } from '@shared/core-utils/common/crypto'
 import { randomBytesPromise } from '@server/helpers/core-utils'
 import { MOAuthClient } from '@server/types/models'
 import { OAUTH_LIFETIME } from '../../initializers/constants'
index dee7ca8edd09e68a6d5bfb25337d63895178ee0f..91708839bb840b4f6de92a7b22a8ac7961c61502 100644 (file)
@@ -9,7 +9,7 @@ import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from
 import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
 import { VideoPlaylistPrivacy, VideoPrivacy } from '../../shared/models/videos'
 import { isTestInstance } from '../helpers/core-utils'
-import { sha256 } from '@shared/core-utils/crypto'
+import { sha256 } from '@shared/core-utils/common/crypto'
 import { logger } from '../helpers/logger'
 import { mdToPlainText } from '../helpers/markdown'
 import { CONFIG } from '../initializers/config'
index 220b7733b56d3b2dc15c5c613527edd0f3b38d68..e4904be5f3aae64ad93a4e57392f8a6cd63b9b3a 100644 (file)
@@ -2,7 +2,7 @@ import { close, ensureDir, move, open, outputJSON, read, readFile, remove, stat,
 import { flatten, uniq } from 'lodash'
 import { basename, dirname, join } from 'path'
 import { MStreamingPlaylistFilesVideo, MVideo, MVideoUUID } from '@server/types/models'
-import { sha256 } from '@shared/core-utils/crypto'
+import { sha256 } from '@shared/core-utils/common/crypto'
 import { getAudioStreamCodec, getVideoStreamCodec, getVideoStreamSize } from '../helpers/ffprobe-utils'
 import { logger } from '../helpers/logger'
 import { doRequest, doRequestAndSaveToFile } from '../helpers/requests'
index 572696f2acfca3f991e7bddd7e8e00efb26c1def..04ad98f3e449b46b52caaaba6481c50ab42ff7ac 100644 (file)
@@ -2,9 +2,8 @@ import 'multer'
 import { queue } from 'async'
 import LRUCache from 'lru-cache'
 import { join } from 'path'
-import { getLowercaseExtension } from '@shared/core-utils'
-import { buildUUID } from '@shared/core-utils/uuid'
 import { ActorModel } from '@server/models/actor/actor'
+import { buildUUID, getLowercaseExtension } from '@shared/core-utils'
 import { ActivityPubActorType, ActorImageType } from '@shared/models'
 import { retryTransactionWrapper } from '../helpers/database-utils'
 import { processImage } from '../helpers/image-utils'
index d8cf812e3bce15d2384fbf26489c32c3159da4b6..bf0c3a86b71ff27679cbe65362ad302a39bac87f 100644 (file)
@@ -1,9 +1,8 @@
 import { join } from 'path'
-import { buildUUID } from '@shared/core-utils/uuid'
 import { CONFIG } from '@server/initializers/config'
 import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants'
 import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/types/models'
-import { removeFragmentedMP4Ext } from '@shared/core-utils'
+import { buildUUID, removeFragmentedMP4Ext } from '@shared/core-utils'
 
 // ################## Video file name ##################
 
index 230bf37d0f55cb1351de2603900ec4dd01870412..3ba0c0ca4b13fcac0aafcc9a7d6f110d8748116d 100644 (file)
@@ -1,7 +1,7 @@
 import { Transaction } from 'sequelize/types'
-import { buildUUID } from '@shared/core-utils/uuid'
 import { UserModel } from '@server/models/user/user'
 import { MActorDefault } from '@server/types/models/actor'
+import { buildUUID } from '@shared/core-utils'
 import { ActivityPubActorType } from '../../shared/models/activitypub'
 import { UserNotificationSetting, UserNotificationSettingValue } from '../../shared/models/users'
 import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants'
index 429b36df989fe8ccbef3457c2767cb011dcc03aa..4027f885d19f40ccbcf7c19a2b50b763ccc460eb 100644 (file)
@@ -1,6 +1,5 @@
 import { remove } from 'fs-extra'
 import { extname, join } from 'path'
-import { buildUUID } from '@shared/core-utils/uuid'
 import { extractVideo } from '@server/helpers/video'
 import { CONFIG } from '@server/initializers/config'
 import {
@@ -11,6 +10,7 @@ import {
   MVideoFileVideo,
   MVideoUUID
 } from '@server/types/models'
+import { buildUUID } from '@shared/core-utils'
 import { VideoStorage } from '@shared/models'
 import { makeHLSFileAvailable, makeWebTorrentFileAvailable } from './object-storage'
 import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from './paths'
index 4a9a84a5bd44f3a5976d2077ef6a5fe51aff041d..d71bb4d5615f969b5bccec04d271a2d1cb048866 100644 (file)
@@ -1,7 +1,7 @@
 import { FindOptions, ModelIndexesOptions, Op, WhereOptions } from 'sequelize'
 import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'
-import { uuidToShort } from '@shared/core-utils/uuid'
 import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user'
+import { uuidToShort } from '@shared/core-utils'
 import { AttributesOnly } from '@shared/typescript-utils'
 import { UserNotification, UserNotificationType } from '../../../shared'
 import { isBooleanValid } from '../../helpers/custom-validators/misc'
index f6c750ccf5df977936d5c4bffa28217bea456c51..99a4818ab09a74c6cbca657a012c6d8a73f94d8c 100644 (file)
@@ -1,7 +1,7 @@
-import { uuidToShort } from '@shared/core-utils/uuid'
 import { generateMagnetUri } from '@server/helpers/webtorrent'
 import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls'
 import { VideoViews } from '@server/lib/video-views'
+import { uuidToShort } from '@shared/core-utils'
 import { VideoFile, VideosCommonQueryAfterSanitize } from '@shared/models'
 import { ActivityTagObject, ActivityUrlObject, VideoObject } from '../../../../shared/models/activitypub/objects'
 import { Video, VideoDetails, VideoInclude } from '../../../../shared/models/videos'
index 642613cfe8ac725dc09575139ac604077451f5e3..20741ea64bd668411b59e3c70712ea270c7d6b31 100644 (file)
@@ -15,8 +15,8 @@ import {
   Table,
   UpdatedAt
 } from 'sequelize-typescript'
-import { buildUUID } from '@shared/core-utils/uuid'
 import { MVideo, MVideoCaption, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models'
+import { buildUUID } from '@shared/core-utils'
 import { AttributesOnly } from '@shared/typescript-utils'
 import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model'
 import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions'
index 132fa0e6800a4273c538d4bc08ab6a03cf9e6a1f..07bb6481076e94c8bfd28c79e8f8d53a4c18edc0 100644 (file)
@@ -18,8 +18,7 @@ import {
   UpdatedAt
 } from 'sequelize-typescript'
 import { MAccountId, MChannelId } from '@server/types/models'
-import { buildPlaylistEmbedPath, buildPlaylistWatchPath, pick } from '@shared/core-utils'
-import { buildUUID, uuidToShort } from '@shared/core-utils/uuid'
+import { buildPlaylistEmbedPath, buildPlaylistWatchPath, buildUUID, pick, uuidToShort } from '@shared/core-utils'
 import { AttributesOnly } from '@shared/typescript-utils'
 import { ActivityIconObject } from '../../../shared/models/activitypub/objects'
 import { PlaylistObject } from '../../../shared/models/activitypub/objects/playlist-object'
index d813f89b5af02c5aecf4d7814bc06cfeac137960..7b410f8eea4ac00b26d18935ffead63d11b25ac5 100644 (file)
@@ -21,7 +21,7 @@ import { MStreamingPlaylist, MVideo } from '@server/types/models'
 import { AttributesOnly } from '@shared/typescript-utils'
 import { VideoStorage } from '@shared/models'
 import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type'
-import { sha1 } from '@shared/core-utils/crypto'
+import { sha1 } from '@shared/core-utils/common/crypto'
 import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
 import { isArrayOf } from '../../helpers/custom-validators/misc'
 import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos'
index a99b012b9d72da86450929ea2e1f430f0a51f52b..66a9a28fa03a5ae6e5793bc97757024798516fe2 100644 (file)
@@ -32,8 +32,7 @@ import { getHLSDirectory, getHLSRedundancyDirectory } from '@server/lib/paths'
 import { VideoPathManager } from '@server/lib/video-path-manager'
 import { getServerActor } from '@server/models/application/application'
 import { ModelCache } from '@server/models/model-cache'
-import { buildVideoEmbedPath, buildVideoWatchPath, pick } from '@shared/core-utils'
-import { uuidToShort } from '@shared/core-utils/uuid'
+import { buildVideoEmbedPath, buildVideoWatchPath, pick, uuidToShort } from '@shared/core-utils'
 import { VideoFile, VideoInclude } from '@shared/models'
 import { AttributesOnly } from '@shared/typescript-utils'
 import { ResultList, UserRight, VideoPrivacy, VideoState } from '../../../shared'
index c3368c7ebfc170b8b84987d8e0f6208f7b22eecf..7a443b5535521a37514f97c14a6cdd7d460329df 100644 (file)
@@ -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'
 
index 93bf01842d29040ab05434212f232598a3cc089a..cc71e82eaa09c38c7941f04ea7c191cf96f9197a 100644 (file)
@@ -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
 
index 5aa94af5d96ae572e26a69329142f07d47af27ab..25e1d982343b34c7805cd92d72af1459ea01fee9 100644 (file)
@@ -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'
 
index 669a86fca52a2e9876c5461f9ba8408f3b1094c7..71e1c40ba6d5aac4c90f178045b16abdfa523603 100644 (file)
@@ -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[] = []
index 3b871ae12da5601fb6468be7c364d4444ff03022..c4cb5ea0daa8c38cf1eaa87896b6861313db269e 100644 (file)
@@ -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
 
index 58167cbab9055ad642233d452180d725ded40542..c4b051723b5696a5855033ccff978d4a57ae2839 100644 (file)
@@ -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/'
index fc8e63ed4f463ed95ebb48f115a824a0d2811b82..07f879e0ec8bb5dfd579e81696b5a4b9802a5f8d 100644 (file)
@@ -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/'
index 2dc3a166deadf381cf43530fbd9b601290ac0b5d..36526d4944c1871071ad4d08045d56e6bba5d33d 100644 (file)
@@ -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[]
index a2e51e14d38ffd751bd782d05f11c4cd7a424478..9db442b0be1105713409618ca60ffea9ba8a4364 100644 (file)
@@ -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
index 6121d22022c251f35595a08a6726eb402ace63bb..d4dae5a754f9aa7a8a5539726995286c3cc33027 100644 (file)
@@ -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
index b7c603755f945a87c7060ce4d551d4e25853e910..d85961d62679a5d095d04f166f13aee1ebff4fb2 100644 (file)
@@ -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'
index 8b79d97e09180797543d4024006c0db531564ead..8aee6164c3d64c19529fe437094892c07b5dd759 100644 (file)
@@ -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'
index c8ac71476e48b2412af94731eacc193c34c6904d..95f2122aebc5a108fd4a69c7f8622f5880d67a89 100644 (file)
@@ -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/'
index 79e4875901ae22261d218c3b7d2387dd271ebf93..c3f15b86e43bf5ec0830313fa9e6bb76bf09f48e 100644 (file)
@@ -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
index f3bfcb16caad5a4f8ff5e597f8744434b82b1d14..04519cf23c97cfe8cfe6ba447ca252a5d47ae23c 100644 (file)
@@ -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[]
index edeeed571ed3c2c807872772e76fd8123c9561c5..ca0fbf31db426370bd75306f9b79a01f20a858d8 100644 (file)
@@ -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({
index 11ade9071c4d5781e61dd9c7f1c7056dd8b87435..333012940e1f4c8f3ae45c217feb9bf346c78f24 100644 (file)
@@ -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[]
index 02898bb8770c9425bb53e2d696f41671a984762b..deb4a7aa3dae24a59c49289555cdae495dd29a35 100644 (file)
@@ -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
index 912d4a992e7ffc72d605b5a38ad9821c19253fb5..4bc8084a1de5a1be7ff5740d85793ce1f97fb78e 100644 (file)
@@ -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
index 95226dff58f18590b7186af5c409a0f85edc93dc..a13ed5aa3eab1edf9cc6b5ae4e0ee529b41814e6 100644 (file)
@@ -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'
index c98b5e189380288239e5fe7d4f09ec5bbd58dea8..d8353f83bd899ccfcbdd08f477187962cb561529 100644 (file)
@@ -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/'
index 254177afd32bcb5c6263af913b552bbd6a1416f0..84254945c339e068e2f4d8244daa1d735d556215 100644 (file)
@@ -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/'
index 7eb3c1cae53eb8a8466af73f015421d53e4b0509..1aab608268a31663914d69e00a8dfa655772339b 100644 (file)
@@ -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[]
index 34c1a9673df4c7db3073cebbb23f085eaffe887d..8a88407936aab609e7f98d6d430bdb1ab23c354c 100644 (file)
@@ -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/'
index 747a5d3ec16b915d9669efe79aa8def8a22721d3..1e9732fe9b391958a66ebd1340b4865c59a096e3 100644 (file)
@@ -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
 
index 05cf61cba2e80d277b5d14872f1dbeb7a24be497..63c3582e91021193246fc6b9658798d4f2e9c43d 100644 (file)
@@ -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
 
index 90ab4460c55682300dff48f011a81ff4577f43a1..8c079509236d3aeceb4fdb5112e724bbb5c0e75a 100644 (file)
@@ -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[]
index 7cefb2a540dc345affc860a3553ddffec2ae296c..ddea68db4a36f9f29085c454bc3ed29e9cc2cad9 100644 (file)
@@ -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'
index ac3c13f78c1e279fe616783757eab399b2820613..4b17ce7db6114eb2fb44f757149c46258b66f6d6 100644 (file)
@@ -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
index e4b4c4b2adf5f0194aaec247e82d9f4760020de8..31a0752c7bec2b1c4cd5be7a15219ed6ffe6a825 100644 (file)
@@ -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'
index 3b2607eed2931c6d7314cd8721691946e2d78942..4cc70f5cc460745c2c629a0b8a073f05dae99fe8 100644 (file)
@@ -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
 
index 89880c46bebff2f1d917496a60aec7c25cc0d4da..909399836afc97f411dbafce015693009b623df4 100644 (file)
@@ -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
 
index 12a4d64d80a0637143bb5f5c10e01f30ca71a889..c2392603b2ea39861644d86a1fe8850e861973d6 100644 (file)
@@ -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
 
index 31e8f906ebc73e6f85907dc634dab4dc5710d4ac..93506197186e64badcbcc0fb7e673cb01b6a7883 100644 (file)
@@ -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
 
index 9fb6b4e54404b5e142114112c4ef90fad8e23aab..95a342b015e4afb887ec8a73388e670f9ffcef47 100644 (file)
@@ -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
 
index 42cf9c5f67a08372cbfc07a2e7a52c07a06f85f1..50b16443eee9e48e7fcf9429fbf7920d18f01922 100644 (file)
@@ -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
 
index 5de4436bec1a8b8d03633da507bc2d3c6516ae68..446d0913cb933beb33b1b3955c802dccd24e4ad7 100644 (file)
@@ -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
 
index 3869fd6c7d577894e4e5517b94787c917c2b125f..3f9355d2de6a3265ae696262e8843fd127408a3f 100644 (file)
@@ -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
 
index d1e2ea56e8fcd638f34d302310385efe9bc15f07..87d14799876112f9a8e4afc4a3afd604e4e1256d 100644 (file)
@@ -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
 
index 4e2887fa0c52c75a2ea3d76a5d3e0ab48e490a5f..322e938158a8e2cfe09d7b499bcaa8196d5d367c 100644 (file)
@@ -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
 
index 18962a71e77363f4ce4d155a20352907fcff4ab9..f037e7aaec29ceb2487b6b7da7e0862328e5ed77 100644 (file)
@@ -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
index 919be4bcaaee835c1025ed189c4c4a61fc219da9..b82f1712a0042160d1499a527a76331f9a0060e2 100644 (file)
@@ -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
 
index 4da9d268400f24763e7942355ffbdfa433c6b31d..e6e1d5f7b4c306bc4b55e51c57c9d2be904b706e 100644 (file)
@@ -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[] = []
index aeb73350bdf8f9f19b89dcdbedd58970a5b16b40..ac08449f898cf58ed703f9404be93dec5a4c1cc7 100644 (file)
@@ -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
 
index a2fcdf2ef5efc51a243a9bb1f1f8b9624a3e0a87..bb3024617fa27e1e2fd037fe8fbcdd42d5b44a4c 100644 (file)
@@ -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
 
index 2c341c139df61653fea2a35d4de1f60821e3c531..0cb0a6e340e1f650d5a331e9bb7e1fecdae0c14e 100644 (file)
@@ -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
 
index adca16e8f915832e32d5b630a5a5a10bc2ee0450..fb81832afbc4836637284ef1e2a81684dc0d292f 100644 (file)
@@ -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
 
index bf469015f8d75cfa23dc82a922bf221c8b476f2c..498efcb17e11af885e777ce0962c503b16252c6f 100644 (file)
@@ -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
 
index 1a8d8183b65f94e53a585134f14e44c0cd1490ac..17c6b25a59d94545940266ce96aeb41f0bc09f79 100644 (file)
@@ -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
index 556cfbc31f3ceabe18a6e75120b21bdcc6909efa..3f228627802878531df8ffedde6d4e39bffe5557 100644 (file)
@@ -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
 
index 1f29f840a5aa5def010f6fa04612988036a6e674..2e0abc6ba73ccf8022f9b574e371c80a300fdd7a 100644 (file)
@@ -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
 
index 550af8ed20309164c11b13550d5c8f43b69cedfe..d9243ac5351aebc114277b91b173f578ef634a53 100644 (file)
@@ -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
 
index 5aa3738c9a51c906a8e523d4294725633f042caf..60b95ae4c8af11f9a10d27a291fad74bb39e441c 100644 (file)
@@ -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
 
index bf2375ffa4235366a55814db0f19154b999b1bc8..c544705d37a5ae40cc0d504637b3f7bd4a1b8a8f 100644 (file)
@@ -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
 
index 74bb96040e17620328340e8c0d68f86ec38d8697..6d2333a6bc582db202fc787fd396eb6d84bb0c0f 100644 (file)
@@ -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
 
index 4ceda7de3c2ab8e4c7d03187d948d19faf9d5017..3ff09bf7ea2c210f61a90d2b3b583e0e75daeaba 100644 (file)
@@ -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
 
index 2e6617a15427d31a3c00c020a9437251e8100a19..2356f701c46c8df84816ab81af93ec2e0bb68887 100644 (file)
@@ -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
 
index 10925145310a5c6adac0506d86fc57c554d5f480..f3facb04a1afb4cd6984884f53aff4a6be784e7f 100644 (file)
@@ -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
 
index 6fa6053cb3a12d939322ffd4214d9529145492e0..20b5e378c985e4669f3ecd9912ba639a36fe3bea 100644 (file)
@@ -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
 
index e128c36a5bd892f557fbf3776ce682c562348398..cd34df15de10a32faea7cb7351f6a8028a8f6489 100644 (file)
@@ -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
 
index b134e074be32748f4ea3f2122ed8b83c7118ddd7..7c3836681da6a35c0d5ee784cf0980b1e7d10808 100644 (file)
@@ -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
 
index 5b38f67415df8c68310568696de4facf10247c09..4294e1fd52af0cf93ae4172ee5f8e58438230d34 100644 (file)
@@ -2,10 +2,10 @@
 
 import 'mocha'
 import * as chai from 'chai'
+import { dateIsValid } from '@server/tests/shared'
 import {
   cleanupTests,
   createMultipleServers,
-  dateIsValid,
   doubleFollow,
   PeerTubeServer,
   setAccessTokensToServers,
index fbcd8910193365533250e659f0ed3103681e3a76..e82096c481549c464aade8fd9d20e364bb3cc465 100644 (file)
@@ -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
 
index 626a0d860308fcf7ba6db4242052f7b56820ab3f..c40a4f9b8ff75d8bfbb431469ef98975b91b1770 100644 (file)
@@ -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
 
index fc9b88a6a84079bf172c5d7310bfef6696223c19..968d98e96897ba041fc037e7071cb14052a82e86 100644 (file)
@@ -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
index 5f24c351bec4e83139a935ac0a2006f93d4ecee1..666a7c2e609f3f2b448c294c78109029d1d6bf03 100644 (file)
@@ -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
 
index 65ef4607bde908c1ec0b7faae1d4319a92872657..f0334532bf52033fc15d99c11b8272b6b683547a 100644 (file)
@@ -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
 
index e6699a059a949e878f24b56d8fe36eda065e0f38..5b2bbc520e7ea1babbf4e8c81b2bc7abba13a1f5 100644 (file)
@@ -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
 
index 9b23ba7972a76ed400a9e82bf502aeb87d751d75..0f3cc401a48e4ad2c772fa2f500bce46cd829a2a 100644 (file)
@@ -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
 
index fc44a6acd38fbd0e246eac319b29cd2b528657ae..ff9172a82e664ff2ac294458af6d911d221cf3ff 100644 (file)
@@ -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
 
index 4b27f2fbe2765d0b328443fce09fc5d2f89bf180..e58360ffe57ef3e79d18d6d11c7807b0dcf317ac 100644 (file)
@@ -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
 
index cb83fa0f07ac7984c7860f4815398b9bf590f47b..9fa03f1a9c95fd6abb3cb08d8c28ae5753a1c4d1 100644 (file)
@@ -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
 
index 0842817dc7f1699763ebaf2d4ba3505625cb6402..d6f4da63058c7240a099d170d384825c677465bd 100644 (file)
@@ -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
 
index e5e12dd1918333685f877a3d9b9c6e2668bdc026..28bf018c5af1083076ff2b929637d47efcd609a5 100644 (file)
@@ -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
 
index 9f00312aa3969012b304ce2eab21234eae58a1f3..b7f26c35fcf60c3d676e4347085024b50451b389 100644 (file)
@@ -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'
 
index 2ac577a59914a0a6f3654c9ae46ade06c9765e45..d435f36820a5b771149abec7bd92ec7a82731388 100644 (file)
@@ -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
 
index bb4f92a9bd74ef977f6ab4be42f482a430d156fc..2ae52397023d2606a37fd4887f0e6999c44c2006 100644 (file)
@@ -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
 
index e81f5471450c2ce8fcb7cdc783d9eab48a8be69b..62a6bab0d6c288c03c2a56b2dde3523878796dde 100644 (file)
@@ -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
 
index 23c55f7280ae279015f94cb298ad63ed38887b94..20b20488f2eb72dcb901d7c15ddac70dcdf81ae9 100644 (file)
@@ -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
 
index 0b51217401ce445a5aa70902e919db79a49bef9e..b0ef4a2e9371986fdb6131e3a6d7b3709ab4d71c 100644 (file)
@@ -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[]
index d050a7a7e29e36085ef514a25dbb4fe51a973989..218ec08ae6965ee5f1f634902bdc65dea6f14b36 100644 (file)
@@ -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
index 2518743f7da13de2963dc98d5142cc39a94833d5..e8e0f01f1838088b7ea19ee986aa5a4fedcd4224 100644 (file)
@@ -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 })
index e6b6c34eb49c2f4100b5c878316bce705a82716f..5fdb0fc036e5670560b17bf60ca5a843ac313b0b 100644 (file)
@@ -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
 
index 6279f5cd05482dfc50354043ed572b3ef0971d04..34327334f183a06982cc91f4a675bf4baa1f2bc3 100644 (file)
@@ -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
 
index 13eb941eae45c23439eb64d9a1c4f0c2f4da8cc4..3051a443d8eaae9d94d3bfc6875d5b677c6b1235 100644 (file)
@@ -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
 
index 9408574ad515164d35dc2a1aec14e6d835a3fc5a..00b4f6cbc7c60aa46a5411459ed574548c5f9ee4 100644 (file)
@@ -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
 
index f4b0bc53a87c776d47a316aa280d5ebb403ad26c..d24a8f4e152273b55b1fe94893d03117a9d76d87 100644 (file)
@@ -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
 
index 813fc4f45d23af89eb5c50498c0933f1e76a92c2..4e5ba13aa4569213f9e588bcf329193a1c407207 100644 (file)
@@ -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
 
index 08a4efb6341b1e1f107fa403e9008ada8d018f69..61fc0cb2002cdea4aa536dee88b073492e6e910d 100644 (file)
@@ -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
 
index 7f7597af4c078c2c5d5d8368f3d6cd183962a396..e6815a4a83e2a452db5556f8564bf19209ca5399 100644 (file)
@@ -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
 
index 5973272e5da77512b9633a29ed28110c46252d12..8ef0545d07c3b4ceded3a002643eb1a024969638 100644 (file)
@@ -2,19 +2,19 @@
 
 import 'mocha'
 import * as chai from 'chai'
+import { areObjectStorageTestsDisabled } from '@shared/core-utils'
+import { HttpStatusCode, VideoDetails, VideoFile, VideoInclude } from '@shared/models'
 import {
-  areObjectStorageTestsDisabled,
   cleanupTests,
   createMultipleServers,
   doubleFollow,
-  expectStartWith,
   makeRawRequest,
   ObjectStorageCommand,
   PeerTubeServer,
   setAccessTokensToServers,
   waitJobs
 } from '@shared/server-commands'
-import { HttpStatusCode, VideoDetails, VideoFile, VideoInclude } from '@shared/models'
+import { expectStartWith } from '../shared'
 
 const expect = chai.expect
 
index 8b66f24bfe3a8e6218fe048db2d0405974eb2798..c674d28d292caf631393b198074402705ff3bf6e 100644 (file)
@@ -1,20 +1,19 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
-
+import { areObjectStorageTestsDisabled } from '@shared/core-utils'
+import { HttpStatusCode, VideoDetails } from '@shared/models'
 import {
-  areObjectStorageTestsDisabled,
   cleanupTests,
   createMultipleServers,
   doubleFollow,
-  expectStartWith,
   makeRawRequest,
   ObjectStorageCommand,
   PeerTubeServer,
   setAccessTokensToServers,
   waitJobs
 } from '@shared/server-commands'
-import { HttpStatusCode, VideoDetails } from '@shared/models'
+import { expectStartWith } from '../shared'
 
 async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObjectStorage: boolean) {
   for (const file of video.files) {
index ea34286627bb1bfbdfbc844bd1124bc390117964..c85130fef8db2ea17c2e71f9837a5fd67804f9ce 100644 (file)
@@ -2,19 +2,19 @@
 
 import 'mocha'
 import * as chai from 'chai'
+import { areObjectStorageTestsDisabled } from '@shared/core-utils'
 import { HttpStatusCode, VideoFile } from '@shared/models'
 import {
-  areObjectStorageTestsDisabled,
   cleanupTests,
   createMultipleServers,
   doubleFollow,
-  expectStartWith,
   makeRawRequest,
   ObjectStorageCommand,
   PeerTubeServer,
   setAccessTokensToServers,
   waitJobs
-} from '../../../shared/server-commands'
+} from '@shared/server-commands'
+import { expectStartWith } from '../shared'
 
 const expect = chai.expect
 
index 72213473b5d61a61a160071adb1f2ee09f933678..034d216e36784adc1fd0130c783dc40ab86844ed 100644 (file)
@@ -2,19 +2,17 @@
 
 import 'mocha'
 import { expect } from 'chai'
+import { areHttpImportTestsDisabled, buildAbsoluteFixturePath } from '@shared/core-utils'
 import {
-  areHttpImportTestsDisabled,
-  buildAbsoluteFixturePath,
   cleanupTests,
   CLICommand,
   createSingleServer,
   doubleFollow,
-  FIXTURE_URLS,
   PeerTubeServer,
   setAccessTokensToServers,
-  testHelloWorldRegisteredSettings,
   waitJobs
-} from '../../../shared/server-commands'
+} from '@shared/server-commands'
+import { FIXTURE_URLS, testHelloWorldRegisteredSettings } from '../shared'
 
 describe('Test CLI wrapper', function () {
   let server: PeerTubeServer
index d9cf9465c3f307d5a6a3ef18fce381c21876d741..cd9f4e1c3ea7c61b2d0384efa94966450970ed4a 100644 (file)
@@ -9,7 +9,7 @@ import {
   PeerTubeServer,
   PluginsCommand,
   setAccessTokensToServers
-} from '../../../shared/server-commands'
+} from '@shared/server-commands'
 
 describe('Test plugin scripts', function () {
   let server: PeerTubeServer
index 36c43c6df3058dc67db807756e29e14d31a5c903..27896f0310f804ca482dc53a9e1530268800cc7b 100644 (file)
@@ -2,7 +2,8 @@
 
 import 'mocha'
 import * as chai from 'chai'
-import { buildAbsoluteFixturePath, CLICommand } from '@shared/server-commands'
+import { buildAbsoluteFixturePath } from '@shared/core-utils'
+import { CLICommand } from '@shared/server-commands'
 import { VideoResolution } from '../../../shared/models/videos'
 
 const expect = chai.expect
index e0bc6a58979146119e9dc5eb5f0843cfd5eaa8ac..8e8fc7e20c002195406b3e1425edac986d15bf31 100644 (file)
@@ -4,7 +4,8 @@ import 'mocha'
 import * as chai from 'chai'
 import { createFile, readdir } from 'fs-extra'
 import { join } from 'path'
-import { buildUUID } from '@shared/core-utils/uuid'
+import { buildUUID, wait } from '@shared/core-utils'
+import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
 import {
   cleanupTests,
   CLICommand,
@@ -15,10 +16,8 @@ import {
   PeerTubeServer,
   setAccessTokensToServers,
   setDefaultVideoChannel,
-  wait,
   waitJobs
 } from '@shared/server-commands'
-import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
 
 const expect = chai.expect
 
index 34dedb11368a18f952528a0092ce63132040a2ef..018e9d788bb11afcfab951a962bc0ebfecc32ec5 100644 (file)
@@ -1,5 +1,5 @@
 import 'mocha'
-import { cleanupTests, CLICommand, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '../../../shared/server-commands'
+import { cleanupTests, CLICommand, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
 
 describe('Test reset password scripts', function () {
   let server: PeerTubeServer
index 2f75ad25b5696904ea6e235a1675675a1348e36a..bc5c93621584aa562b3e6af0840b5855429b719e 100644 (file)
@@ -2,17 +2,17 @@
 
 import 'mocha'
 import { expect } from 'chai'
+import { wait } from '@shared/core-utils'
+import { Video } from '@shared/models'
 import {
   cleanupTests,
   createMultipleServers,
   doubleFollow,
   killallServers,
-  MockBlocklist,
   PeerTubeServer,
-  setAccessTokensToServers,
-  wait
+  setAccessTokensToServers
 } from '@shared/server-commands'
-import { Video } from '@shared/models'
+import { MockBlocklist } from '../shared'
 
 async function check (server: PeerTubeServer, videoUUID: string, exists = true) {
   const { data } = await server.videos.list()
index bfa67e7ad18b007468e1ba3505bd0c577128546e..375ccf91a382293243afd966baa651b7c8029558 100644 (file)
@@ -2,18 +2,18 @@
 
 import 'mocha'
 import { expect } from 'chai'
+import { wait } from '@shared/core-utils'
+import { HttpStatusCode } from '@shared/models'
 import {
   cleanupTests,
   createMultipleServers,
   doubleFollow,
   killallServers,
   makeGetRequest,
-  MockBlocklist,
   PeerTubeServer,
-  setAccessTokensToServers,
-  wait
+  setAccessTokensToServers
 } from '@shared/server-commands'
-import { HttpStatusCode } from '@shared/models'
+import { MockBlocklist } from '../shared'
 
 describe('Official plugin auto-mute', function () {
   const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list'
index 330139ee4ebb7fc1aa5d6e71f51b57b37be8045b..64bd373cc936c799373ea213e4c3b8a3447fc29d 100644 (file)
@@ -4,8 +4,8 @@ import 'mocha'
 import { expect } from 'chai'
 import { readFile, remove } from 'fs-extra'
 import { join } from 'path'
+import { buildAbsoluteFixturePath, root } from '@shared/core-utils'
 import { processImage } from '../../../server/helpers/image-utils'
-import { buildAbsoluteFixturePath, root } from '../../../shared/server-commands'
 
 async function checkBuffers (path1: string, path2: string, equals: boolean) {
   const [ buf1, buf2 ] = await Promise.all([
index db0cca39059eb1773e44fa9b932b74e77d19168e..de507ba35f85d18e3153cf8a884698b2c314706d 100644 (file)
@@ -4,9 +4,9 @@ import 'mocha'
 import { expect } from 'chai'
 import { pathExists, remove } from 'fs-extra'
 import { join } from 'path'
-import { Mock429 } from '@shared/server-commands/mock-servers/mock-429'
-import { FIXTURE_URLS, root, wait } from '../../../shared/server-commands'
+import { root, wait } from '@shared/core-utils'
 import { doRequest, doRequestAndSaveToFile } from '../../helpers/requests'
+import { FIXTURE_URLS, Mock429 } from '../shared'
 
 describe('Request helpers', function () {
   const destPath1 = join(root(), 'test-output-1.txt')
index a4a3764f551438cb7f4c3bedfb27e70714ed99cc..583100671cdd73118d9f41c26a0fb02077f412d5 100644 (file)
@@ -2,16 +2,16 @@
 
 import 'mocha'
 import { expect } from 'chai'
+import { wait } from '@shared/core-utils'
+import { HttpStatusCode, UserRole } from '@shared/models'
 import {
   cleanupTests,
   createSingleServer,
   decodeQueryString,
   PeerTubeServer,
   PluginsCommand,
-  setAccessTokensToServers,
-  wait
+  setAccessTokensToServers
 } from '@shared/server-commands'
-import { HttpStatusCode, UserRole } from '@shared/models'
 
 async function loginExternal (options: {
   server: PeerTubeServer
index a84edfac6833c2270aea69391cdbabcd91b3eb14..52ba396e559e9a255c500d7914fda3c99a1b7017 100644 (file)
@@ -2,11 +2,11 @@
 
 import 'mocha'
 import * as chai from 'chai'
+import { HttpStatusCode, VideoDetails, VideoImportState, VideoPlaylist, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'
 import {
   cleanupTests,
   createMultipleServers,
   doubleFollow,
-  FIXTURE_URLS,
   makeRawRequest,
   PeerTubeServer,
   PluginsCommand,
@@ -14,7 +14,7 @@ import {
   setDefaultVideoChannel,
   waitJobs
 } from '@shared/server-commands'
-import { HttpStatusCode, VideoDetails, VideoImportState, VideoPlaylist, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'
+import { FIXTURE_URLS } from '../shared'
 
 const expect = chai.expect
 
index 9e10d330204050eb27ff5ea4b1838bacf5c1fcb3..0a3a9c25f5f8a3e76ab276fadfe3627821bf2bf4 100644 (file)
@@ -9,7 +9,7 @@ import {
   PeerTubeServer,
   PluginsCommand,
   setAccessTokensToServers
-} from '../../../shared/server-commands'
+} from '@shared/server-commands'
 
 const expect = chai.expect
 
index ea3b0f6ab2c3f7653f141101f2402ebe6e0237ac..e72046ce25267ea807e3e6a579813a1d2eec1c15 100644 (file)
@@ -2,8 +2,9 @@
 
 import 'mocha'
 import { expect } from 'chai'
-import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers, wait } from '@shared/server-commands'
+import { wait } from '@shared/core-utils'
 import { HttpStatusCode, UserRole } from '@shared/models'
+import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers } from '@shared/server-commands'
 
 describe('Test id and pass auth plugins', function () {
   let server: PeerTubeServer
index 4ab4acd584c231b7594aeb66f7e417e4e3b8a3ec..167429ef4611d14e21360b7b7e32f5dc5a96cbf9 100644 (file)
@@ -3,8 +3,8 @@
 import 'mocha'
 import { expect } from 'chai'
 import { pathExists } from 'fs-extra'
+import { HttpStatusCode, ThumbnailType } from '@shared/models'
 import {
-  checkVideoFilesWereRemoved,
   cleanupTests,
   createMultipleServers,
   doubleFollow,
@@ -16,7 +16,7 @@ import {
   setAccessTokensToServers,
   waitJobs
 } from '@shared/server-commands'
-import { HttpStatusCode, ThumbnailType } from '@shared/models'
+import { checkVideoFilesWereRemoved } from '../shared'
 
 function postCommand (server: PeerTubeServer, command: string, bodyArg?: object) {
   const body = { command }
similarity index 97%
rename from shared/server-commands/users/actors.ts
rename to server/tests/shared/actors.ts
index 12c3e078a6c8784a0958bb9d3a56c83e4285db1b..f8f4a51370227abf4ca7d5d2c5be5857077fb7cd 100644 (file)
@@ -5,7 +5,7 @@ import { pathExists, readdir } from 'fs-extra'
 import { join } from 'path'
 import { root } from '@shared/core-utils'
 import { Account, VideoChannel } from '@shared/models'
-import { PeerTubeServer } from '../server'
+import { PeerTubeServer } from '@shared/server-commands'
 
 async function expectChannelsFollows (options: {
   server: PeerTubeServer
similarity index 63%
rename from shared/server-commands/miscs/checks.ts
rename to server/tests/shared/checks.ts
index 58992899780de339c0577662c4327e78094273ad..9ecc84b5d8d8ac602e9523ea50aad275ed8370b8 100644 (file)
@@ -5,8 +5,7 @@ import { pathExists, readFile } from 'fs-extra'
 import { join } from 'path'
 import { root } from '@shared/core-utils'
 import { HttpStatusCode } from '@shared/models'
-import { makeGetRequest } from '../requests'
-import { PeerTubeServer } from '../server'
+import { makeGetRequest, PeerTubeServer } from '@shared/server-commands'
 
 // Default interval -> 5 minutes
 function dateIsValid (dateString: string, interval = 300000) {
@@ -49,10 +48,51 @@ async function testFileExistsOrNot (server: PeerTubeServer, directory: string, f
   expect(await pathExists(join(base, filePath))).to.equal(exist)
 }
 
+function checkBadStartPagination (url: string, path: string, token?: string, query = {}) {
+  return makeGetRequest({
+    url,
+    path,
+    token,
+    query: { ...query, start: 'hello' },
+    expectedStatus: HttpStatusCode.BAD_REQUEST_400
+  })
+}
+
+async function checkBadCountPagination (url: string, path: string, token?: string, query = {}) {
+  await makeGetRequest({
+    url,
+    path,
+    token,
+    query: { ...query, count: 'hello' },
+    expectedStatus: HttpStatusCode.BAD_REQUEST_400
+  })
+
+  await makeGetRequest({
+    url,
+    path,
+    token,
+    query: { ...query, count: 2000 },
+    expectedStatus: HttpStatusCode.BAD_REQUEST_400
+  })
+}
+
+function checkBadSortPagination (url: string, path: string, token?: string, query = {}) {
+  return makeGetRequest({
+    url,
+    path,
+    token,
+    query: { ...query, sort: 'hello' },
+    expectedStatus: HttpStatusCode.BAD_REQUEST_400
+  })
+}
+
 export {
   dateIsValid,
   testImage,
   expectLogDoesNotContain,
   testFileExistsOrNot,
-  expectStartWith
+  expectStartWith,
+  checkBadStartPagination,
+  checkBadCountPagination,
+  checkBadSortPagination
 }
similarity index 95%
rename from shared/server-commands/server/directories.ts
rename to server/tests/shared/directories.ts
index e6f72d6fcbc0acabafd6cbe53ad6547fc6a4383e..c7065a767f6d04e3d4a26db14f3c15fad4118922 100644 (file)
@@ -4,7 +4,7 @@ import { expect } from 'chai'
 import { pathExists, readdir } from 'fs-extra'
 import { join } from 'path'
 import { root } from '@shared/core-utils'
-import { PeerTubeServer } from './server'
+import { PeerTubeServer } from '@shared/server-commands'
 
 async function checkTmpIsEmpty (server: PeerTubeServer) {
   await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ])
similarity index 94%
rename from shared/server-commands/miscs/generate.ts
rename to server/tests/shared/generate.ts
index 93673a0632f4d5b03e898c191e23172df422ff8d..f806df2f58705cf721f319657a6e9cb6a97b7f1a 100644 (file)
@@ -2,9 +2,8 @@ import { expect } from 'chai'
 import ffmpeg from 'fluent-ffmpeg'
 import { ensureDir, pathExists } from 'fs-extra'
 import { dirname } from 'path'
-import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '@shared/extra-utils/ffprobe'
-import { getMaxBitrate } from '@shared/core-utils'
-import { buildAbsoluteFixturePath } from './tests'
+import { buildAbsoluteFixturePath, getMaxBitrate } from '@shared/core-utils'
+import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '@shared/extra-utils'
 
 async function ensureHasTooBigBitrate (fixturePath: string) {
   const bitrate = await getVideoFileBitrate(fixturePath)
index 9388172684357c27f05a605f5657530fa60f4245..47019d6a8b8b72f46486c50455763570f4b0640a 100644 (file)
@@ -1,2 +1,15 @@
+export * from './mock-servers'
+export * from './actors'
+export * from './captions'
+export * from './checks'
+export * from './directories'
+export * from './generate'
+export * from './live'
+export * from './notifications'
+export * from './playlists'
+export * from './plugins'
 export * from './requests'
-export * from './video'
+export * from './streaming-playlists'
+export * from './tests'
+export * from './tracker'
+export * from './videos'
diff --git a/server/tests/shared/live.ts b/server/tests/shared/live.ts
new file mode 100644 (file)
index 0000000..72e3e27
--- /dev/null
@@ -0,0 +1,41 @@
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
+
+import { expect } from 'chai'
+import { pathExists, readdir } from 'fs-extra'
+import { join } from 'path'
+import { PeerTubeServer } from '@shared/server-commands'
+
+async function checkLiveCleanupAfterSave (server: PeerTubeServer, videoUUID: string, resolutions: number[] = []) {
+  const basePath = server.servers.buildDirectory('streaming-playlists')
+  const hlsPath = join(basePath, 'hls', videoUUID)
+
+  if (resolutions.length === 0) {
+    const result = await pathExists(hlsPath)
+    expect(result).to.be.false
+
+    return
+  }
+
+  const files = await readdir(hlsPath)
+
+  // fragmented file and playlist per resolution + master playlist + segments sha256 json file
+  expect(files).to.have.lengthOf(resolutions.length * 2 + 2)
+
+  for (const resolution of resolutions) {
+    const fragmentedFile = files.find(f => f.endsWith(`-${resolution}-fragmented.mp4`))
+    expect(fragmentedFile).to.exist
+
+    const playlistFile = files.find(f => f.endsWith(`${resolution}.m3u8`))
+    expect(playlistFile).to.exist
+  }
+
+  const masterPlaylistFile = files.find(f => f.endsWith('-master.m3u8'))
+  expect(masterPlaylistFile).to.exist
+
+  const shaFile = files.find(f => f.endsWith('-segments-sha256.json'))
+  expect(shaFile).to.exist
+}
+
+export {
+  checkLiveCleanupAfterSave
+}
similarity index 77%
rename from shared/server-commands/mock-servers/index.ts
rename to server/tests/shared/mock-servers/index.ts
index 93c00c78827833951842caa744ca0a0a599eaae4..abf4a8203b4e15869e07690557f65cf76e6d65ef 100644 (file)
@@ -1,5 +1,7 @@
+export * from './mock-429'
 export * from './mock-email'
 export * from './mock-instances-index'
 export * from './mock-joinpeertube-versions'
-export * from './mock-plugin-blocklist'
 export * from './mock-object-storage'
+export * from './mock-plugin-blocklist'
+export * from './mock-proxy'
similarity index 90%
rename from shared/server-commands/mock-servers/mock-429.ts
rename to server/tests/shared/mock-servers/mock-429.ts
index 9e0d1281aa4e0689dd4898065c5311397a8ae7c4..1fc20b079c14e4432c4cc21e9fa24989ed8297e3 100644 (file)
@@ -1,6 +1,6 @@
 import express from 'express'
 import { Server } from 'http'
-import { getPort, randomListen, terminateServer } from './utils'
+import { getPort, randomListen, terminateServer } from './shared'
 
 export class Mock429 {
   private server: Server
similarity index 93%
rename from shared/server-commands/mock-servers/mock-email.ts
rename to server/tests/shared/mock-servers/mock-email.ts
index f646c1621fba111c719fb71c22d4c75d15cb95ac..c518679c94c3250cb61a4ce0dd3636f2dab376bf 100644 (file)
@@ -1,7 +1,6 @@
 import { ChildProcess } from 'child_process'
 import MailDev from '@peertube/maildev'
-import { randomInt } from '@shared/core-utils'
-import { parallelTests } from '../miscs'
+import { parallelTests, randomInt } from '@shared/core-utils'
 
 class MockSmtpServer {
 
similarity index 94%
rename from shared/server-commands/mock-servers/mock-instances-index.ts
rename to server/tests/shared/mock-servers/mock-instances-index.ts
index 92b12d6f3d591fcecbaffddb3c63b64e8d3dcb37..598b007f12f984da7bc74cb5fffaec7ab8d7758a 100644 (file)
@@ -1,6 +1,6 @@
 import express from 'express'
 import { Server } from 'http'
-import { getPort, randomListen, terminateServer } from './utils'
+import { getPort, randomListen, terminateServer } from './shared'
 
 export class MockInstancesIndex {
   private server: Server
similarity index 94%
rename from shared/server-commands/mock-servers/mock-joinpeertube-versions.ts
rename to server/tests/shared/mock-servers/mock-joinpeertube-versions.ts
index e7906ea56f9a4ebbaa8f2debe50d46a93170b27e..502f4e2f5474002bb0feff27f3cafaf053bde28f 100644 (file)
@@ -1,6 +1,6 @@
 import express from 'express'
 import { Server } from 'http'
-import { getPort, randomListen } from './utils'
+import { getPort, randomListen } from './shared'
 
 export class MockJoinPeerTubeVersions {
   private server: Server
similarity index 88%
rename from shared/server-commands/mock-servers/mock-object-storage.ts
rename to server/tests/shared/mock-servers/mock-object-storage.ts
index d135c2631fe63b59932d9e8ed69145c99534700b..99d68e014596fc1adf9e52e827b104b78b60f012 100644 (file)
@@ -2,8 +2,8 @@ import express from 'express'
 import got, { RequestError } from 'got'
 import { Server } from 'http'
 import { pipeline } from 'stream'
-import { ObjectStorageCommand } from '../server'
-import { getPort, randomListen, terminateServer } from './utils'
+import { ObjectStorageCommand } from '@shared/server-commands'
+import { getPort, randomListen, terminateServer } from './shared'
 
 export class MockObjectStorage {
   private server: Server
similarity index 90%
rename from shared/server-commands/mock-servers/mock-plugin-blocklist.ts
rename to server/tests/shared/mock-servers/mock-plugin-blocklist.ts
index f8a271cba1a0ed7d6211e21e3dc41b772fd5585a..5d6e018164eef8fc8803bba9f1d649b644a5104c 100644 (file)
@@ -1,6 +1,6 @@
 import express, { Request, Response } from 'express'
 import { Server } from 'http'
-import { getPort, randomListen, terminateServer } from './utils'
+import { getPort, randomListen, terminateServer } from './shared'
 
 type BlocklistResponse = {
   data: {
similarity index 89%
rename from shared/server-commands/mock-servers/mock-proxy.ts
rename to server/tests/shared/mock-servers/mock-proxy.ts
index 75ac790551a274348481646c3d7b43daba38a19c..cbc7c446626a39da41c9669b7ef4bd40572f03cf 100644 (file)
@@ -1,7 +1,6 @@
-
 import { createServer, Server } from 'http'
 import proxy from 'proxy'
-import { getPort, terminateServer } from './utils'
+import { getPort, terminateServer } from './shared'
 
 class MockProxy {
   private server: Server
similarity index 98%
rename from shared/server-commands/users/notifications.ts
rename to server/tests/shared/notifications.ts
index 07ccb0f8dc826a8719bbd8b67140fbca22a2e000..cdc21fdc865284104600e0373eba591c0f316e7c 100644 (file)
@@ -2,13 +2,16 @@
 
 import { expect } from 'chai'
 import { inspect } from 'util'
-import { AbuseState, PluginType } from '@shared/models'
-import { UserNotification, UserNotificationSetting, UserNotificationSettingValue, UserNotificationType } from '../../models/users'
-import { MockSmtpServer } from '../mock-servers/mock-email'
-import { PeerTubeServer } from '../server'
-import { doubleFollow } from '../server/follows'
-import { createMultipleServers } from '../server/servers'
-import { setAccessTokensToServers } from './login'
+import {
+  AbuseState,
+  PluginType,
+  UserNotification,
+  UserNotificationSetting,
+  UserNotificationSettingValue,
+  UserNotificationType
+} from '@shared/models'
+import { createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
+import { MockSmtpServer } from './mock-servers'
 
 type CheckerBaseParams = {
   server: PeerTubeServer
similarity index 93%
rename from shared/server-commands/videos/playlists.ts
rename to server/tests/shared/playlists.ts
index 3dde52bb9478835458e17bb9b8939e0dec06aaf3..fdd541d20e25417144ba77b0da09d1c4c23e8d54 100644 (file)
@@ -1,7 +1,7 @@
 import { expect } from 'chai'
 import { readdir } from 'fs-extra'
 import { join } from 'path'
-import { root } from '../miscs'
+import { root } from '@shared/core-utils'
 
 async function checkPlaylistFilesWereRemoved (
   playlistUUID: string,
similarity index 91%
rename from shared/server-commands/server/plugins.ts
rename to server/tests/shared/plugins.ts
index c6316898dfaf5a1f4dcf9c87c75d754cbf966899..036fce2ff992fbe164d38744397467167807873b 100644 (file)
@@ -1,7 +1,7 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import { expect } from 'chai'
-import { PeerTubeServer } from './server'
+import { PeerTubeServer } from '@shared/server-commands'
 
 async function testHelloWorldRegisteredSettings (server: PeerTubeServer) {
   const body = await server.plugins.getRegisteredSettings({ npmName: 'peertube-plugin-hello-world' })
index 9eb5960298b74615554cea76295600d446a52bea..7f1acc0e1333cd88f487903a54e5314c931f04e4 100644 (file)
@@ -1,7 +1,7 @@
-import { doRequest } from '@server/helpers/requests'
 import { activityPubContextify } from '@server/helpers/activitypub'
-import { HTTP_SIGNATURE } from '@server/initializers/constants'
-import { buildGlobalHeaders } from '@server/lib/job-queue/handlers/utils/activitypub-http-utils'
+import { buildDigest } from '@server/helpers/peertube-crypto'
+import { doRequest } from '@server/helpers/requests'
+import { ACTIVITY_PUB, HTTP_SIGNATURE } from '@server/initializers/constants'
 
 export function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) {
   const options = {
@@ -31,7 +31,11 @@ export async function makeFollowRequest (to: { url: string }, by: { url: string,
     key: by.privateKey,
     headers: HTTP_SIGNATURE.HEADERS_TO_SIGN
   }
-  const headers = buildGlobalHeaders(body)
+  const headers = {
+    'digest': buildDigest(body),
+    'content-type': 'application/activity+json',
+    'accept': ACTIVITY_PUB.ACCEPT_HEADER
+  }
 
   return makePOSTAPRequest(to.url + '/inbox', body, httpSignature, headers)
 }
similarity index 95%
rename from shared/server-commands/videos/streaming-playlists.ts
rename to server/tests/shared/streaming-playlists.ts
index 0451c0efefb7b370fdd69d5165aaf85849df6c8e..738dc90e136549fa59dfb6e6d0b8a957655bdaa5 100644 (file)
@@ -1,9 +1,9 @@
 import { expect } from 'chai'
 import { basename } from 'path'
-import { sha256 } from '@shared/core-utils/crypto'
 import { removeFragmentedMP4Ext } from '@shared/core-utils'
+import { sha256 } from '@shared/core-utils/common/crypto'
 import { HttpStatusCode, VideoStreamingPlaylist } from '@shared/models'
-import { PeerTubeServer } from '../server'
+import { PeerTubeServer } from '@shared/server-commands'
 
 async function checkSegmentHash (options: {
   server: PeerTubeServer
diff --git a/server/tests/shared/tests.ts b/server/tests/shared/tests.ts
new file mode 100644 (file)
index 0000000..3abaf83
--- /dev/null
@@ -0,0 +1,37 @@
+const FIXTURE_URLS = {
+  peertube_long: 'https://peertube2.cpy.re/videos/watch/122d093a-1ede-43bd-bd34-59d2931ffc5e',
+  peertube_short: 'https://peertube2.cpy.re/w/3fbif9S3WmtTP8gGsC5HBd',
+
+  youtube: 'https://www.youtube.com/watch?v=msX3jv1XdvM',
+
+  /**
+   * The video is used to check format-selection correctness wrt. HDR,
+   * which brings its own set of oddities outside of a MediaSource.
+   *
+   * The video needs to have the following format_ids:
+   * (which you can check by using `youtube-dl <url> -F`):
+   * - (webm vp9)
+   * - (mp4 avc1)
+   * - (webm vp9.2 HDR)
+   */
+  youtubeHDR: 'https://www.youtube.com/watch?v=RQgnBB9z_N4',
+
+  // eslint-disable-next-line max-len
+  magnet: 'magnet:?xs=https%3A%2F%2Fpeertube2.cpy.re%2Flazy-static%2Ftorrents%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.torrent&xt=urn:btih:0f498834733e8057ed5c6f2ee2b4efd8d84a76ee&dn=super+peertube2+video&tr=https%3A%2F%2Fpeertube2.cpy.re%2Ftracker%2Fannounce&tr=wss%3A%2F%2Fpeertube2.cpy.re%3A443%2Ftracker%2Fsocket&ws=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Fwebseed%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.mp4',
+
+  badVideo: 'https://download.cpy.re/peertube/bad_video.mp4',
+  goodVideo: 'https://download.cpy.re/peertube/good_video.mp4',
+  goodVideo720: 'https://download.cpy.re/peertube/good_video_720.mp4',
+
+  file4K: 'https://download.cpy.re/peertube/4k_file.txt'
+}
+
+function buildRequestStub (): any {
+  return { }
+}
+
+export {
+  FIXTURE_URLS,
+
+  buildRequestStub
+}
similarity index 87%
rename from shared/server-commands/server/tracker.ts
rename to server/tests/shared/tracker.ts
index ed43a59245210b56ff917e3159025d1501d31d56..699895d5f327fcbc6d02631f3b7bbd513aa440f4 100644 (file)
@@ -1,6 +1,6 @@
 import { expect } from 'chai'
-import { sha1 } from '@shared/core-utils/crypto'
-import { makeGetRequest } from '../requests'
+import { sha1 } from '@shared/core-utils'
+import { makeGetRequest } from '@shared/server-commands'
 
 async function hlsInfohashExist (serverUrl: string, masterPlaylistUrl: string, fileNumber: number) {
   const path = '/tracker/announce'
similarity index 64%
rename from server/tests/shared/video.ts
rename to server/tests/shared/videos.ts
index cf923d4cd47793bfeeef44fd50be999fd5667295..6be094f2bfcea4f21311f31976da7382ef9874dc 100644 (file)
@@ -1,12 +1,17 @@
-/* eslint-disable @typescript-eslint/no-unused-expressions */
-import { dateIsValid, makeRawRequest, PeerTubeServer, testImage, webtorrentAdd } from '@shared/server-commands'
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */
+
 import { expect } from 'chai'
+import { pathExists, readdir } from 'fs-extra'
+import { basename, join } from 'path'
 import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '@server/initializers/constants'
 import { getLowercaseExtension, uuidRegex } from '@shared/core-utils'
+import { HttpStatusCode, VideoCaption, VideoDetails } from '@shared/models'
+import { makeRawRequest, PeerTubeServer, VideoEdit, waitJobs, webtorrentAdd } from '@shared/server-commands'
+import { dateIsValid, testImage } from './checks'
 
 loadLanguages()
 
-export async function completeVideoCheck (
+async function completeVideoCheck (
   server: PeerTubeServer,
   video: any,
   attributes: {
@@ -148,3 +153,99 @@ export async function completeVideoCheck (
     await testImage(server.url, attributes.previewfile, videoDetails.previewPath)
   }
 }
+
+async function checkVideoFilesWereRemoved (options: {
+  server: PeerTubeServer
+  video: VideoDetails
+  captions?: VideoCaption[]
+  onlyVideoFiles?: boolean // default false
+}) {
+  const { video, server, captions = [], onlyVideoFiles = false } = options
+
+  const webtorrentFiles = video.files || []
+  const hlsFiles = video.streamingPlaylists[0]?.files || []
+
+  const thumbnailName = basename(video.thumbnailPath)
+  const previewName = basename(video.previewPath)
+
+  const torrentNames = webtorrentFiles.concat(hlsFiles).map(f => basename(f.torrentUrl))
+
+  const captionNames = captions.map(c => basename(c.captionPath))
+
+  const webtorrentFilenames = webtorrentFiles.map(f => basename(f.fileUrl))
+  const hlsFilenames = hlsFiles.map(f => basename(f.fileUrl))
+
+  let directories: { [ directory: string ]: string[] } = {
+    videos: webtorrentFilenames,
+    redundancy: webtorrentFilenames,
+    [join('playlists', 'hls')]: hlsFilenames,
+    [join('redundancy', 'hls')]: hlsFilenames
+  }
+
+  if (onlyVideoFiles !== true) {
+    directories = {
+      ...directories,
+
+      thumbnails: [ thumbnailName ],
+      previews: [ previewName ],
+      torrents: torrentNames,
+      captions: captionNames
+    }
+  }
+
+  for (const directory of Object.keys(directories)) {
+    const directoryPath = server.servers.buildDirectory(directory)
+
+    const directoryExists = await pathExists(directoryPath)
+    if (directoryExists === false) continue
+
+    const existingFiles = await readdir(directoryPath)
+    for (const existingFile of existingFiles) {
+      for (const shouldNotExist of directories[directory]) {
+        expect(existingFile, `File ${existingFile} should not exist in ${directoryPath}`).to.not.contain(shouldNotExist)
+      }
+    }
+  }
+}
+
+async function saveVideoInServers (servers: PeerTubeServer[], uuid: string) {
+  for (const server of servers) {
+    server.store.videoDetails = await server.videos.get({ id: uuid })
+  }
+}
+
+function checkUploadVideoParam (
+  server: PeerTubeServer,
+  token: string,
+  attributes: Partial<VideoEdit>,
+  expectedStatus = HttpStatusCode.OK_200,
+  mode: 'legacy' | 'resumable' = 'legacy'
+) {
+  return mode === 'legacy'
+    ? server.videos.buildLegacyUpload({ token, attributes, expectedStatus })
+    : server.videos.buildResumeUpload({ token, attributes, expectedStatus })
+}
+
+// serverNumber starts from 1
+async function uploadRandomVideoOnServers (
+  servers: PeerTubeServer[],
+  serverNumber: number,
+  additionalParams?: VideoEdit & { prefixName?: string }
+) {
+  const server = servers.find(s => s.serverNumber === serverNumber)
+  const res = await server.videos.randomUpload({ wait: false, additionalParams })
+
+  await waitJobs(servers)
+
+  return res
+}
+
+// ---------------------------------------------------------------------------
+
+export {
+  completeVideoCheck,
+  checkUploadVideoParam,
+  uploadRandomVideoOnServers,
+  checkVideoFilesWereRemoved,
+  saveVideoInServers
+}
similarity index 72%
rename from shared/core-utils/crypto.ts
rename to shared/core-utils/common/crypto.ts
index d6d1150d0a6052059964f5bee5d72308b944011b..1a583f1a09f42a48d2d9d938097d2665afd73624 100644 (file)
@@ -8,7 +8,13 @@ function sha1 (str: string | Buffer, encoding: BinaryToTextEncoding = 'hex') {
   return createHash('sha1').update(str).digest(encoding)
 }
 
+// high excluded
+function randomInt (low: number, high: number) {
+  return Math.floor(Math.random() * (high - low) + low)
+}
+
 export {
+  randomInt,
   sha256,
   sha1
 }
diff --git a/shared/core-utils/common/env.ts b/shared/core-utils/common/env.ts
new file mode 100644 (file)
index 0000000..38c96b1
--- /dev/null
@@ -0,0 +1,30 @@
+function parallelTests () {
+  return process.env.MOCHA_PARALLEL === 'true'
+}
+
+function isGithubCI () {
+  return !!process.env.GITHUB_WORKSPACE
+}
+
+function areHttpImportTestsDisabled () {
+  const disabled = process.env.DISABLE_HTTP_IMPORT_TESTS === 'true'
+
+  if (disabled) console.log('DISABLE_HTTP_IMPORT_TESTS env set to "true" so import tests are disabled')
+
+  return disabled
+}
+
+function areObjectStorageTestsDisabled () {
+  const disabled = process.env.ENABLE_OBJECT_STORAGE_TESTS !== 'true'
+
+  if (disabled) console.log('ENABLE_OBJECT_STORAGE_TESTS env is not set to "true" so object storage tests are disabled')
+
+  return disabled
+}
+
+export {
+  parallelTests,
+  isGithubCI,
+  areHttpImportTestsDisabled,
+  areObjectStorageTestsDisabled
+}
index 5d35121484f37c809cb936b84320e9195b7e14d4..f9ba10d5e0d2ace55f42bc2549ca6b414c825a6a 100644 (file)
@@ -1,5 +1,11 @@
+export * from './array'
+export * from './crypto'
 export * from './date'
-export * from './miscs'
+export * from './env'
+export * from './object'
+export * from './path'
 export * from './regexp'
+export * from './time'
 export * from './promises'
 export * from './url'
+export * from './version'
diff --git a/shared/core-utils/common/object.ts b/shared/core-utils/common/object.ts
new file mode 100644 (file)
index 0000000..88d6b75
--- /dev/null
@@ -0,0 +1,30 @@
+function pick <O extends object, K extends keyof O> (object: O, keys: K[]): Pick<O, K> {
+  const result: any = {}
+
+  for (const key of keys) {
+    if (Object.prototype.hasOwnProperty.call(object, key)) {
+      result[key] = object[key]
+    }
+  }
+
+  return result
+}
+
+function sortObjectComparator (key: string, order: 'asc' | 'desc') {
+  return (a: any, b: any) => {
+    if (a[key] < b[key]) {
+      return order === 'asc' ? -1 : 1
+    }
+
+    if (a[key] > b[key]) {
+      return order === 'asc' ? 1 : -1
+    }
+
+    return 0
+  }
+}
+
+export {
+  pick,
+  sortObjectComparator
+}
similarity index 65%
rename from shared/core-utils/path.ts
rename to shared/core-utils/common/path.ts
index b1a45d69bae2e820fd1bf0a027bb7c108a6caa4b..ec507538b21ca1900ea9f7485a51826f31916b37 100644 (file)
@@ -7,6 +7,7 @@ function root () {
 
   rootPath = __dirname
 
+  if (basename(rootPath) === 'common') rootPath = resolve(rootPath, '..')
   if (basename(rootPath) === 'core-utils') rootPath = resolve(rootPath, '..')
   if (basename(rootPath) === 'shared') rootPath = resolve(rootPath, '..')
   if (basename(rootPath) === 'server') rootPath = resolve(rootPath, '..')
@@ -27,8 +28,19 @@ function getLowercaseExtension (filename: string) {
   return ext.toLowerCase()
 }
 
+function buildAbsoluteFixturePath (path: string, customCIPath = false) {
+  if (isAbsolute(path)) return path
+
+  if (customCIPath && process.env.GITHUB_WORKSPACE) {
+    return join(process.env.GITHUB_WORKSPACE, 'fixtures', path)
+  }
+
+  return join(root(), 'server', 'tests', 'fixtures', path)
+}
+
 export {
   root,
   buildPath,
+  buildAbsoluteFixturePath,
   getLowercaseExtension
 }
diff --git a/shared/core-utils/common/time.ts b/shared/core-utils/common/time.ts
new file mode 100644 (file)
index 0000000..2992609
--- /dev/null
@@ -0,0 +1,7 @@
+function wait (milliseconds: number) {
+  return new Promise(resolve => setTimeout(resolve, milliseconds))
+}
+
+export {
+  wait
+}
similarity index 53%
rename from shared/core-utils/common/miscs.ts
rename to shared/core-utils/common/version.ts
index bc65dc33863ebcf111d18e05b3a0f47287ce9473..8a64f8c4d02d4c145c138d0379432191baa36f35 100644 (file)
@@ -1,8 +1,3 @@
-// high excluded
-function randomInt (low: number, high: number) {
-  return Math.floor(Math.random() * (high - low) + low)
-}
-
 // Thanks https://stackoverflow.com/a/16187766
 function compareSemVer (a: string, b: string) {
   const regExStrip0 = /(\.0+)+$/
@@ -20,22 +15,6 @@ function compareSemVer (a: string, b: string) {
   return segmentsA.length - segmentsB.length
 }
 
-function sortObjectComparator (key: string, order: 'asc' | 'desc') {
-  return (a: any, b: any) => {
-    if (a[key] < b[key]) {
-      return order === 'asc' ? -1 : 1
-    }
-
-    if (a[key] > b[key]) {
-      return order === 'asc' ? 1 : -1
-    }
-
-    return 0
-  }
-}
-
 export {
-  randomInt,
-  compareSemVer,
-  sortObjectComparator
+  compareSemVer
 }
index ee5cd4412af1f4fcc98b88a27a15e306b51a77e1..8daaa2d04a125317a9893453fd1dea9a81c0e57d 100644 (file)
@@ -1,10 +1,7 @@
 export * from './abuse'
 export * from './common'
 export * from './i18n'
-export * from './path'
 export * from './plugins'
 export * from './renderer'
 export * from './users'
-export * from './utils'
 export * from './videos'
-export * from './uuid'
diff --git a/shared/core-utils/utils/index.ts b/shared/core-utils/utils/index.ts
deleted file mode 100644 (file)
index 8d16365..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './array'
-export * from './object'
diff --git a/shared/core-utils/utils/object.ts b/shared/core-utils/utils/object.ts
deleted file mode 100644 (file)
index 9a8a98f..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-function pick <O extends object, K extends keyof O> (object: O, keys: K[]): Pick<O, K> {
-  const result: any = {}
-
-  for (const key of keys) {
-    if (Object.prototype.hasOwnProperty.call(object, key)) {
-      result[key] = object[key]
-    }
-  }
-
-  return result
-}
-
-export {
-  pick
-}
index 620e3a716fd42f576b37b5189f1fe9a7997b30b7..8f6736d39d5022f7bb79cd53a4ad27fed6b3bca7 100644 (file)
@@ -1,2 +1,3 @@
 export * from './bitrate'
 export * from './privacy'
+export * from './uuid'
diff --git a/shared/extra-utils/file.ts b/shared/extra-utils/file.ts
new file mode 100644 (file)
index 0000000..8060ab5
--- /dev/null
@@ -0,0 +1,11 @@
+import { stat } from 'fs-extra'
+
+async function getFileSize (path: string) {
+  const stats = await stat(path)
+
+  return stats.size
+}
+
+export {
+  getFileSize
+}
index 5710c5ab501f64d12940bf814840b93c5bb53d94..38303cf1fa7521fedf7cc52a59e4e21d88b5cbb5 100644 (file)
@@ -1 +1,2 @@
 export * from './ffprobe'
+export * from './file'
index b61a8cd40a5fa23b6f2c49f6b0c2b2386c184be5..a24ffee962bd1950494f72a61716ffb16f862e36 100644 (file)
@@ -8,6 +8,7 @@ export * from './user-refresh-token.model'
 export * from './user-register.model'
 export * from './user-right.enum'
 export * from './user-role'
+export * from './user-scoped-token'
 export * from './user-update-me.model'
 export * from './user-update.model'
 export * from './user-video-quota.model'
index 4b3636d068d80a21dbcf90af368e89778beecb52..c24ebb2df295a4c53de538ca61980d483b23b962 100644 (file)
@@ -4,7 +4,6 @@ export * from './custom-pages'
 export * from './feeds'
 export * from './logs'
 export * from './miscs'
-export * from './mock-servers'
 export * from './moderation'
 export * from './overviews'
 export * from './requests'
index 7b5c66c0ccb6fb989a1688a5900f769808d60ad8..8f63383ea21a58fb50b62fa8bdc6a0ce76b7debe 100644 (file)
@@ -1,5 +1,4 @@
-import { HttpStatusCode } from '@shared/models'
-import { LogLevel } from '../../models/server/log-level.type'
+import { HttpStatusCode, LogLevel } from '@shared/models'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
 
 export class LogsCommand extends AbstractCommand {
index 4474661de8e1782a49d1e45e7886fddbfb8e085b..a1d14e9987aa43e6d5fd0ca216e4d7ba8d838723 100644 (file)
@@ -1,5 +1,2 @@
-export * from './checks'
-export * from './generate'
 export * from './sql-command'
-export * from './tests'
 export * from './webtorrent'
index bedb3349b4fd6b416389a45eae57eaed7415da96..09a99f8340066bdf2621d26b109ccc7a6b277ecf 100644 (file)
@@ -1,5 +1,5 @@
 import { QueryTypes, Sequelize } from 'sequelize'
-import { AbstractCommand } from '../shared/abstract-command'
+import { AbstractCommand } from '../shared'
 
 export class SQLCommand extends AbstractCommand {
   private sequelize: Sequelize
diff --git a/shared/server-commands/miscs/tests.ts b/shared/server-commands/miscs/tests.ts
deleted file mode 100644 (file)
index 658fe5f..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-import { stat } from 'fs-extra'
-import { basename, isAbsolute, join, resolve } from 'path'
-
-const FIXTURE_URLS = {
-  peertube_long: 'https://peertube2.cpy.re/videos/watch/122d093a-1ede-43bd-bd34-59d2931ffc5e',
-  peertube_short: 'https://peertube2.cpy.re/w/3fbif9S3WmtTP8gGsC5HBd',
-
-  youtube: 'https://www.youtube.com/watch?v=msX3jv1XdvM',
-
-  /**
-   * The video is used to check format-selection correctness wrt. HDR,
-   * which brings its own set of oddities outside of a MediaSource.
-   *
-   * The video needs to have the following format_ids:
-   * (which you can check by using `youtube-dl <url> -F`):
-   * - (webm vp9)
-   * - (mp4 avc1)
-   * - (webm vp9.2 HDR)
-   */
-  youtubeHDR: 'https://www.youtube.com/watch?v=RQgnBB9z_N4',
-
-  // eslint-disable-next-line max-len
-  magnet: 'magnet:?xs=https%3A%2F%2Fpeertube2.cpy.re%2Flazy-static%2Ftorrents%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.torrent&xt=urn:btih:0f498834733e8057ed5c6f2ee2b4efd8d84a76ee&dn=super+peertube2+video&tr=https%3A%2F%2Fpeertube2.cpy.re%2Ftracker%2Fannounce&tr=wss%3A%2F%2Fpeertube2.cpy.re%3A443%2Ftracker%2Fsocket&ws=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Fwebseed%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.mp4',
-
-  badVideo: 'https://download.cpy.re/peertube/bad_video.mp4',
-  goodVideo: 'https://download.cpy.re/peertube/good_video.mp4',
-  goodVideo720: 'https://download.cpy.re/peertube/good_video_720.mp4',
-
-  file4K: 'https://download.cpy.re/peertube/4k_file.txt'
-}
-
-function parallelTests () {
-  return process.env.MOCHA_PARALLEL === 'true'
-}
-
-function isGithubCI () {
-  return !!process.env.GITHUB_WORKSPACE
-}
-
-function areHttpImportTestsDisabled () {
-  const disabled = process.env.DISABLE_HTTP_IMPORT_TESTS === 'true'
-
-  if (disabled) console.log('DISABLE_HTTP_IMPORT_TESTS env set to "true" so import tests are disabled')
-
-  return disabled
-}
-
-function areObjectStorageTestsDisabled () {
-  const disabled = process.env.ENABLE_OBJECT_STORAGE_TESTS !== 'true'
-
-  if (disabled) console.log('ENABLE_OBJECT_STORAGE_TESTS env is not set to "true" so object storage tests are disabled')
-
-  return disabled
-}
-
-function buildAbsoluteFixturePath (path: string, customCIPath = false) {
-  if (isAbsolute(path)) return path
-
-  if (customCIPath && process.env.GITHUB_WORKSPACE) {
-    return join(process.env.GITHUB_WORKSPACE, 'fixtures', path)
-  }
-
-  return join(root(), 'server', 'tests', 'fixtures', path)
-}
-
-function root () {
-  // We are in /miscs
-  let root = join(__dirname, '..', '..', '..')
-
-  if (basename(root) === 'dist') root = resolve(root, '..')
-
-  return root
-}
-
-function wait (milliseconds: number) {
-  return new Promise(resolve => setTimeout(resolve, milliseconds))
-}
-
-async function getFileSize (path: string) {
-  const stats = await stat(path)
-
-  return stats.size
-}
-
-function buildRequestStub (): any {
-  return { }
-}
-
-export {
-  FIXTURE_URLS,
-
-  parallelTests,
-  isGithubCI,
-  areHttpImportTestsDisabled,
-  buildAbsoluteFixturePath,
-  getFileSize,
-  buildRequestStub,
-  areObjectStorageTestsDisabled,
-  wait,
-  root
-}
diff --git a/shared/server-commands/requests/check-api-params.ts b/shared/server-commands/requests/check-api-params.ts
deleted file mode 100644 (file)
index 26ba1e9..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-import { HttpStatusCode } from '@shared/models'
-import { makeGetRequest } from './requests'
-
-function checkBadStartPagination (url: string, path: string, token?: string, query = {}) {
-  return makeGetRequest({
-    url,
-    path,
-    token,
-    query: { ...query, start: 'hello' },
-    expectedStatus: HttpStatusCode.BAD_REQUEST_400
-  })
-}
-
-async function checkBadCountPagination (url: string, path: string, token?: string, query = {}) {
-  await makeGetRequest({
-    url,
-    path,
-    token,
-    query: { ...query, count: 'hello' },
-    expectedStatus: HttpStatusCode.BAD_REQUEST_400
-  })
-
-  await makeGetRequest({
-    url,
-    path,
-    token,
-    query: { ...query, count: 2000 },
-    expectedStatus: HttpStatusCode.BAD_REQUEST_400
-  })
-}
-
-function checkBadSortPagination (url: string, path: string, token?: string, query = {}) {
-  return makeGetRequest({
-    url,
-    path,
-    token,
-    query: { ...query, sort: 'hello' },
-    expectedStatus: HttpStatusCode.BAD_REQUEST_400
-  })
-}
-
-// ---------------------------------------------------------------------------
-
-export {
-  checkBadStartPagination,
-  checkBadCountPagination,
-  checkBadSortPagination
-}
index 501163f92b503f2560afe8a37a265bf656c8e7f7..80298230120c3b6007d2dc1df71c9285bc18c174 100644 (file)
@@ -1,3 +1 @@
-// Don't include activitypub that import stuff from server
-export * from './check-api-params'
 export * from './requests'
index b6b9024ed1460e14e93e1fff336df54d54063ade..95e4fe6b1eb0cb1e69cded49ad33d8389b68832e 100644 (file)
@@ -3,8 +3,8 @@
 import { decode } from 'querystring'
 import request from 'supertest'
 import { URL } from 'url'
+import { buildAbsoluteFixturePath } from '@shared/core-utils'
 import { HttpStatusCode } from '@shared/models'
-import { buildAbsoluteFixturePath } from '../miscs/tests'
 
 export type CommonRequestParams = {
   url: string
index 89ae8eb4f69da3dd5e483594b2a2b2eb61f27403..797231b1d2edadf2fe785daf46a60ea590edae5d 100644 (file)
@@ -1,8 +1,7 @@
 import { merge } from 'lodash'
+import { About, CustomConfig, HttpStatusCode, ServerConfig } from '@shared/models'
 import { DeepPartial } from '@shared/typescript-utils'
-import { About, HttpStatusCode, ServerConfig } from '@shared/models'
-import { CustomConfig } from '../../models/server/custom-config.model'
-import { AbstractCommand, OverrideCommandOptions } from '../shared'
+import { AbstractCommand, OverrideCommandOptions } from '../shared/abstract-command'
 
 export class ConfigCommand extends AbstractCommand {
 
index 76a2099da6ca11064c6fd3e08f770d76d2ede3fd..0a4b21fc46965db6392f470b2b35d76fe4783aa6 100644 (file)
@@ -1,17 +1,14 @@
 export * from './config-command'
 export * from './contact-form-command'
 export * from './debug-command'
-export * from './directories'
 export * from './follows-command'
 export * from './follows'
 export * from './jobs'
 export * from './jobs-command'
 export * from './object-storage-command'
 export * from './plugins-command'
-export * from './plugins'
 export * from './redundancy-command'
 export * from './server'
 export * from './servers-command'
 export * from './servers'
 export * from './stats-command'
-export * from './tracker'
index 6636e7e4d35a362c0e6cc7f71095837e9a0152ec..ac62157d1d4fa1410e0258f02d4e0c2e22814ac2 100644 (file)
@@ -1,6 +1,5 @@
 import { pick } from '@shared/core-utils'
-import { HttpStatusCode } from '@shared/models'
-import { Job, JobState, JobType, ResultList } from '../../models'
+import { HttpStatusCode, Job, JobState, JobType, ResultList } from '@shared/models'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
 
 export class JobsCommand extends AbstractCommand {
index 34fefd4442d28fa9d158ae3021deb2dde99b6014..fc65a873b10e177cf2c60f07859f32a7c7c43b0d 100644 (file)
@@ -1,7 +1,7 @@
 
 import { expect } from 'chai'
+import { wait } from '@shared/core-utils'
 import { JobState, JobType } from '../../models'
-import { wait } from '../miscs'
 import { PeerTubeServer } from './server'
 
 async function waitJobs (serversArg: PeerTubeServer[] | PeerTubeServer, skipDelayed = false) {
index 339b9cabb8a13abb14b63e0a89cd80f7e3de5b65..617069b11fbae440fb2561ea6e670325fc37aac7 100644 (file)
@@ -1,14 +1,14 @@
 import { ChildProcess, fork } from 'child_process'
 import { copy } from 'fs-extra'
 import { join } from 'path'
-import { root, randomInt } from '@shared/core-utils'
-import { Video, VideoChannel, VideoCreateResult, VideoDetails } from '../../models/videos'
+import { parallelTests, randomInt, root } from '@shared/core-utils'
+import { Video, VideoChannel, VideoCreateResult, VideoDetails } from '@shared/models'
 import { BulkCommand } from '../bulk'
 import { CLICommand } from '../cli'
 import { CustomPagesCommand } from '../custom-pages'
 import { FeedCommand } from '../feeds'
 import { LogsCommand } from '../logs'
-import { parallelTests, SQLCommand } from '../miscs'
+import { SQLCommand } from '../miscs'
 import { AbusesCommand } from '../moderation'
 import { OverviewsCommand } from '../overviews'
 import { SearchCommand } from '../search'
@@ -33,11 +33,11 @@ import { ContactFormCommand } from './contact-form-command'
 import { DebugCommand } from './debug-command'
 import { FollowsCommand } from './follows-command'
 import { JobsCommand } from './jobs-command'
+import { ObjectStorageCommand } from './object-storage-command'
 import { PluginsCommand } from './plugins-command'
 import { RedundancyCommand } from './redundancy-command'
 import { ServersCommand } from './servers-command'
 import { StatsCommand } from './stats-command'
-import { ObjectStorageCommand } from './object-storage-command'
 
 export type RunServerOptions = {
   hideLogs?: boolean
index 47420c95f209891574bebc798d97e2965ef1c104..c5d8d18dcf10b9026277e1a378dbdffc412c60b8 100644 (file)
@@ -1,9 +1,9 @@
 import { exec } from 'child_process'
 import { copy, ensureDir, readFile, remove } from 'fs-extra'
 import { basename, join } from 'path'
-import { root } from '@shared/core-utils'
+import { isGithubCI, root, wait } from '@shared/core-utils'
+import { getFileSize } from '@shared/extra-utils'
 import { HttpStatusCode } from '@shared/models'
-import { getFileSize, isGithubCI, wait } from '../miscs'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
 
 export class ServersCommand extends AbstractCommand {
index 21ab9405b5940dbbf1f03877ebfe2e2d623720f2..0faee3a8d4a2dd173b3ed8756acc01790417ebde 100644 (file)
@@ -1,5 +1,5 @@
 import { ensureDir } from 'fs-extra'
-import { isGithubCI } from '../miscs'
+import { isGithubCI } from '@shared/core-utils'
 import { PeerTubeServer, RunServerOptions } from './server'
 
 async function createSingleServer (serverNumber: number, configOverride?: Object, options: RunServerOptions = {}) {
index a57c857fcf9c2fd37bda3a71f7080f8de6311d61..1b53a53305d89cbc389adf655d288ad1287340e5 100644 (file)
@@ -1,5 +1,5 @@
 import { isAbsolute, join } from 'path'
-import { root } from '../miscs/tests'
+import { root } from '@shared/core-utils'
 import {
   makeDeleteRequest,
   makeGetRequest,
index 98d9d59271d3b0416a4b4e44d48000beaf9b1439..5844b330b9327adc8c49ffeba06696552300f30d 100644 (file)
@@ -1,6 +1,4 @@
-import { HttpStatusCode, ResultList } from '@shared/models'
-import { Account, ActorFollow } from '../../models/actors'
-import { AccountVideoRate, VideoRateType } from '../../models/videos'
+import { Account, AccountVideoRate, ActorFollow, HttpStatusCode, ResultList, VideoRateType } from '@shared/models'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
 
 export class AccountsCommand extends AbstractCommand {
index 460a06f7026c3909cdd9df8b2fe6b87c08b7ffe2..c2bc5c44f6e71dbd9795085d7a7d1098c10072cd 100644 (file)
@@ -1,9 +1,7 @@
 export * from './accounts-command'
-export * from './actors'
 export * from './blocklist-command'
 export * from './login'
 export * from './login-command'
-export * from './notifications'
 export * from './notifications-command'
 export * from './subscriptions-command'
 export * from './users-command'
index 692420b8b5cd380568e84b0283df97a023514537..6bd815daa2f9ff761db903ec7ea219b86fd9394e 100644 (file)
@@ -1,5 +1,4 @@
-import { HttpStatusCode, ResultList } from '@shared/models'
-import { UserNotification, UserNotificationSetting } from '../../models/users'
+import { HttpStatusCode, ResultList, UserNotification, UserNotificationSetting } from '@shared/models'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
 
 export class NotificationsCommand extends AbstractCommand {
index 90c5f218340aefe38c9764f41761be7a6d077ab6..b5ae9008e4ce63b631aa797e0e0a99e2d9b837f4 100644 (file)
@@ -4,6 +4,7 @@ import {
   HttpStatusCode,
   MyUser,
   ResultList,
+  ScopedToken,
   User,
   UserAdminFlag,
   UserCreateResult,
@@ -13,7 +14,6 @@ import {
   UserVideoQuota,
   UserVideoRate
 } from '@shared/models'
-import { ScopedToken } from '@shared/models/users/user-scoped-token'
 import { unwrapBody } from '../requests'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
 
index 3a2ef89ba1c9d9afd8cdc228a1f0e590ae5a01eb..47e23ebc8ec4c8128c012fffbb233fcf00e1f835 100644 (file)
@@ -1,6 +1,5 @@
 
-import { HttpStatusCode, ResultList } from '@shared/models'
-import { VideoBlacklist, VideoBlacklistType } from '../../models/videos'
+import { HttpStatusCode, ResultList, VideoBlacklist, VideoBlacklistType } from '@shared/models'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
 
 export class BlacklistCommand extends AbstractCommand {
index a65ea99e33dab71ccb1b15be2c130f18376b03e5..62bf9c5e60dfb110da65d71e7679466042fbd65c 100644 (file)
@@ -1,5 +1,5 @@
+import { buildAbsoluteFixturePath } from '@shared/core-utils'
 import { HttpStatusCode, ResultList, VideoCaption } from '@shared/models'
-import { buildAbsoluteFixturePath } from '../miscs'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
 
 export class CaptionsCommand extends AbstractCommand {
index e406e570b965ce8b75e9a6014cdd93f920838d4c..8ab1246581643639a0a378cd2931d949fd06b808 100644 (file)
@@ -1,7 +1,13 @@
 import { pick } from '@shared/core-utils'
-import { ActorFollow, HttpStatusCode, ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models'
-import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model'
-import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model'
+import {
+  ActorFollow,
+  HttpStatusCode,
+  ResultList,
+  VideoChannel,
+  VideoChannelCreate,
+  VideoChannelCreateResult,
+  VideoChannelUpdate
+} from '@shared/models'
 import { unwrapBody } from '../requests'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
 
index 26e663f4664e0d25834ff3c8c85ece1181226046..68a188b2116277329c1e020c12d2c6404acc2394 100644 (file)
@@ -1,6 +1,5 @@
 export * from './blacklist-command'
 export * from './captions-command'
-export * from './captions'
 export * from './change-ownership-command'
 export * from './channels'
 export * from './channels-command'
@@ -10,10 +9,7 @@ export * from './imports-command'
 export * from './live-command'
 export * from './live'
 export * from './playlists-command'
-export * from './playlists'
 export * from './services-command'
 export * from './streaming-playlists-command'
-export * from './streaming-playlists'
 export * from './comments-command'
 export * from './videos-command'
-export * from './videos'
index 74f5d30899ceadc53a2c1d8ee6a2338fb5ddeeda..f7816eca0d592292b5d2eb32ff6d672a378f9d3f 100644 (file)
@@ -3,8 +3,8 @@
 import { readdir } from 'fs-extra'
 import { omit } from 'lodash'
 import { join } from 'path'
+import { wait } from '@shared/core-utils'
 import { HttpStatusCode, LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models'
-import { wait } from '../miscs'
 import { unwrapBody } from '../requests'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
 import { sendRTMPStream, testFfmpegStreamError } from './live'
index d3665bc9082e93a955e10cc52d69c886a42ced15..7a7faa9115fa147d999094ac27dda1c6597ae728 100644 (file)
@@ -1,10 +1,5 @@
-/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-
-import { expect } from 'chai'
 import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg'
-import { pathExists, readdir } from 'fs-extra'
-import { join } from 'path'
-import { buildAbsoluteFixturePath, wait } from '../miscs'
+import { buildAbsoluteFixturePath, wait } from '@shared/core-utils'
 import { PeerTubeServer } from '../server/server'
 
 function sendRTMPStream (options: {
@@ -95,43 +90,11 @@ async function waitUntilLiveSavedOnAllServers (servers: PeerTubeServer[], videoI
   }
 }
 
-async function checkLiveCleanupAfterSave (server: PeerTubeServer, videoUUID: string, resolutions: number[] = []) {
-  const basePath = server.servers.buildDirectory('streaming-playlists')
-  const hlsPath = join(basePath, 'hls', videoUUID)
-
-  if (resolutions.length === 0) {
-    const result = await pathExists(hlsPath)
-    expect(result).to.be.false
-
-    return
-  }
-
-  const files = await readdir(hlsPath)
-
-  // fragmented file and playlist per resolution + master playlist + segments sha256 json file
-  expect(files).to.have.lengthOf(resolutions.length * 2 + 2)
-
-  for (const resolution of resolutions) {
-    const fragmentedFile = files.find(f => f.endsWith(`-${resolution}-fragmented.mp4`))
-    expect(fragmentedFile).to.exist
-
-    const playlistFile = files.find(f => f.endsWith(`${resolution}.m3u8`))
-    expect(playlistFile).to.exist
-  }
-
-  const masterPlaylistFile = files.find(f => f.endsWith('-master.m3u8'))
-  expect(masterPlaylistFile).to.exist
-
-  const shaFile = files.find(f => f.endsWith('-segments-sha256.json'))
-  expect(shaFile).to.exist
-}
-
 export {
   sendRTMPStream,
   waitFfmpegUntilError,
   testFfmpegStreamError,
   stopFfmpeg,
   waitUntilLivePublishedOnAllServers,
-  waitUntilLiveSavedOnAllServers,
-  checkLiveCleanupAfterSave
+  waitUntilLiveSavedOnAllServers
 }
index 8ea828b40dbc13ffb723d6594451ace77d1740e5..ead57b9aa6a9d87a4105c6627b68703a29e13d39 100644 (file)
@@ -5,8 +5,7 @@ import { createReadStream, stat } from 'fs-extra'
 import got, { Response as GotResponse } from 'got'
 import { omit } from 'lodash'
 import validator from 'validator'
-import { buildUUID } from '@shared/core-utils/uuid'
-import { pick } from '@shared/core-utils'
+import { buildAbsoluteFixturePath, buildUUID, pick, wait } from '@shared/core-utils'
 import {
   HttpStatusCode,
   ResultList,
@@ -20,7 +19,6 @@ import {
   VideosCommonQuery,
   VideoTranscodingCreate
 } from '@shared/models'
-import { buildAbsoluteFixturePath, wait } from '../miscs'
 import { unwrapBody } from '../requests'
 import { waitJobs } from '../server'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/server-commands/videos/videos.ts b/shared/server-commands/videos/videos.ts
deleted file mode 100644 (file)
index 2c3464a..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */
-
-import { expect } from 'chai'
-import { pathExists, readdir } from 'fs-extra'
-import { basename, join } from 'path'
-import { HttpStatusCode, VideoCaption, VideoDetails } from '@shared/models'
-import { waitJobs } from '../server'
-import { PeerTubeServer } from '../server/server'
-import { VideoEdit } from './videos-command'
-
-async function checkVideoFilesWereRemoved (options: {
-  server: PeerTubeServer
-  video: VideoDetails
-  captions?: VideoCaption[]
-  onlyVideoFiles?: boolean // default false
-}) {
-  const { video, server, captions = [], onlyVideoFiles = false } = options
-
-  const webtorrentFiles = video.files || []
-  const hlsFiles = video.streamingPlaylists[0]?.files || []
-
-  const thumbnailName = basename(video.thumbnailPath)
-  const previewName = basename(video.previewPath)
-
-  const torrentNames = webtorrentFiles.concat(hlsFiles).map(f => basename(f.torrentUrl))
-
-  const captionNames = captions.map(c => basename(c.captionPath))
-
-  const webtorrentFilenames = webtorrentFiles.map(f => basename(f.fileUrl))
-  const hlsFilenames = hlsFiles.map(f => basename(f.fileUrl))
-
-  let directories: { [ directory: string ]: string[] } = {
-    videos: webtorrentFilenames,
-    redundancy: webtorrentFilenames,
-    [join('playlists', 'hls')]: hlsFilenames,
-    [join('redundancy', 'hls')]: hlsFilenames
-  }
-
-  if (onlyVideoFiles !== true) {
-    directories = {
-      ...directories,
-
-      thumbnails: [ thumbnailName ],
-      previews: [ previewName ],
-      torrents: torrentNames,
-      captions: captionNames
-    }
-  }
-
-  for (const directory of Object.keys(directories)) {
-    const directoryPath = server.servers.buildDirectory(directory)
-
-    const directoryExists = await pathExists(directoryPath)
-    if (directoryExists === false) continue
-
-    const existingFiles = await readdir(directoryPath)
-    for (const existingFile of existingFiles) {
-      for (const shouldNotExist of directories[directory]) {
-        expect(existingFile, `File ${existingFile} should not exist in ${directoryPath}`).to.not.contain(shouldNotExist)
-      }
-    }
-  }
-}
-
-async function saveVideoInServers (servers: PeerTubeServer[], uuid: string) {
-  for (const server of servers) {
-    server.store.videoDetails = await server.videos.get({ id: uuid })
-  }
-}
-
-function checkUploadVideoParam (
-  server: PeerTubeServer,
-  token: string,
-  attributes: Partial<VideoEdit>,
-  expectedStatus = HttpStatusCode.OK_200,
-  mode: 'legacy' | 'resumable' = 'legacy'
-) {
-  return mode === 'legacy'
-    ? server.videos.buildLegacyUpload({ token, attributes, expectedStatus })
-    : server.videos.buildResumeUpload({ token, attributes, expectedStatus })
-}
-
-// serverNumber starts from 1
-async function uploadRandomVideoOnServers (
-  servers: PeerTubeServer[],
-  serverNumber: number,
-  additionalParams?: VideoEdit & { prefixName?: string }
-) {
-  const server = servers.find(s => s.serverNumber === serverNumber)
-  const res = await server.videos.randomUpload({ wait: false, additionalParams })
-
-  await waitJobs(servers)
-
-  return res
-}
-
-// ---------------------------------------------------------------------------
-
-export {
-  checkUploadVideoParam,
-  uploadRandomVideoOnServers,
-  checkVideoFilesWereRemoved,
-  saveVideoInServers
-}