Move test functions outside extra-utils

This commit is contained in:
Chocobozzz 2021-12-17 11:58:15 +01:00
parent bf54587a3e
commit c55e3d7227
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
202 changed files with 798 additions and 895 deletions

View File

@ -1,13 +1,13 @@
import express from 'express' import express from 'express'
import RateLimit from 'express-rate-limit' import RateLimit from 'express-rate-limit'
import { logger } from '@server/helpers/logger' import { logger } from '@server/helpers/logger'
import { buildUUID } from '@shared/core-utils/uuid'
import { CONFIG } from '@server/initializers/config' import { CONFIG } from '@server/initializers/config'
import { getAuthNameFromRefreshGrant, getBypassFromExternalAuth, getBypassFromPasswordGrant } from '@server/lib/auth/external-auth' import { getAuthNameFromRefreshGrant, getBypassFromExternalAuth, getBypassFromPasswordGrant } from '@server/lib/auth/external-auth'
import { handleOAuthToken } from '@server/lib/auth/oauth' import { handleOAuthToken } from '@server/lib/auth/oauth'
import { BypassLogin, revokeToken } from '@server/lib/auth/oauth-model' import { BypassLogin, revokeToken } from '@server/lib/auth/oauth-model'
import { Hooks } from '@server/lib/plugins/hooks' import { Hooks } from '@server/lib/plugins/hooks'
import { asyncMiddleware, authenticate, openapiOperationDoc } from '@server/middlewares' import { asyncMiddleware, authenticate, openapiOperationDoc } from '@server/middlewares'
import { buildUUID } from '@shared/core-utils'
import { ScopedToken } from '@shared/models/users/user-scoped-token' import { ScopedToken } from '@shared/models/users/user-scoped-token'
const tokensRouter = express.Router() const tokensRouter = express.Router()

View File

@ -1,10 +1,10 @@
import express from 'express' import express from 'express'
import { join } from 'path' import { join } from 'path'
import { uuidToShort } from '@shared/core-utils/uuid'
import { scheduleRefreshIfNeeded } from '@server/lib/activitypub/playlists' import { scheduleRefreshIfNeeded } from '@server/lib/activitypub/playlists'
import { Hooks } from '@server/lib/plugins/hooks' import { Hooks } from '@server/lib/plugins/hooks'
import { getServerActor } from '@server/models/application/application' import { getServerActor } from '@server/models/application/application'
import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models' import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models'
import { uuidToShort } from '@shared/core-utils'
import { VideoPlaylistCreateResult, VideoPlaylistElementCreateResult } from '@shared/models' import { VideoPlaylistCreateResult, VideoPlaylistElementCreateResult } from '@shared/models'
import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
import { VideoPlaylistCreate } from '../../../shared/models/videos/playlist/video-playlist-create.model' import { VideoPlaylistCreate } from '../../../shared/models/videos/playlist/video-playlist-create.model'

View File

@ -1,6 +1,5 @@
import express from 'express' import express from 'express'
import { createReqFiles } from '@server/helpers/express-utils' import { createReqFiles } from '@server/helpers/express-utils'
import { buildUUID, uuidToShort } from '@shared/core-utils/uuid'
import { CONFIG } from '@server/initializers/config' import { CONFIG } from '@server/initializers/config'
import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants'
import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' 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 { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator } from '@server/middlewares/validators/videos/video-live'
import { VideoLiveModel } from '@server/models/video/video-live' import { VideoLiveModel } from '@server/models/video/video-live'
import { MVideoDetails, MVideoFullLight } from '@server/types/models' import { MVideoDetails, MVideoFullLight } from '@server/types/models'
import { buildUUID, uuidToShort } from '@shared/core-utils'
import { LiveVideoCreate, LiveVideoUpdate, VideoState } from '../../../../shared' import { LiveVideoCreate, LiveVideoUpdate, VideoState } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'

View File

@ -1,9 +1,7 @@
import express from 'express' import express from 'express'
import { move } from 'fs-extra' import { move } from 'fs-extra'
import { basename } from 'path' import { basename } from 'path'
import { getLowercaseExtension } from '@shared/core-utils'
import { getResumableUploadPath } from '@server/helpers/upload' import { getResumableUploadPath } from '@server/helpers/upload'
import { uuidToShort } from '@shared/core-utils/uuid'
import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url'
import { generateWebTorrentVideoFilename } from '@server/lib/paths' 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 { buildNextVideoState } from '@server/lib/video-state'
import { openapiOperationDoc } from '@server/middlewares/doc' import { openapiOperationDoc } from '@server/middlewares/doc'
import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
import { getLowercaseExtension, uuidToShort } from '@shared/core-utils'
import { VideoCreate, VideoState } from '../../../../shared' import { VideoCreate, VideoState } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/models' import { HttpStatusCode } from '../../../../shared/models'
import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'

View File

@ -2,7 +2,7 @@ import 'multer'
import { UploadFilesForCheck } from 'express' import { UploadFilesForCheck } from 'express'
import { sep } from 'path' import { sep } from 'path'
import validator from 'validator' import validator from 'validator'
import { isShortUUID, shortToUUID } from '@shared/core-utils/uuid' import { isShortUUID, shortToUUID } from '@shared/core-utils'
function exists (value: any) { function exists (value: any) {
return value !== undefined && value !== null return value !== undefined && value !== null

View File

@ -1,9 +1,8 @@
import { copy, readFile, remove, rename } from 'fs-extra' import { copy, readFile, remove, rename } from 'fs-extra'
import Jimp, { read } from 'jimp' 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 { convertWebPToJPG, processGIF } from './ffmpeg-utils'
import { logger } from './logger' import { logger } from './logger'
import { buildUUID } from '@shared/core-utils/uuid'
function generateImageFilename (extension = '.jpg') { function generateImageFilename (extension = '.jpg') {
return buildUUID() + extension return buildUUID() + extension

View File

@ -4,7 +4,7 @@ import { Request } from 'express'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'
import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants' import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants'
import { MActor } from '../types/models' 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 { createPrivateKey, getPublicKey, promisify1, promisify2 } from './core-utils'
import { jsonld } from './custom-jsonld-signature' import { jsonld } from './custom-jsonld-signature'
import { logger } from './logger' import { logger } from './logger'

View File

@ -3,7 +3,7 @@ import { Instance as ParseTorrent } from 'parse-torrent'
import { join } from 'path' import { join } from 'path'
import { ResultList } from '../../shared' import { ResultList } from '../../shared'
import { CONFIG } from '../initializers/config' 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 { execPromise, execPromise2, randomBytesPromise } from './core-utils'
import { logger } from './logger' import { logger } from './logger'

View File

@ -15,7 +15,7 @@ import { MVideoFile, MVideoFileRedundanciesOpt } from '@server/types/models/vide
import { MStreamingPlaylistVideo } from '@server/types/models/video/video-streaming-playlist' import { MStreamingPlaylistVideo } from '@server/types/models/video/video-streaming-playlist'
import { CONFIG } from '../initializers/config' import { CONFIG } from '../initializers/config'
import { promisify2 } from './core-utils' 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 { logger } from './logger'
import { generateVideoImportTmpPath } from './utils' import { generateVideoImportTmpPath } from './utils'
import { extractVideo } from './video' import { extractVideo } from './video'

View File

@ -2,7 +2,7 @@ import { CronRepeatOptions, EveryRepeatOptions } from 'bull'
import { randomBytes } from 'crypto' import { randomBytes } from 'crypto'
import { invert } from 'lodash' import { invert } from 'lodash'
import { join } from 'path' import { join } from 'path'
import { randomInt } from '../../shared/core-utils/common/miscs' import { randomInt, root } from '@shared/core-utils'
import { import {
AbuseState, AbuseState,
JobType, JobType,
@ -18,7 +18,6 @@ import { FollowState } from '../../shared/models/actors'
import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model' import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model'
import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.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 // Do not use barrels, remain constants as independent as possible
import { isTestInstance, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' import { isTestInstance, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
import { CONFIG, registerConfigChangedHandler } from './config' import { CONFIG, registerConfigChangedHandler } from './config'

View File

@ -1,4 +1,4 @@
import { buildUUID } from '@shared/core-utils/uuid' import { buildUUID } from '@shared/core-utils'
import * as Sequelize from 'sequelize' import * as Sequelize from 'sequelize'
async function up (utils: { async function up (utils: {

View File

@ -1,5 +1,5 @@
import * as Sequelize from 'sequelize' 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 { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos'
import { WEBSERVER } from '../constants' import { WEBSERVER } from '../constants'

View File

@ -1,5 +1,5 @@
import * as Sequelize from 'sequelize' import * as Sequelize from 'sequelize'
import { buildUUID } from '@shared/core-utils/uuid' import { buildUUID } from '@shared/core-utils'
async function up (utils: { async function up (utils: {
transaction: Sequelize.Transaction transaction: Sequelize.Transaction

View File

@ -1,9 +1,8 @@
import { getLowercaseExtension } from '@shared/core-utils'
import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc' import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc'
import { buildUUID } from '@shared/core-utils/uuid'
import { MIMETYPES } from '@server/initializers/constants' import { MIMETYPES } from '@server/initializers/constants'
import { ActorModel } from '@server/models/actor/actor' import { ActorModel } from '@server/models/actor/actor'
import { FilteredModelAttributes } from '@server/types' import { FilteredModelAttributes } from '@server/types'
import { buildUUID, getLowercaseExtension } from '@shared/core-utils'
import { ActivityPubActor, ActorImageType } from '@shared/models' import { ActivityPubActor, ActorImageType } from '@shared/models'
function getActorAttributesFromObject ( function getActorAttributesFromObject (

View File

@ -8,7 +8,7 @@ import {
UnauthorizedClientError, UnauthorizedClientError,
UnsupportedGrantTypeError UnsupportedGrantTypeError
} from 'oauth2-server' } 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 { randomBytesPromise } from '@server/helpers/core-utils'
import { MOAuthClient } from '@server/types/models' import { MOAuthClient } from '@server/types/models'
import { OAUTH_LIFETIME } from '../../initializers/constants' import { OAUTH_LIFETIME } from '../../initializers/constants'

View File

@ -9,7 +9,7 @@ import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from
import { HttpStatusCode } from '../../shared/models/http/http-error-codes' import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
import { VideoPlaylistPrivacy, VideoPrivacy } from '../../shared/models/videos' import { VideoPlaylistPrivacy, VideoPrivacy } from '../../shared/models/videos'
import { isTestInstance } from '../helpers/core-utils' 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 { logger } from '../helpers/logger'
import { mdToPlainText } from '../helpers/markdown' import { mdToPlainText } from '../helpers/markdown'
import { CONFIG } from '../initializers/config' import { CONFIG } from '../initializers/config'

View File

@ -2,7 +2,7 @@ import { close, ensureDir, move, open, outputJSON, read, readFile, remove, stat,
import { flatten, uniq } from 'lodash' import { flatten, uniq } from 'lodash'
import { basename, dirname, join } from 'path' import { basename, dirname, join } from 'path'
import { MStreamingPlaylistFilesVideo, MVideo, MVideoUUID } from '@server/types/models' 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 { getAudioStreamCodec, getVideoStreamCodec, getVideoStreamSize } from '../helpers/ffprobe-utils'
import { logger } from '../helpers/logger' import { logger } from '../helpers/logger'
import { doRequest, doRequestAndSaveToFile } from '../helpers/requests' import { doRequest, doRequestAndSaveToFile } from '../helpers/requests'

View File

@ -2,9 +2,8 @@ import 'multer'
import { queue } from 'async' import { queue } from 'async'
import LRUCache from 'lru-cache' import LRUCache from 'lru-cache'
import { join } from 'path' 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 { ActorModel } from '@server/models/actor/actor'
import { buildUUID, getLowercaseExtension } from '@shared/core-utils'
import { ActivityPubActorType, ActorImageType } from '@shared/models' import { ActivityPubActorType, ActorImageType } from '@shared/models'
import { retryTransactionWrapper } from '../helpers/database-utils' import { retryTransactionWrapper } from '../helpers/database-utils'
import { processImage } from '../helpers/image-utils' import { processImage } from '../helpers/image-utils'

View File

@ -1,9 +1,8 @@
import { join } from 'path' import { join } from 'path'
import { buildUUID } from '@shared/core-utils/uuid'
import { CONFIG } from '@server/initializers/config' import { CONFIG } from '@server/initializers/config'
import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants' import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants'
import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/types/models' 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 ################## // ################## Video file name ##################

View File

@ -1,7 +1,7 @@
import { Transaction } from 'sequelize/types' import { Transaction } from 'sequelize/types'
import { buildUUID } from '@shared/core-utils/uuid'
import { UserModel } from '@server/models/user/user' import { UserModel } from '@server/models/user/user'
import { MActorDefault } from '@server/types/models/actor' import { MActorDefault } from '@server/types/models/actor'
import { buildUUID } from '@shared/core-utils'
import { ActivityPubActorType } from '../../shared/models/activitypub' import { ActivityPubActorType } from '../../shared/models/activitypub'
import { UserNotificationSetting, UserNotificationSettingValue } from '../../shared/models/users' import { UserNotificationSetting, UserNotificationSettingValue } from '../../shared/models/users'
import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants' import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants'

View File

@ -1,6 +1,5 @@
import { remove } from 'fs-extra' import { remove } from 'fs-extra'
import { extname, join } from 'path' import { extname, join } from 'path'
import { buildUUID } from '@shared/core-utils/uuid'
import { extractVideo } from '@server/helpers/video' import { extractVideo } from '@server/helpers/video'
import { CONFIG } from '@server/initializers/config' import { CONFIG } from '@server/initializers/config'
import { import {
@ -11,6 +10,7 @@ import {
MVideoFileVideo, MVideoFileVideo,
MVideoUUID MVideoUUID
} from '@server/types/models' } from '@server/types/models'
import { buildUUID } from '@shared/core-utils'
import { VideoStorage } from '@shared/models' import { VideoStorage } from '@shared/models'
import { makeHLSFileAvailable, makeWebTorrentFileAvailable } from './object-storage' import { makeHLSFileAvailable, makeWebTorrentFileAvailable } from './object-storage'
import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from './paths' import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from './paths'

View File

@ -1,7 +1,7 @@
import { FindOptions, ModelIndexesOptions, Op, WhereOptions } from 'sequelize' import { FindOptions, ModelIndexesOptions, Op, WhereOptions } from 'sequelize'
import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' 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 { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user'
import { uuidToShort } from '@shared/core-utils'
import { AttributesOnly } from '@shared/typescript-utils' import { AttributesOnly } from '@shared/typescript-utils'
import { UserNotification, UserNotificationType } from '../../../shared' import { UserNotification, UserNotificationType } from '../../../shared'
import { isBooleanValid } from '../../helpers/custom-validators/misc' import { isBooleanValid } from '../../helpers/custom-validators/misc'

View File

@ -1,7 +1,7 @@
import { uuidToShort } from '@shared/core-utils/uuid'
import { generateMagnetUri } from '@server/helpers/webtorrent' import { generateMagnetUri } from '@server/helpers/webtorrent'
import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls' import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls'
import { VideoViews } from '@server/lib/video-views' import { VideoViews } from '@server/lib/video-views'
import { uuidToShort } from '@shared/core-utils'
import { VideoFile, VideosCommonQueryAfterSanitize } from '@shared/models' import { VideoFile, VideosCommonQueryAfterSanitize } from '@shared/models'
import { ActivityTagObject, ActivityUrlObject, VideoObject } from '../../../../shared/models/activitypub/objects' import { ActivityTagObject, ActivityUrlObject, VideoObject } from '../../../../shared/models/activitypub/objects'
import { Video, VideoDetails, VideoInclude } from '../../../../shared/models/videos' import { Video, VideoDetails, VideoInclude } from '../../../../shared/models/videos'

View File

@ -15,8 +15,8 @@ import {
Table, Table,
UpdatedAt UpdatedAt
} from 'sequelize-typescript' } from 'sequelize-typescript'
import { buildUUID } from '@shared/core-utils/uuid'
import { MVideo, MVideoCaption, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models' import { MVideo, MVideoCaption, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models'
import { buildUUID } from '@shared/core-utils'
import { AttributesOnly } from '@shared/typescript-utils' import { AttributesOnly } from '@shared/typescript-utils'
import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model' import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model'
import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions' import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions'

View File

@ -18,8 +18,7 @@ import {
UpdatedAt UpdatedAt
} from 'sequelize-typescript' } from 'sequelize-typescript'
import { MAccountId, MChannelId } from '@server/types/models' import { MAccountId, MChannelId } from '@server/types/models'
import { buildPlaylistEmbedPath, buildPlaylistWatchPath, pick } from '@shared/core-utils' import { buildPlaylistEmbedPath, buildPlaylistWatchPath, buildUUID, pick, uuidToShort } from '@shared/core-utils'
import { buildUUID, uuidToShort } from '@shared/core-utils/uuid'
import { AttributesOnly } from '@shared/typescript-utils' import { AttributesOnly } from '@shared/typescript-utils'
import { ActivityIconObject } from '../../../shared/models/activitypub/objects' import { ActivityIconObject } from '../../../shared/models/activitypub/objects'
import { PlaylistObject } from '../../../shared/models/activitypub/objects/playlist-object' import { PlaylistObject } from '../../../shared/models/activitypub/objects/playlist-object'

View File

@ -21,7 +21,7 @@ import { MStreamingPlaylist, MVideo } from '@server/types/models'
import { AttributesOnly } from '@shared/typescript-utils' import { AttributesOnly } from '@shared/typescript-utils'
import { VideoStorage } from '@shared/models' import { VideoStorage } from '@shared/models'
import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type' 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 { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
import { isArrayOf } from '../../helpers/custom-validators/misc' import { isArrayOf } from '../../helpers/custom-validators/misc'
import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos' import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos'

View File

@ -32,8 +32,7 @@ import { getHLSDirectory, getHLSRedundancyDirectory } from '@server/lib/paths'
import { VideoPathManager } from '@server/lib/video-path-manager' import { VideoPathManager } from '@server/lib/video-path-manager'
import { getServerActor } from '@server/models/application/application' import { getServerActor } from '@server/models/application/application'
import { ModelCache } from '@server/models/model-cache' import { ModelCache } from '@server/models/model-cache'
import { buildVideoEmbedPath, buildVideoWatchPath, pick } from '@shared/core-utils' import { buildVideoEmbedPath, buildVideoWatchPath, pick, uuidToShort } from '@shared/core-utils'
import { uuidToShort } from '@shared/core-utils/uuid'
import { VideoFile, VideoInclude } from '@shared/models' import { VideoFile, VideoInclude } from '@shared/models'
import { AttributesOnly } from '@shared/typescript-utils' import { AttributesOnly } from '@shared/typescript-utils'
import { ResultList, UserRight, VideoPrivacy, VideoState } from '../../../shared' import { ResultList, UserRight, VideoPrivacy, VideoState } from '../../../shared'

View File

@ -2,13 +2,13 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { wait } from '@shared/core-utils'
import { import {
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
doubleFollow, doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
wait,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'

View File

@ -2,7 +2,14 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' 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 const expect = chai.expect

View File

@ -3,7 +3,8 @@
import 'mocha' import 'mocha'
import { expect } from 'chai' import { expect } from 'chai'
import { cloneDeep } from 'lodash' 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 { buildSignedActivity } from '../../../helpers/activitypub'
import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto' import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto'

View File

@ -1,6 +1,8 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { wait } from '@shared/core-utils'
import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
@ -9,10 +11,8 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
wait,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
describe('Test AP refresher', function () { describe('Test AP refresher', function () {
let servers: PeerTubeServer[] = [] let servers: PeerTubeServer[] = []

View File

@ -6,9 +6,10 @@ import { activityPubContextify, buildSignedActivity } from '@server/helpers/acti
import { buildDigest } from '@server/helpers/peertube-crypto' import { buildDigest } from '@server/helpers/peertube-crypto'
import { HTTP_SIGNATURE } from '@server/initializers/constants' import { HTTP_SIGNATURE } from '@server/initializers/constants'
import { buildGlobalHeaders } from '@server/lib/job-queue/handlers/utils/activitypub-http-utils' 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 { makeFollowRequest, makePOSTAPRequest } from '@server/tests/shared'
import { buildAbsoluteFixturePath, wait } from '@shared/core-utils'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createMultipleServers, killallServers, PeerTubeServer } from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -1,11 +1,10 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
import { AbuseCreate, AbuseState, HttpStatusCode } from '@shared/models'
import { import {
AbusesCommand, AbusesCommand,
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
doubleFollow, doubleFollow,
@ -15,7 +14,6 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { AbuseCreate, AbuseState, HttpStatusCode } from '@shared/models'
describe('Test abuses API validators', function () { describe('Test abuses API validators', function () {
const basePath = '/api/v1/abuses/' const basePath = '/api/v1/abuses/'

View File

@ -1,15 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests,
createSingleServer,
PeerTubeServer
} from '@shared/server-commands'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, PeerTubeServer } from '@shared/server-commands'
describe('Test accounts API validators', function () { describe('Test accounts API validators', function () {
const path = '/api/v1/accounts/' const path = '/api/v1/accounts/'

View File

@ -1,10 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
import { HttpStatusCode } from '@shared/models'
import { import {
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
doubleFollow, doubleFollow,
@ -14,7 +13,6 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode } from '@shared/models'
describe('Test blocklist API validators', function () { describe('Test blocklist API validators', function () {
let servers: PeerTubeServer[] let servers: PeerTubeServer[]

View File

@ -1,15 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { MockSmtpServer } from '@server/tests/shared'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode } from '@shared/models'
import { import { cleanupTests, ContactFormCommand, createSingleServer, killallServers, PeerTubeServer } from '@shared/server-commands'
cleanupTests,
ContactFormCommand,
createSingleServer,
killallServers,
MockSmtpServer,
PeerTubeServer
} from '@shared/server-commands'
describe('Test contact form API validators', function () { describe('Test contact form API validators', function () {
let server: PeerTubeServer let server: PeerTubeServer

View File

@ -1,10 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
import { HttpStatusCode } from '@shared/models'
import { import {
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
makeDeleteRequest, makeDeleteRequest,
@ -13,7 +12,6 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode } from '@shared/models'
describe('Test server follows API validators', function () { describe('Test server follows API validators', function () {
let server: PeerTubeServer let server: PeerTubeServer

View File

@ -1,17 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests,
createSingleServer,
makeGetRequest,
PeerTubeServer,
setAccessTokensToServers
} from '@shared/server-commands'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
describe('Test jobs API validators', function () { describe('Test jobs API validators', function () {
const path = '/api/v1/jobs/failed' const path = '/api/v1/jobs/failed'

View File

@ -2,8 +2,9 @@
import 'mocha' import 'mocha'
import { omit } from 'lodash' import { omit } from 'lodash'
import { buildAbsoluteFixturePath } from '@shared/core-utils'
import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'
import { import {
buildAbsoluteFixturePath,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
LiveCommand, LiveCommand,
@ -14,7 +15,6 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
stopFfmpeg stopFfmpeg
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'
describe('Test video lives API validator', function () { describe('Test video lives API validator', function () {
const path = '/api/v1/videos/live' const path = '/api/v1/videos/live'

View File

@ -1,22 +1,19 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' 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 { import {
buildAbsoluteFixturePath,
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
makeGetRequest, makeGetRequest,
makePutBodyRequest, makePutBodyRequest,
makeUploadRequest, makeUploadRequest,
MockSmtpServer,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
UsersCommand UsersCommand
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, UserRole, VideoCreateResult } from '@shared/models'
describe('Test my user API validators', function () { describe('Test my user API validators', function () {
const path = '/api/v1/users/' const path = '/api/v1/users/'

View File

@ -1,10 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
import { HttpStatusCode, PeerTubePlugin, PluginType } from '@shared/models'
import { import {
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
makeGetRequest, makeGetRequest,
@ -13,7 +12,6 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, PeerTubePlugin, PluginType } from '@shared/models'
describe('Test server plugins API validators', function () { describe('Test server plugins API validators', function () {
let server: PeerTubeServer let server: PeerTubeServer

View File

@ -1,10 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
import { HttpStatusCode, VideoCreateResult } from '@shared/models'
import { import {
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
doubleFollow, doubleFollow,
@ -16,7 +15,6 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, VideoCreateResult } from '@shared/models'
describe('Test server redundancy API validators', function () { describe('Test server redundancy API validators', function () {
let servers: PeerTubeServer[] let servers: PeerTubeServer[]

View File

@ -1,17 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests,
createSingleServer,
makeGetRequest,
PeerTubeServer,
setAccessTokensToServers
} from '@shared/server-commands'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) { function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) {
return server.config.updateCustomSubConfig({ return server.config.updateCustomSubConfig({

View File

@ -1,8 +1,15 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands'
import { HttpStatusCode, UserRole } from '@shared/models' import { HttpStatusCode, UserRole } from '@shared/models'
import {
cleanupTests,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/server-commands'
describe('Test transcoding API validators', function () { describe('Test transcoding API validators', function () {
let servers: PeerTubeServer[] let servers: PeerTubeServer[]

View File

@ -2,18 +2,18 @@
import 'mocha' import 'mocha'
import { expect } from 'chai' import { expect } from 'chai'
import { FIXTURE_URLS } from '@server/tests/shared'
import { randomInt } from '@shared/core-utils' import { randomInt } from '@shared/core-utils'
import { HttpStatusCode, VideoImportState, VideoPrivacy } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
FIXTURE_URLS,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
VideosCommand, VideosCommand,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, VideoImportState, VideoPrivacy } from '@shared/models'
describe('Test upload quota', function () { describe('Test upload quota', function () {
let server: PeerTubeServer let server: PeerTubeServer

View File

@ -2,20 +2,18 @@
import 'mocha' import 'mocha'
import { io } from 'socket.io-client' 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 { import {
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
makePutBodyRequest, makePutBodyRequest,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers
wait
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, UserNotificationSetting, UserNotificationSettingValue } from '@shared/models'
describe('Test user notifications API validators', function () { describe('Test user notifications API validators', function () {
let server: PeerTubeServer let server: PeerTubeServer

View File

@ -2,9 +2,6 @@
import 'mocha' import 'mocha'
import { import {
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
makeDeleteRequest, makeDeleteRequest,
@ -15,6 +12,7 @@ import {
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode } from '@shared/models'
import { checkBadStartPagination, checkBadCountPagination, checkBadSortPagination } from '@server/tests/shared'
describe('Test user subscriptions API validators', function () { describe('Test user subscriptions API validators', function () {
const path = '/api/v1/users/me/subscriptions' const path = '/api/v1/users/me/subscriptions'

View File

@ -2,21 +2,18 @@
import 'mocha' import 'mocha'
import { omit } from 'lodash' import { omit } from 'lodash'
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, MockSmtpServer } from '@server/tests/shared'
import { HttpStatusCode, UserAdminFlag, UserRole } from '@shared/models'
import { import {
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
killallServers, killallServers,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
makePutBodyRequest, makePutBodyRequest,
MockSmtpServer,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, UserAdminFlag, UserRole } from '@shared/models'
describe('Test users admin API validators', function () { describe('Test users admin API validators', function () {
const path = '/api/v1/users/' const path = '/api/v1/users/'

View File

@ -2,15 +2,9 @@
import 'mocha' import 'mocha'
import { omit } from 'lodash' import { omit } from 'lodash'
import { import { MockSmtpServer } from '@server/tests/shared'
cleanupTests,
createSingleServer,
makePostBodyRequest,
MockSmtpServer,
PeerTubeServer,
setAccessTokensToServers
} from '@shared/server-commands'
import { HttpStatusCode, UserRole } from '@shared/models' import { HttpStatusCode, UserRole } from '@shared/models'
import { cleanupTests, createSingleServer, makePostBodyRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
describe('Test users API validators', function () { describe('Test users API validators', function () {
const path = '/api/v1/users/' const path = '/api/v1/users/'

View File

@ -2,11 +2,10 @@
import 'mocha' import 'mocha'
import { expect } from 'chai' import { expect } from 'chai'
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
import { HttpStatusCode, VideoBlacklistType } from '@shared/models'
import { import {
BlacklistCommand, BlacklistCommand,
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
doubleFollow, doubleFollow,
@ -16,7 +15,6 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, VideoBlacklistType } from '@shared/models'
describe('Test video blacklist API validators', function () { describe('Test video blacklist API validators', function () {
let servers: PeerTubeServer[] let servers: PeerTubeServer[]

View File

@ -1,8 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { buildAbsoluteFixturePath } from '@shared/core-utils'
import { HttpStatusCode, VideoCreateResult } from '@shared/models'
import { import {
buildAbsoluteFixturePath,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
makeDeleteRequest, makeDeleteRequest,
@ -11,7 +12,6 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, VideoCreateResult } from '@shared/models'
describe('Test video captions API validator', function () { describe('Test video captions API validator', function () {
const path = '/api/v1/videos/' const path = '/api/v1/videos/'

View File

@ -3,12 +3,11 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { omit } from 'lodash' 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 { import {
buildAbsoluteFixturePath,
ChannelsCommand, ChannelsCommand,
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
makeGetRequest, makeGetRequest,
@ -18,7 +17,6 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, VideoChannelUpdate } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,10 +2,9 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
import { HttpStatusCode, VideoCreateResult } from '@shared/models'
import { import {
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
makeDeleteRequest, makeDeleteRequest,
@ -14,7 +13,6 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, VideoCreateResult } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -1,8 +1,15 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands'
import { HttpStatusCode, UserRole } from '@shared/models' import { HttpStatusCode, UserRole } from '@shared/models'
import {
cleanupTests,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/server-commands'
describe('Test videos files', function () { describe('Test videos files', function () {
let servers: PeerTubeServer[] let servers: PeerTubeServer[]

View File

@ -2,21 +2,18 @@
import 'mocha' import 'mocha'
import { omit } from 'lodash' 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 { import {
buildAbsoluteFixturePath,
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
FIXTURE_URLS,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
makeUploadRequest, makeUploadRequest,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, VideoPrivacy } from '@shared/models'
describe('Test video imports API validator', function () { describe('Test video imports API validator', function () {
const path = '/api/v1/videos/imports' const path = '/api/v1/videos/imports'

View File

@ -1,18 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests,
createSingleServer,
makeGetRequest,
PeerTubeServer,
PlaylistsCommand,
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/server-commands'
import { import {
HttpStatusCode, HttpStatusCode,
VideoPlaylistCreate, VideoPlaylistCreate,
@ -23,6 +12,15 @@ import {
VideoPlaylistReorder, VideoPlaylistReorder,
VideoPlaylistType VideoPlaylistType
} from '@shared/models' } from '@shared/models'
import {
cleanupTests,
createSingleServer,
makeGetRequest,
PeerTubeServer,
PlaylistsCommand,
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/server-commands'
describe('Test video playlists API validator', function () { describe('Test video playlists API validator', function () {
let server: PeerTubeServer let server: PeerTubeServer

View File

@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { checkBadCountPagination, checkBadStartPagination } from '@server/tests/shared'
import { HttpStatusCode } from '@shared/models'
import { import {
checkBadCountPagination,
checkBadStartPagination,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
makeGetRequest, makeGetRequest,
@ -12,7 +12,6 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode } from '@shared/models'
describe('Test videos history API validator', function () { describe('Test videos history API validator', function () {
const myHistoryPath = '/api/v1/users/me/history/videos' const myHistoryPath = '/api/v1/users/me/history/videos'

View File

@ -4,12 +4,10 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { omit } from 'lodash' import { omit } from 'lodash'
import { join } from 'path' 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 { import {
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
checkUploadVideoParam,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
makeDeleteRequest, makeDeleteRequest,
@ -17,10 +15,8 @@ import {
makePutBodyRequest, makePutBodyRequest,
makeUploadRequest, makeUploadRequest,
PeerTubeServer, PeerTubeServer,
root,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,9 +2,9 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { wait } from '@shared/core-utils'
import { VideoPrivacy } from '@shared/models' import { VideoPrivacy } from '@shared/models'
import { import {
checkLiveCleanupAfterSave,
cleanupTests, cleanupTests,
ConfigCommand, ConfigCommand,
createMultipleServers, createMultipleServers,
@ -12,9 +12,9 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
wait,
waitJobs waitJobs
} from '../../../../shared/server-commands' } from '@shared/server-commands'
import { checkLiveCleanupAfterSave } from '../../shared'
const expect = chai.expect const expect = chai.expect

View File

@ -2,6 +2,7 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { wait } from '@shared/core-utils'
import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models' import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
@ -12,9 +13,8 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
stopFfmpeg, stopFfmpeg,
wait,
waitJobs waitJobs
} from '../../../../shared/server-commands' } from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -2,9 +2,9 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { buildAbsoluteFixturePath } from '@shared/core-utils'
import { VideoPrivacy } from '@shared/models' import { VideoPrivacy } from '@shared/models'
import { import {
buildAbsoluteFixturePath,
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
PeerTubeServer, PeerTubeServer,
@ -14,7 +14,7 @@ import {
stopFfmpeg, stopFfmpeg,
testFfmpegStreamError, testFfmpegStreamError,
waitUntilLivePublishedOnAllServers waitUntilLivePublishedOnAllServers
} from '../../../../shared/server-commands' } from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -3,8 +3,10 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { FfmpegCommand } from 'fluent-ffmpeg' 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 { import {
checkLiveCleanupAfterSave,
cleanupTests, cleanupTests,
ConfigCommand, ConfigCommand,
createMultipleServers, createMultipleServers,
@ -14,12 +16,10 @@ import {
setDefaultVideoChannel, setDefaultVideoChannel,
stopFfmpeg, stopFfmpeg,
testFfmpegStreamError, testFfmpegStreamError,
wait,
waitJobs, waitJobs,
waitUntilLivePublishedOnAllServers, waitUntilLivePublishedOnAllServers,
waitUntilLiveSavedOnAllServers waitUntilLiveSavedOnAllServers
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,6 +2,7 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { wait } from '@shared/core-utils'
import { VideoPrivacy, VideoState } from '@shared/models' import { VideoPrivacy, VideoState } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
@ -11,10 +12,9 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
stopFfmpeg, stopFfmpeg,
wait,
waitJobs, waitJobs,
waitUntilLivePublishedOnAllServers waitUntilLivePublishedOnAllServers
} from '../../../../shared/server-commands' } from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -3,6 +3,7 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { FfmpegCommand } from 'fluent-ffmpeg' import { FfmpegCommand } from 'fluent-ffmpeg'
import { wait } from '@shared/core-utils'
import { VideoPrivacy } from '@shared/models' import { VideoPrivacy } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
@ -12,10 +13,9 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
stopFfmpeg, stopFfmpeg,
wait,
waitJobs, waitJobs,
waitUntilLivePublishedOnAllServers waitUntilLivePublishedOnAllServers
} from '../../../../shared/server-commands' } from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -4,10 +4,18 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { basename, join } from 'path' import { basename, join } from 'path'
import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils' 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 { import {
checkLiveCleanupAfterSave,
checkLiveSegmentHash,
checkResolutionsInMasterPlaylist,
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
doubleFollow, doubleFollow,
@ -20,20 +28,9 @@ import {
setDefaultVideoChannel, setDefaultVideoChannel,
stopFfmpeg, stopFfmpeg,
testFfmpegStreamError, testFfmpegStreamError,
testImage,
wait,
waitJobs, waitJobs,
waitUntilLivePublishedOnAllServers waitUntilLivePublishedOnAllServers
} from '@shared/server-commands' } from '@shared/server-commands'
import {
HttpStatusCode,
LiveVideo,
LiveVideoCreate,
VideoDetails,
VideoPrivacy,
VideoState,
VideoStreamingPlaylistType
} from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,8 +2,15 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands'
import { UserNotificationType } from '@shared/models' import { UserNotificationType } from '@shared/models'
import {
cleanupTests,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -3,18 +3,18 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { orderBy } from 'lodash' import { orderBy } from 'lodash'
import { FIXTURE_URLS } from '@server/tests/shared'
import { UserAdminFlag, UserRole, VideoBlacklist, VideoBlacklistType } from '@shared/models'
import { import {
BlacklistCommand, BlacklistCommand,
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
doubleFollow, doubleFollow,
FIXTURE_URLS,
killallServers, killallServers,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { UserAdminFlag, UserRole, VideoBlacklist, VideoBlacklistType } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -6,14 +6,13 @@ import {
CheckerBaseParams, CheckerBaseParams,
checkNewPeerTubeVersion, checkNewPeerTubeVersion,
checkNewPluginVersion, checkNewPluginVersion,
cleanupTests,
MockJoinPeerTubeVersions, MockJoinPeerTubeVersions,
MockSmtpServer, MockSmtpServer,
PeerTubeServer, prepareNotificationsTest
prepareNotificationsTest, } from '@server/tests/shared'
wait import { wait } from '@shared/core-utils'
} from '@shared/server-commands'
import { PluginType, UserNotification, UserNotificationType } from '@shared/models' import { PluginType, UserNotification, UserNotificationType } from '@shared/models'
import { cleanupTests, PeerTubeServer } from '@shared/server-commands'
describe('Test admin notifications', function () { describe('Test admin notifications', function () {
let server: PeerTubeServer let server: PeerTubeServer

View File

@ -6,13 +6,11 @@ import {
checkCommentMention, checkCommentMention,
CheckerBaseParams, CheckerBaseParams,
checkNewCommentOnMyVideo, checkNewCommentOnMyVideo,
cleanupTests,
MockSmtpServer, MockSmtpServer,
PeerTubeServer, prepareNotificationsTest
prepareNotificationsTest, } from '@server/tests/shared'
waitJobs
} from '@shared/server-commands'
import { UserNotification } from '@shared/models' import { UserNotification } from '@shared/models'
import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { buildUUID } from '@shared/core-utils/uuid'
import { import {
checkAbuseStateChange, checkAbuseStateChange,
checkAutoInstanceFollowing, checkAutoInstanceFollowing,
@ -16,15 +15,13 @@ import {
checkUserRegistered, checkUserRegistered,
checkVideoAutoBlacklistForModerators, checkVideoAutoBlacklistForModerators,
checkVideoIsPublished, checkVideoIsPublished,
cleanupTests,
MockInstancesIndex, MockInstancesIndex,
MockSmtpServer, MockSmtpServer,
PeerTubeServer, prepareNotificationsTest
prepareNotificationsTest, } from '@server/tests/shared'
wait, import { buildUUID, wait } from '@shared/core-utils'
waitJobs
} from '@shared/server-commands'
import { AbuseState, CustomConfig, UserNotification, UserRole, VideoPrivacy } from '@shared/models' import { AbuseState, CustomConfig, UserNotification, UserRole, VideoPrivacy } from '@shared/models'
import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands'
describe('Test moderation notifications', function () { describe('Test moderation notifications', function () {
let servers: PeerTubeServer[] = [] let servers: PeerTubeServer[] = []

View File

@ -5,14 +5,12 @@ import * as chai from 'chai'
import { import {
CheckerBaseParams, CheckerBaseParams,
checkNewVideoFromSubscription, checkNewVideoFromSubscription,
cleanupTests,
getAllNotificationsSettings, getAllNotificationsSettings,
MockSmtpServer, MockSmtpServer,
PeerTubeServer, prepareNotificationsTest
prepareNotificationsTest, } from '@server/tests/shared'
waitJobs
} from '@shared/server-commands'
import { UserNotification, UserNotificationSettingValue } from '@shared/models' import { UserNotification, UserNotificationSettingValue } from '@shared/models'
import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -2,23 +2,20 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { buildUUID } from '@shared/core-utils/uuid'
import { import {
CheckerBaseParams, CheckerBaseParams,
checkMyVideoImportIsFinished, checkMyVideoImportIsFinished,
checkNewActorFollow, checkNewActorFollow,
checkNewVideoFromSubscription, checkNewVideoFromSubscription,
checkVideoIsPublished, checkVideoIsPublished,
cleanupTests,
FIXTURE_URLS, FIXTURE_URLS,
MockSmtpServer, MockSmtpServer,
PeerTubeServer,
prepareNotificationsTest, prepareNotificationsTest,
uploadRandomVideoOnServers, uploadRandomVideoOnServers
wait, } from '@server/tests/shared'
waitJobs import { buildUUID, wait } from '@shared/core-utils'
} from '@shared/server-commands'
import { UserNotification, UserNotificationType, VideoPrivacy } from '@shared/models' import { UserNotification, UserNotificationType, VideoPrivacy } from '@shared/models'
import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -3,11 +3,12 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { FfmpegCommand } from 'fluent-ffmpeg' 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 { import {
areObjectStorageTestsDisabled,
createMultipleServers, createMultipleServers,
doubleFollow, doubleFollow,
expectStartWith,
killallServers, killallServers,
makeRawRequest, makeRawRequest,
ObjectStorageCommand, ObjectStorageCommand,
@ -19,7 +20,6 @@ import {
waitUntilLivePublishedOnAllServers, waitUntilLivePublishedOnAllServers,
waitUntilLiveSavedOnAllServers waitUntilLiveSavedOnAllServers
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, LiveVideoCreate, VideoFile, VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,11 +2,11 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' 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 { import {
areObjectStorageTestsDisabled,
createSingleServer, createSingleServer,
expectStartWith,
FIXTURE_URLS,
killallServers, killallServers,
makeRawRequest, makeRawRequest,
ObjectStorageCommand, ObjectStorageCommand,
@ -15,7 +15,6 @@ import {
setDefaultVideoChannel, setDefaultVideoChannel,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -3,25 +3,22 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { merge } from 'lodash' 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 { import {
areObjectStorageTestsDisabled,
checkTmpIsEmpty,
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
createSingleServer, createSingleServer,
doubleFollow, doubleFollow,
expectLogDoesNotContain,
expectStartWith,
killallServers, killallServers,
makeRawRequest, makeRawRequest,
MockObjectStorage,
ObjectStorageCommand, ObjectStorageCommand,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs, waitJobs,
webtorrentAdd webtorrentAdd
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, VideoDetails } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,8 +2,15 @@
import 'mocha' import 'mocha'
import { expect } from 'chai' import { expect } from 'chai'
import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands'
import { VideoPrivacy } from '@shared/models' import { VideoPrivacy } from '@shared/models'
import {
cleanupTests,
createSingleServer,
killallServers,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/server-commands'
describe('Test redundancy constraints', function () { describe('Test redundancy constraints', function () {
let remoteServer: PeerTubeServer let remoteServer: PeerTubeServer

View File

@ -5,21 +5,8 @@ import * as chai from 'chai'
import { readdir } from 'fs-extra' import { readdir } from 'fs-extra'
import magnetUtil from 'magnet-uri' import magnetUtil from 'magnet-uri'
import { basename, join } from 'path' import { basename, join } from 'path'
import { import { checkSegmentHash, checkVideoFilesWereRemoved, saveVideoInServers } from '@server/tests/shared'
checkSegmentHash, import { root, wait } from '@shared/core-utils'
checkVideoFilesWereRemoved,
cleanupTests,
createMultipleServers,
doubleFollow,
killallServers,
makeRawRequest,
PeerTubeServer,
root,
saveVideoInServers,
setAccessTokensToServers,
wait,
waitJobs
} from '@shared/server-commands'
import { import {
HttpStatusCode, HttpStatusCode,
VideoDetails, VideoDetails,
@ -28,6 +15,16 @@ import {
VideoRedundancyStrategy, VideoRedundancyStrategy,
VideoRedundancyStrategyWithManual VideoRedundancyStrategyWithManual
} from '@shared/models' } from '@shared/models'
import {
cleanupTests,
createMultipleServers,
doubleFollow,
killallServers,
makeRawRequest,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -2,16 +2,16 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { wait } from '@shared/core-utils'
import { VideoChannel } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
PeerTubeServer, PeerTubeServer,
SearchCommand, SearchCommand,
setAccessTokensToServers, setAccessTokensToServers,
wait,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { VideoChannel } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,6 +2,8 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { wait } from '@shared/core-utils'
import { VideoPlaylistPrivacy } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
@ -9,10 +11,8 @@ import {
SearchCommand, SearchCommand,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
wait,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,16 +2,16 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { wait } from '@shared/core-utils'
import { VideoPrivacy } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
PeerTubeServer, PeerTubeServer,
SearchCommand, SearchCommand,
setAccessTokensToServers, setAccessTokensToServers,
wait,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -10,10 +10,10 @@ import {
SearchCommand, SearchCommand,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
stopFfmpeg, stopFfmpeg
wait
} from '@shared/server-commands' } from '@shared/server-commands'
import { VideoPrivacy } from '@shared/models' import { VideoPrivacy } from '@shared/models'
import { wait } from '@shared/core-utils'
const expect = chai.expect const expect = chai.expect

View File

@ -2,15 +2,9 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import { MockInstancesIndex } from '@server/tests/shared'
cleanupTests, import { wait } from '@shared/core-utils'
createMultipleServers, import { cleanupTests, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands'
MockInstancesIndex,
PeerTubeServer,
setAccessTokensToServers,
wait,
waitJobs
} from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -2,15 +2,9 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import { FIXTURE_URLS } from '@server/tests/shared'
cleanupTests,
createSingleServer,
FIXTURE_URLS,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/server-commands'
import { VideoDetails, VideoPrivacy } from '@shared/models' import { VideoDetails, VideoPrivacy } from '@shared/models'
import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -2,16 +2,16 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { parallelTests } from '@shared/core-utils'
import { CustomConfig, HttpStatusCode } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
killallServers, killallServers,
makeGetRequest, makeGetRequest,
parallelTests,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/server-commands' } from '@shared/server-commands'
import { CustomConfig, HttpStatusCode } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,17 +2,17 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { MockSmtpServer } from '@server/tests/shared'
import { wait } from '@shared/core-utils'
import { HttpStatusCode } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
ContactFormCommand, ContactFormCommand,
createSingleServer, createSingleServer,
MockSmtpServer,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
wait,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,8 +2,9 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' 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 { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -2,19 +2,9 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import { completeVideoCheck, dateIsValid, expectAccountFollows, expectChannelsFollows, testCaptionFile } from '@server/tests/shared'
cleanupTests,
createMultipleServers,
dateIsValid,
expectAccountFollows,
expectChannelsFollows,
PeerTubeServer,
setAccessTokensToServers,
testCaptionFile,
waitJobs
} from '@shared/server-commands'
import { VideoCreateResult, VideoPrivacy } from '@shared/models' 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 const expect = chai.expect

View File

@ -2,6 +2,9 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' 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 { import {
cleanupTests, cleanupTests,
CommentsCommand, CommentsCommand,
@ -9,11 +12,8 @@ import {
killallServers, killallServers,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
wait,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models'
import { completeVideoCheck } from '@server/tests/shared/video'
const expect = chai.expect const expect = chai.expect

View File

@ -2,10 +2,10 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { dateIsValid } from '@server/tests/shared'
import { import {
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
dateIsValid,
doubleFollow, doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,

View File

@ -2,17 +2,17 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { testHelloWorldRegisteredSettings } from '@server/tests/shared'
import { wait } from '@shared/core-utils'
import { HttpStatusCode, PluginType } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
killallServers, killallServers,
PeerTubeServer, PeerTubeServer,
PluginsCommand, PluginsCommand,
setAccessTokensToServers, setAccessTokensToServers
testHelloWorldRegisteredSettings,
wait
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, PluginType } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,18 +2,17 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { FIXTURE_URLS, MockProxy } from '@server/tests/shared'
import { HttpStatusCode, VideoPrivacy } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
doubleFollow, doubleFollow,
FIXTURE_URLS,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { MockProxy } from '@shared/server-commands/mock-servers/mock-proxy'
import { HttpStatusCode, VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -1,8 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { expect } from 'chai' 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 { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
describe('Test application behind a reverse proxy', function () { describe('Test application behind a reverse proxy', function () {
let server: PeerTubeServer let server: PeerTubeServer

View File

@ -2,8 +2,15 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands'
import { Job } from '@shared/models' import { Job } from '@shared/models'
import {
cleanupTests,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -2,16 +2,16 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { wait } from '@shared/core-utils'
import { ActivityType, VideoPlaylistPrivacy } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
doubleFollow, doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
wait,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { ActivityType, VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -6,16 +6,18 @@ import {
checkActorFilesWereRemoved, checkActorFilesWereRemoved,
checkTmpIsEmpty, checkTmpIsEmpty,
checkVideoFilesWereRemoved, checkVideoFilesWereRemoved,
saveVideoInServers,
testImage
} from '@server/tests/shared'
import { MyUser } from '@shared/models'
import {
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
doubleFollow, doubleFollow,
PeerTubeServer, PeerTubeServer,
saveVideoInServers,
setAccessTokensToServers, setAccessTokensToServers,
testImage,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { MyUser } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,8 +2,9 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' 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 { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

View File

@ -2,6 +2,8 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { testImage } from '@server/tests/shared'
import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
@ -9,10 +11,8 @@ import {
makePutBodyRequest, makePutBodyRequest,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
testImage,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -3,7 +3,14 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' 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 const expect = chai.expect

View File

@ -4,23 +4,24 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import request from 'supertest' import request from 'supertest'
import { import {
buildAbsoluteFixturePath,
checkTmpIsEmpty, checkTmpIsEmpty,
checkVideoFilesWereRemoved, 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, cleanupTests,
createMultipleServers, createMultipleServers,
dateIsValid,
doubleFollow, doubleFollow,
PeerTubeServer, PeerTubeServer,
saveVideoInServers,
setAccessTokensToServers, setAccessTokensToServers,
testImage,
wait,
waitJobs, waitJobs,
webtorrentAdd webtorrentAdd
} from '@shared/server-commands' } from '@shared/server-commands'
import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@shared/models'
import { completeVideoCheck } from '@server/tests/shared/video'
const expect = chai.expect const expect = chai.expect

View File

@ -4,15 +4,9 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { pathExists, readdir, stat } from 'fs-extra' import { pathExists, readdir, stat } from 'fs-extra'
import { join } from 'path' import { join } from 'path'
import { import { buildAbsoluteFixturePath } from '@shared/core-utils'
buildAbsoluteFixturePath,
cleanupTests,
createSingleServer,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/server-commands'
import { HttpStatusCode, VideoPrivacy } from '@shared/models' import { HttpStatusCode, VideoPrivacy } from '@shared/models'
import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/server-commands'
const expect = chai.expect const expect = chai.expect

Some files were not shown because too many files have changed in this diff Show More