diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-16 14:27:30 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:19 +0200 |
commit | 4c7e60bc17ee5830399bac4aa273356903421b4c (patch) | |
tree | 9e67397cf49b229b5bc0f9747f1a7e387bba558a | |
parent | c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea (diff) | |
download | PeerTube-4c7e60bc17ee5830399bac4aa273356903421b4c.tar.gz PeerTube-4c7e60bc17ee5830399bac4aa273356903421b4c.tar.zst PeerTube-4c7e60bc17ee5830399bac4aa273356903421b4c.zip |
Reorganize imports
165 files changed, 265 insertions, 325 deletions
diff --git a/server/controllers/api/bulk.ts b/server/controllers/api/bulk.ts index 10d83571d..62121ece5 100644 --- a/server/controllers/api/bulk.ts +++ b/server/controllers/api/bulk.ts | |||
@@ -1,10 +1,10 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { asyncMiddleware, authenticate } from '../../middlewares' | 2 | import { removeComment } from '@server/lib/video-comment' |
3 | import { bulkRemoveCommentsOfValidator } from '@server/middlewares/validators/bulk' | 3 | import { bulkRemoveCommentsOfValidator } from '@server/middlewares/validators/bulk' |
4 | import { VideoCommentModel } from '@server/models/video/video-comment' | 4 | import { VideoCommentModel } from '@server/models/video/video-comment' |
5 | import { removeComment } from '@server/lib/video-comment' | ||
6 | import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' | ||
7 | import { HttpStatusCode } from '@shared/models' | 5 | import { HttpStatusCode } from '@shared/models' |
6 | import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' | ||
7 | import { asyncMiddleware, authenticate } from '../../middlewares' | ||
8 | 8 | ||
9 | const bulkRouter = express.Router() | 9 | const bulkRouter = express.Router() |
10 | 10 | ||
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 9bd8c21c5..ee733a38c 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import { ServerConfigManager } from '@server/lib/server-config-manager' | ||
2 | import * as express from 'express' | 1 | import * as express from 'express' |
3 | import { remove, writeJSON } from 'fs-extra' | 2 | import { remove, writeJSON } from 'fs-extra' |
4 | import { snakeCase } from 'lodash' | 3 | import { snakeCase } from 'lodash' |
5 | import validator from 'validator' | 4 | import validator from 'validator' |
5 | import { ServerConfigManager } from '@server/lib/server-config-manager' | ||
6 | import { UserRight } from '../../../shared' | 6 | import { UserRight } from '../../../shared' |
7 | import { About } from '../../../shared/models/server/about.model' | 7 | import { About } from '../../../shared/models/server/about.model' |
8 | import { CustomConfig } from '../../../shared/models/server/custom-config.model' | 8 | import { CustomConfig } from '../../../shared/models/server/custom-config.model' |
diff --git a/server/controllers/api/custom-page.ts b/server/controllers/api/custom-page.ts index cc1aa8427..68d8c2ea4 100644 --- a/server/controllers/api/custom-page.ts +++ b/server/controllers/api/custom-page.ts | |||
@@ -1,8 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { ServerConfigManager } from '@server/lib/server-config-manager' | 2 | import { ServerConfigManager } from '@server/lib/server-config-manager' |
3 | import { ActorCustomPageModel } from '@server/models/account/actor-custom-page' | 3 | import { ActorCustomPageModel } from '@server/models/account/actor-custom-page' |
4 | import { HttpStatusCode } from '@shared/models' | 4 | import { HttpStatusCode, UserRight } from '@shared/models' |
5 | import { UserRight } from '@shared/models' | ||
6 | import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares' | 5 | import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares' |
7 | 6 | ||
8 | const customPageRouter = express.Router() | 7 | const customPageRouter = express.Router() |
diff --git a/server/controllers/api/overviews.ts b/server/controllers/api/overviews.ts index ad879aad6..aaa341d54 100644 --- a/server/controllers/api/overviews.ts +++ b/server/controllers/api/overviews.ts | |||
@@ -1,12 +1,12 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import * as memoizee from 'memoizee' | ||
3 | import { logger } from '@server/helpers/logger' | ||
4 | import { CategoryOverview, ChannelOverview, TagOverview, VideosOverview } from '../../../shared/models/overviews' | ||
2 | import { buildNSFWFilter } from '../../helpers/express-utils' | 5 | import { buildNSFWFilter } from '../../helpers/express-utils' |
3 | import { VideoModel } from '../../models/video/video' | 6 | import { MEMOIZE_TTL, OVERVIEWS } from '../../initializers/constants' |
4 | import { asyncMiddleware, optionalAuthenticate, videosOverviewValidator } from '../../middlewares' | 7 | import { asyncMiddleware, optionalAuthenticate, videosOverviewValidator } from '../../middlewares' |
5 | import { TagModel } from '../../models/video/tag' | 8 | import { TagModel } from '../../models/video/tag' |
6 | import { CategoryOverview, ChannelOverview, TagOverview, VideosOverview } from '../../../shared/models/overviews' | 9 | import { VideoModel } from '../../models/video/video' |
7 | import { MEMOIZE_TTL, OVERVIEWS } from '../../initializers/constants' | ||
8 | import * as memoizee from 'memoizee' | ||
9 | import { logger } from '@server/helpers/logger' | ||
10 | 10 | ||
11 | const overviewsRouter = express.Router() | 11 | const overviewsRouter = express.Router() |
12 | 12 | ||
diff --git a/server/controllers/api/plugins.ts b/server/controllers/api/plugins.ts index 4b213c246..3a9ef34e8 100644 --- a/server/controllers/api/plugins.ts +++ b/server/controllers/api/plugins.ts | |||
@@ -23,8 +23,8 @@ import { | |||
23 | updatePluginSettingsValidator | 23 | updatePluginSettingsValidator |
24 | } from '@server/middlewares/validators/plugins' | 24 | } from '@server/middlewares/validators/plugins' |
25 | import { PluginModel } from '@server/models/server/plugin' | 25 | import { PluginModel } from '@server/models/server/plugin' |
26 | import { HttpStatusCode } from '@shared/models' | ||
27 | import { | 26 | import { |
27 | HttpStatusCode, | ||
28 | InstallOrUpdatePlugin, | 28 | InstallOrUpdatePlugin, |
29 | ManagePlugin, | 29 | ManagePlugin, |
30 | PeertubePluginIndexList, | 30 | PeertubePluginIndexList, |
diff --git a/server/controllers/api/search/search-video-channels.ts b/server/controllers/api/search/search-video-channels.ts index fe9178e69..c8f0a0a0b 100644 --- a/server/controllers/api/search/search-video-channels.ts +++ b/server/controllers/api/search/search-video-channels.ts | |||
@@ -6,8 +6,7 @@ import { WEBSERVER } from '@server/initializers/constants' | |||
6 | import { Hooks } from '@server/lib/plugins/hooks' | 6 | import { Hooks } from '@server/lib/plugins/hooks' |
7 | import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' | 7 | import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' |
8 | import { getServerActor } from '@server/models/application/application' | 8 | import { getServerActor } from '@server/models/application/application' |
9 | import { HttpStatusCode } from '@shared/models' | 9 | import { HttpStatusCode, ResultList, VideoChannel } from '@shared/models' |
10 | import { ResultList, VideoChannel } from '@shared/models' | ||
11 | import { VideoChannelsSearchQuery } from '../../../../shared/models/search' | 10 | import { VideoChannelsSearchQuery } from '../../../../shared/models/search' |
12 | import { isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils' | 11 | import { isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils' |
13 | import { logger } from '../../../helpers/logger' | 12 | import { logger } from '../../../helpers/logger' |
diff --git a/server/controllers/api/search/search-video-playlists.ts b/server/controllers/api/search/search-video-playlists.ts index a0e2c1747..f55b1fba3 100644 --- a/server/controllers/api/search/search-video-playlists.ts +++ b/server/controllers/api/search/search-video-playlists.ts | |||
@@ -5,14 +5,14 @@ import { logger } from '@server/helpers/logger' | |||
5 | import { doJSONRequest } from '@server/helpers/requests' | 5 | import { doJSONRequest } from '@server/helpers/requests' |
6 | import { getFormattedObjects } from '@server/helpers/utils' | 6 | import { getFormattedObjects } from '@server/helpers/utils' |
7 | import { CONFIG } from '@server/initializers/config' | 7 | import { CONFIG } from '@server/initializers/config' |
8 | import { WEBSERVER } from '@server/initializers/constants' | ||
8 | import { getOrCreateAPVideoPlaylist } from '@server/lib/activitypub/playlists/get' | 9 | import { getOrCreateAPVideoPlaylist } from '@server/lib/activitypub/playlists/get' |
9 | import { Hooks } from '@server/lib/plugins/hooks' | 10 | import { Hooks } from '@server/lib/plugins/hooks' |
10 | import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' | 11 | import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' |
11 | import { getServerActor } from '@server/models/application/application' | 12 | import { getServerActor } from '@server/models/application/application' |
12 | import { VideoPlaylistModel } from '@server/models/video/video-playlist' | 13 | import { VideoPlaylistModel } from '@server/models/video/video-playlist' |
13 | import { MVideoPlaylistFullSummary } from '@server/types/models' | 14 | import { MVideoPlaylistFullSummary } from '@server/types/models' |
14 | import { HttpStatusCode } from '@shared/models' | 15 | import { HttpStatusCode, ResultList, VideoPlaylist, VideoPlaylistsSearchQuery } from '@shared/models' |
15 | import { ResultList, VideoPlaylist, VideoPlaylistsSearchQuery } from '@shared/models' | ||
16 | import { | 16 | import { |
17 | asyncMiddleware, | 17 | asyncMiddleware, |
18 | openapiOperationDoc, | 18 | openapiOperationDoc, |
@@ -23,7 +23,6 @@ import { | |||
23 | videoPlaylistsListSearchValidator, | 23 | videoPlaylistsListSearchValidator, |
24 | videoPlaylistsSearchSortValidator | 24 | videoPlaylistsSearchSortValidator |
25 | } from '../../../middlewares' | 25 | } from '../../../middlewares' |
26 | import { WEBSERVER } from '@server/initializers/constants' | ||
27 | 26 | ||
28 | const searchPlaylistsRouter = express.Router() | 27 | const searchPlaylistsRouter = express.Router() |
29 | 28 | ||
diff --git a/server/controllers/api/search/search-videos.ts b/server/controllers/api/search/search-videos.ts index 0e6fd9c72..a4153f3f8 100644 --- a/server/controllers/api/search/search-videos.ts +++ b/server/controllers/api/search/search-videos.ts | |||
@@ -6,8 +6,7 @@ import { WEBSERVER } from '@server/initializers/constants' | |||
6 | import { getOrCreateAPVideo } from '@server/lib/activitypub/videos' | 6 | import { getOrCreateAPVideo } from '@server/lib/activitypub/videos' |
7 | import { Hooks } from '@server/lib/plugins/hooks' | 7 | import { Hooks } from '@server/lib/plugins/hooks' |
8 | import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' | 8 | import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' |
9 | import { HttpStatusCode } from '@shared/models' | 9 | import { HttpStatusCode, ResultList, Video } from '@shared/models' |
10 | import { ResultList, Video } from '@shared/models' | ||
11 | import { VideosSearchQuery } from '../../../../shared/models/search' | 10 | import { VideosSearchQuery } from '../../../../shared/models/search' |
12 | import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils' | 11 | import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils' |
13 | import { logger } from '../../../helpers/logger' | 12 | import { logger } from '../../../helpers/logger' |
diff --git a/server/controllers/api/server/contact.ts b/server/controllers/api/server/contact.ts index ae36dd599..b315e99cf 100644 --- a/server/controllers/api/server/contact.ts +++ b/server/controllers/api/server/contact.ts | |||
@@ -1,9 +1,9 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { asyncMiddleware, contactAdministratorValidator } from '../../../middlewares' | ||
3 | import { Redis } from '../../../lib/redis' | ||
4 | import { Emailer } from '../../../lib/emailer' | ||
5 | import { ContactForm } from '../../../../shared/models/server' | ||
6 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | 2 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' |
3 | import { ContactForm } from '../../../../shared/models/server' | ||
4 | import { Emailer } from '../../../lib/emailer' | ||
5 | import { Redis } from '../../../lib/redis' | ||
6 | import { asyncMiddleware, contactAdministratorValidator } from '../../../middlewares' | ||
7 | 7 | ||
8 | const contactRouter = express.Router() | 8 | const contactRouter = express.Router() |
9 | 9 | ||
diff --git a/server/controllers/api/server/index.ts b/server/controllers/api/server/index.ts index 6b8793a19..32fefefc0 100644 --- a/server/controllers/api/server/index.ts +++ b/server/controllers/api/server/index.ts | |||
@@ -1,11 +1,11 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { contactRouter } from './contact' | ||
3 | import { debugRouter } from './debug' | ||
2 | import { serverFollowsRouter } from './follows' | 4 | import { serverFollowsRouter } from './follows' |
3 | import { statsRouter } from './stats' | 5 | import { logsRouter } from './logs' |
4 | import { serverRedundancyRouter } from './redundancy' | 6 | import { serverRedundancyRouter } from './redundancy' |
5 | import { serverBlocklistRouter } from './server-blocklist' | 7 | import { serverBlocklistRouter } from './server-blocklist' |
6 | import { contactRouter } from './contact' | 8 | import { statsRouter } from './stats' |
7 | import { logsRouter } from './logs' | ||
8 | import { debugRouter } from './debug' | ||
9 | 9 | ||
10 | const serverRouter = express.Router() | 10 | const serverRouter = express.Router() |
11 | 11 | ||
diff --git a/server/controllers/api/server/logs.ts b/server/controllers/api/server/logs.ts index 4b543d686..f78607d35 100644 --- a/server/controllers/api/server/logs.ts +++ b/server/controllers/api/server/logs.ts | |||
@@ -1,14 +1,14 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { UserRight } from '../../../../shared/models/users' | ||
3 | import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares' | ||
4 | import { mtimeSortFilesDesc } from '../../../../shared/core-utils/logs/logs' | ||
5 | import { readdir, readFile } from 'fs-extra' | 2 | import { readdir, readFile } from 'fs-extra' |
6 | import { AUDIT_LOG_FILENAME, MAX_LOGS_OUTPUT_CHARACTERS, LOG_FILENAME } from '../../../initializers/constants' | ||
7 | import { join } from 'path' | 3 | import { join } from 'path' |
8 | import { getAuditLogsValidator, getLogsValidator } from '../../../middlewares/validators/logs' | 4 | import { logger } from '@server/helpers/logger' |
5 | import { mtimeSortFilesDesc } from '../../../../shared/core-utils/logs/logs' | ||
9 | import { LogLevel } from '../../../../shared/models/server/log-level.type' | 6 | import { LogLevel } from '../../../../shared/models/server/log-level.type' |
7 | import { UserRight } from '../../../../shared/models/users' | ||
10 | import { CONFIG } from '../../../initializers/config' | 8 | import { CONFIG } from '../../../initializers/config' |
11 | import { logger } from '@server/helpers/logger' | 9 | import { AUDIT_LOG_FILENAME, LOG_FILENAME, MAX_LOGS_OUTPUT_CHARACTERS } from '../../../initializers/constants' |
10 | import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares' | ||
11 | import { getAuditLogsValidator, getLogsValidator } from '../../../middlewares/validators/logs' | ||
12 | 12 | ||
13 | const logsRouter = express.Router() | 13 | const logsRouter = express.Router() |
14 | 14 | ||
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts index c9610c59f..ac6faca9c 100644 --- a/server/controllers/api/users/me.ts +++ b/server/controllers/api/users/me.ts | |||
@@ -2,6 +2,7 @@ import 'multer' | |||
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger' | 3 | import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger' |
4 | import { Hooks } from '@server/lib/plugins/hooks' | 4 | import { Hooks } from '@server/lib/plugins/hooks' |
5 | import { AttributesOnly } from '@shared/core-utils' | ||
5 | import { ActorImageType, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared' | 6 | import { ActorImageType, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared' |
6 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | 7 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' |
7 | import { UserVideoQuota } from '../../../../shared/models/users/user-video-quota.model' | 8 | import { UserVideoQuota } from '../../../../shared/models/users/user-video-quota.model' |
@@ -31,7 +32,6 @@ import { AccountVideoRateModel } from '../../../models/account/account-video-rat | |||
31 | import { UserModel } from '../../../models/user/user' | 32 | import { UserModel } from '../../../models/user/user' |
32 | import { VideoModel } from '../../../models/video/video' | 33 | import { VideoModel } from '../../../models/video/video' |
33 | import { VideoImportModel } from '../../../models/video/video-import' | 34 | import { VideoImportModel } from '../../../models/video/video-import' |
34 | import { AttributesOnly } from '@shared/core-utils' | ||
35 | 35 | ||
36 | const auditLogger = auditLoggerFactory('users') | 36 | const auditLogger = auditLoggerFactory('users') |
37 | 37 | ||
diff --git a/server/controllers/api/users/my-blocklist.ts b/server/controllers/api/users/my-blocklist.ts index fe11b6e77..24fff83e3 100644 --- a/server/controllers/api/users/my-blocklist.ts +++ b/server/controllers/api/users/my-blocklist.ts | |||
@@ -1,6 +1,10 @@ | |||
1 | import * as express from 'express' | ||
2 | import 'multer' | 1 | import 'multer' |
2 | import * as express from 'express' | ||
3 | import { logger } from '@server/helpers/logger' | ||
4 | import { UserNotificationModel } from '@server/models/user/user-notification' | ||
5 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | ||
3 | import { getFormattedObjects } from '../../../helpers/utils' | 6 | import { getFormattedObjects } from '../../../helpers/utils' |
7 | import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist' | ||
4 | import { | 8 | import { |
5 | asyncMiddleware, | 9 | asyncMiddleware, |
6 | asyncRetryTransactionMiddleware, | 10 | asyncRetryTransactionMiddleware, |
@@ -18,11 +22,7 @@ import { | |||
18 | unblockServerByAccountValidator | 22 | unblockServerByAccountValidator |
19 | } from '../../../middlewares/validators' | 23 | } from '../../../middlewares/validators' |
20 | import { AccountBlocklistModel } from '../../../models/account/account-blocklist' | 24 | import { AccountBlocklistModel } from '../../../models/account/account-blocklist' |
21 | import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist' | ||
22 | import { ServerBlocklistModel } from '../../../models/server/server-blocklist' | 25 | import { ServerBlocklistModel } from '../../../models/server/server-blocklist' |
23 | import { UserNotificationModel } from '@server/models/user/user-notification' | ||
24 | import { logger } from '@server/helpers/logger' | ||
25 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | ||
26 | 26 | ||
27 | const myBlocklistRouter = express.Router() | 27 | const myBlocklistRouter = express.Router() |
28 | 28 | ||
diff --git a/server/controllers/api/users/my-history.ts b/server/controllers/api/users/my-history.ts index 85e04925e..a6e723103 100644 --- a/server/controllers/api/users/my-history.ts +++ b/server/controllers/api/users/my-history.ts | |||
@@ -1,4 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | ||
3 | import { getFormattedObjects } from '../../../helpers/utils' | ||
4 | import { sequelizeTypescript } from '../../../initializers/database' | ||
2 | import { | 5 | import { |
3 | asyncMiddleware, | 6 | asyncMiddleware, |
4 | asyncRetryTransactionMiddleware, | 7 | asyncRetryTransactionMiddleware, |
@@ -8,10 +11,7 @@ import { | |||
8 | userHistoryListValidator, | 11 | userHistoryListValidator, |
9 | userHistoryRemoveValidator | 12 | userHistoryRemoveValidator |
10 | } from '../../../middlewares' | 13 | } from '../../../middlewares' |
11 | import { getFormattedObjects } from '../../../helpers/utils' | ||
12 | import { UserVideoHistoryModel } from '../../../models/user/user-video-history' | 14 | import { UserVideoHistoryModel } from '../../../models/user/user-video-history' |
13 | import { sequelizeTypescript } from '../../../initializers/database' | ||
14 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | ||
15 | 15 | ||
16 | const myVideosHistoryRouter = express.Router() | 16 | const myVideosHistoryRouter = express.Router() |
17 | 17 | ||
diff --git a/server/controllers/api/users/my-video-playlists.ts b/server/controllers/api/users/my-video-playlists.ts index d0bd99463..76e741ba5 100644 --- a/server/controllers/api/users/my-video-playlists.ts +++ b/server/controllers/api/users/my-video-playlists.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { VideosExistInPlaylists } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model' | ||
2 | import { asyncMiddleware, authenticate } from '../../../middlewares' | 3 | import { asyncMiddleware, authenticate } from '../../../middlewares' |
3 | import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists' | 4 | import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists' |
4 | import { VideoPlaylistModel } from '../../../models/video/video-playlist' | 5 | import { VideoPlaylistModel } from '../../../models/video/video-playlist' |
5 | import { VideosExistInPlaylists } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model' | ||
6 | 6 | ||
7 | const myVideoPlaylistsRouter = express.Router() | 7 | const myVideoPlaylistsRouter = express.Router() |
8 | 8 | ||
diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts index a7f5f53d8..6bc768471 100644 --- a/server/controllers/api/videos/blacklist.ts +++ b/server/controllers/api/videos/blacklist.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist' | 2 | import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist' |
3 | import { UserRight, VideoBlacklistCreate } from '../../../../shared' | 3 | import { UserRight, VideoBlacklistCreate } from '../../../../shared' |
4 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | ||
4 | import { logger } from '../../../helpers/logger' | 5 | import { logger } from '../../../helpers/logger' |
5 | import { getFormattedObjects } from '../../../helpers/utils' | 6 | import { getFormattedObjects } from '../../../helpers/utils' |
6 | import { sequelizeTypescript } from '../../../initializers/database' | 7 | import { sequelizeTypescript } from '../../../initializers/database' |
@@ -19,7 +20,6 @@ import { | |||
19 | videosBlacklistUpdateValidator | 20 | videosBlacklistUpdateValidator |
20 | } from '../../../middlewares' | 21 | } from '../../../middlewares' |
21 | import { VideoBlacklistModel } from '../../../models/video/video-blacklist' | 22 | import { VideoBlacklistModel } from '../../../models/video/video-blacklist' |
22 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | ||
23 | 23 | ||
24 | const blacklistRouter = express.Router() | 24 | const blacklistRouter = express.Router() |
25 | 25 | ||
diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts index 90b633bb5..cb696f652 100644 --- a/server/controllers/api/videos/comment.ts +++ b/server/controllers/api/videos/comment.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | ||
3 | import { ResultList, ThreadsResultList, UserRight, VideoCommentCreate } from '../../../../shared/models' | 2 | import { ResultList, ThreadsResultList, UserRight, VideoCommentCreate } from '../../../../shared/models' |
3 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | ||
4 | import { VideoCommentThreads } from '../../../../shared/models/videos/comment/video-comment.model' | 4 | import { VideoCommentThreads } from '../../../../shared/models/videos/comment/video-comment.model' |
5 | import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger' | 5 | import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger' |
6 | import { getFormattedObjects } from '../../../helpers/utils' | 6 | import { getFormattedObjects } from '../../../helpers/utils' |
diff --git a/server/controllers/api/videos/ownership.ts b/server/controllers/api/videos/ownership.ts index e6c94a45a..f48acbc68 100644 --- a/server/controllers/api/videos/ownership.ts +++ b/server/controllers/api/videos/ownership.ts | |||
@@ -1,6 +1,12 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { MVideoFullLight } from '@server/types/models' | ||
3 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | ||
4 | import { VideoChangeOwnershipStatus, VideoState } from '../../../../shared/models/videos' | ||
2 | import { logger } from '../../../helpers/logger' | 5 | import { logger } from '../../../helpers/logger' |
6 | import { getFormattedObjects } from '../../../helpers/utils' | ||
3 | import { sequelizeTypescript } from '../../../initializers/database' | 7 | import { sequelizeTypescript } from '../../../initializers/database' |
8 | import { sendUpdateVideo } from '../../../lib/activitypub/send' | ||
9 | import { changeVideoChannelShare } from '../../../lib/activitypub/share' | ||
4 | import { | 10 | import { |
5 | asyncMiddleware, | 11 | asyncMiddleware, |
6 | asyncRetryTransactionMiddleware, | 12 | asyncRetryTransactionMiddleware, |
@@ -11,15 +17,9 @@ import { | |||
11 | videosChangeOwnershipValidator, | 17 | videosChangeOwnershipValidator, |
12 | videosTerminateChangeOwnershipValidator | 18 | videosTerminateChangeOwnershipValidator |
13 | } from '../../../middlewares' | 19 | } from '../../../middlewares' |
20 | import { VideoModel } from '../../../models/video/video' | ||
14 | import { VideoChangeOwnershipModel } from '../../../models/video/video-change-ownership' | 21 | import { VideoChangeOwnershipModel } from '../../../models/video/video-change-ownership' |
15 | import { VideoChangeOwnershipStatus, VideoState } from '../../../../shared/models/videos' | ||
16 | import { VideoChannelModel } from '../../../models/video/video-channel' | 22 | import { VideoChannelModel } from '../../../models/video/video-channel' |
17 | import { getFormattedObjects } from '../../../helpers/utils' | ||
18 | import { changeVideoChannelShare } from '../../../lib/activitypub/share' | ||
19 | import { sendUpdateVideo } from '../../../lib/activitypub/send' | ||
20 | import { VideoModel } from '../../../models/video/video' | ||
21 | import { MVideoFullLight } from '@server/types/models' | ||
22 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | ||
23 | 23 | ||
24 | const ownershipVideoRouter = express.Router() | 24 | const ownershipVideoRouter = express.Router() |
25 | 25 | ||
diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts index 134c9e5ca..96f6cd886 100644 --- a/server/controllers/api/videos/rate.ts +++ b/server/controllers/api/videos/rate.ts | |||
@@ -1,13 +1,13 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { UserVideoRateUpdate } from '../../../../shared' | 2 | import { UserVideoRateUpdate } from '../../../../shared' |
3 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | ||
3 | import { logger } from '../../../helpers/logger' | 4 | import { logger } from '../../../helpers/logger' |
4 | import { VIDEO_RATE_TYPES } from '../../../initializers/constants' | 5 | import { VIDEO_RATE_TYPES } from '../../../initializers/constants' |
6 | import { sequelizeTypescript } from '../../../initializers/database' | ||
5 | import { getLocalRateUrl, sendVideoRateChange } from '../../../lib/activitypub/video-rates' | 7 | import { getLocalRateUrl, sendVideoRateChange } from '../../../lib/activitypub/video-rates' |
6 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUpdateRateValidator } from '../../../middlewares' | 8 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUpdateRateValidator } from '../../../middlewares' |
7 | import { AccountModel } from '../../../models/account/account' | 9 | import { AccountModel } from '../../../models/account/account' |
8 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' | 10 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' |
9 | import { sequelizeTypescript } from '../../../initializers/database' | ||
10 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | ||
11 | 11 | ||
12 | const rateVideoRouter = express.Router() | 12 | const rateVideoRouter = express.Router() |
13 | 13 | ||
diff --git a/server/controllers/api/videos/watching.ts b/server/controllers/api/videos/watching.ts index 2899dbd9c..05c75e543 100644 --- a/server/controllers/api/videos/watching.ts +++ b/server/controllers/api/videos/watching.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { UserWatchingVideo } from '../../../../shared' | 2 | import { UserWatchingVideo } from '../../../../shared' |
3 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | ||
3 | import { | 4 | import { |
4 | asyncMiddleware, | 5 | asyncMiddleware, |
5 | asyncRetryTransactionMiddleware, | 6 | asyncRetryTransactionMiddleware, |
@@ -8,7 +9,6 @@ import { | |||
8 | videoWatchingValidator | 9 | videoWatchingValidator |
9 | } from '../../../middlewares' | 10 | } from '../../../middlewares' |
10 | import { UserVideoHistoryModel } from '../../../models/user/user-video-history' | 11 | import { UserVideoHistoryModel } from '../../../models/user/user-video-history' |
11 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | ||
12 | 12 | ||
13 | const watchingRouter = express.Router() | 13 | const watchingRouter = express.Router() |
14 | 14 | ||
diff --git a/server/controllers/download.ts b/server/controllers/download.ts index 13bc66900..ddacc1b68 100644 --- a/server/controllers/download.ts +++ b/server/controllers/download.ts | |||
@@ -5,8 +5,7 @@ import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache | |||
5 | import { Hooks } from '@server/lib/plugins/hooks' | 5 | import { Hooks } from '@server/lib/plugins/hooks' |
6 | import { getVideoFilePath } from '@server/lib/video-paths' | 6 | import { getVideoFilePath } from '@server/lib/video-paths' |
7 | import { MStreamingPlaylist, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' | 7 | import { MStreamingPlaylist, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' |
8 | import { HttpStatusCode } from '@shared/models' | 8 | import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models' |
9 | import { VideoStreamingPlaylistType } from '@shared/models' | ||
10 | import { STATIC_DOWNLOAD_PATHS } from '../initializers/constants' | 9 | import { STATIC_DOWNLOAD_PATHS } from '../initializers/constants' |
11 | import { asyncMiddleware, videosDownloadValidator } from '../middlewares' | 10 | import { asyncMiddleware, videosDownloadValidator } from '../middlewares' |
12 | 11 | ||
diff --git a/server/middlewares/cache.ts b/server/middlewares/cache.ts index 1ced06042..e508b22a6 100644 --- a/server/middlewares/cache.ts +++ b/server/middlewares/cache.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Redis } from '../lib/redis' | ||
2 | import * as apicache from 'apicache' | 1 | import * as apicache from 'apicache' |
3 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' | 2 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' |
3 | import { Redis } from '../lib/redis' | ||
4 | 4 | ||
5 | // Ensure Redis is initialized | 5 | // Ensure Redis is initialized |
6 | Redis.Instance.init() | 6 | Redis.Instance.init() |
diff --git a/server/middlewares/servers.ts b/server/middlewares/servers.ts index 49a2241b3..cf70d901e 100644 --- a/server/middlewares/servers.ts +++ b/server/middlewares/servers.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { getHostWithPort } from '../helpers/express-utils' | ||
3 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' | 2 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' |
3 | import { getHostWithPort } from '../helpers/express-utils' | ||
4 | 4 | ||
5 | function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) { | 5 | function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) { |
6 | if (!req.body.hosts) return next() | 6 | if (!req.body.hosts) return next() |
diff --git a/server/middlewares/user-right.ts b/server/middlewares/user-right.ts index 87a1766cf..c8c694f05 100644 --- a/server/middlewares/user-right.ts +++ b/server/middlewares/user-right.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { UserRight } from '../../shared' | 2 | import { UserRight } from '../../shared' |
3 | import { logger } from '../helpers/logger' | ||
4 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' | 3 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' |
4 | import { logger } from '../helpers/logger' | ||
5 | 5 | ||
6 | function ensureUserHasRight (userRight: UserRight) { | 6 | function ensureUserHasRight (userRight: UserRight) { |
7 | return function (req: express.Request, res: express.Response, next: express.NextFunction) { | 7 | return function (req: express.Request, res: express.Response, next: express.NextFunction) { |
diff --git a/server/middlewares/validators/activitypub/activity.ts b/server/middlewares/validators/activitypub/activity.ts index d65a8e455..d24e4427b 100644 --- a/server/middlewares/validators/activitypub/activity.ts +++ b/server/middlewares/validators/activitypub/activity.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity' | ||
3 | import { logger } from '../../../helpers/logger' | ||
4 | import { getServerActor } from '@server/models/application/application' | 2 | import { getServerActor } from '@server/models/application/application' |
5 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' | 3 | import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' |
4 | import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity' | ||
5 | import { logger } from '../../../helpers/logger' | ||
6 | 6 | ||
7 | async function activityPubValidator (req: express.Request, res: express.Response, next: express.NextFunction) { | 7 | async function activityPubValidator (req: express.Request, res: express.Response, next: express.NextFunction) { |
8 | logger.debug('Checking activity pub parameters') | 8 | logger.debug('Checking activity pub parameters') |
diff --git a/server/middlewares/validators/bulk.ts b/server/middlewares/validators/bulk.ts index 4057b1e01..6fec58149 100644 --- a/server/middlewares/validators/bulk.ts +++ b/server/middlewares/validators/bulk.ts | |||
@@ -1,8 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { body } from 'express-validator' | 2 | import { body } from 'express-validator' |
3 | import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk' | 3 | import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk' |
4 | import { HttpStatusCode } from '@shared/models' | 4 | import { HttpStatusCode, UserRight } from '@shared/models' |
5 | import { UserRight } from '@shared/models' | ||
6 | import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' | 5 | import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' |
7 | import { logger } from '../../helpers/logger' | 6 | import { logger } from '../../helpers/logger' |
8 | import { areValidationErrors, doesAccountNameWithHostExist } from './shared' | 7 | import { areValidationErrors, doesAccountNameWithHostExist } from './shared' |
diff --git a/server/middlewares/validators/feeds.ts b/server/middlewares/validators/feeds.ts index 1a5a8ffa0..d29bebf64 100644 --- a/server/middlewares/validators/feeds.ts +++ b/server/middlewares/validators/feeds.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { param, query } from 'express-validator' | 2 | import { param, query } from 'express-validator' |
3 | |||
4 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' | 3 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' |
5 | import { isValidRSSFeed } from '../../helpers/custom-validators/feeds' | 4 | import { isValidRSSFeed } from '../../helpers/custom-validators/feeds' |
6 | import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc' | 5 | import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc' |
diff --git a/server/middlewares/validators/shared/videos.ts b/server/middlewares/validators/shared/videos.ts index 7f42a4893..71b81654f 100644 --- a/server/middlewares/validators/shared/videos.ts +++ b/server/middlewares/validators/shared/videos.ts | |||
@@ -12,8 +12,7 @@ import { | |||
12 | MVideoImmutable, | 12 | MVideoImmutable, |
13 | MVideoThumbnail | 13 | MVideoThumbnail |
14 | } from '@server/types/models' | 14 | } from '@server/types/models' |
15 | import { HttpStatusCode } from '@shared/models' | 15 | import { HttpStatusCode, UserRight } from '@shared/models' |
16 | import { UserRight } from '@shared/models' | ||
17 | 16 | ||
18 | async function doesVideoExist (id: number | string, res: Response, fetchType: VideoLoadType = 'all') { | 17 | async function doesVideoExist (id: number | string, res: Response, fetchType: VideoLoadType = 'all') { |
19 | const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined | 18 | const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined |
diff --git a/server/middlewares/validators/videos/video-live.ts b/server/middlewares/validators/videos/video-live.ts index 5c8a4269d..97e8b4510 100644 --- a/server/middlewares/validators/videos/video-live.ts +++ b/server/middlewares/validators/videos/video-live.ts | |||
@@ -5,8 +5,7 @@ import { isLocalLiveVideoAccepted } from '@server/lib/moderation' | |||
5 | import { Hooks } from '@server/lib/plugins/hooks' | 5 | import { Hooks } from '@server/lib/plugins/hooks' |
6 | import { VideoModel } from '@server/models/video/video' | 6 | import { VideoModel } from '@server/models/video/video' |
7 | import { VideoLiveModel } from '@server/models/video/video-live' | 7 | import { VideoLiveModel } from '@server/models/video/video-live' |
8 | import { HttpStatusCode } from '@shared/models' | 8 | import { HttpStatusCode, ServerErrorCode, UserRight, VideoState } from '@shared/models' |
9 | import { ServerErrorCode, UserRight, VideoState } from '@shared/models' | ||
10 | import { isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc' | 9 | import { isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc' |
11 | import { isVideoNameValid } from '../../../helpers/custom-validators/videos' | 10 | import { isVideoNameValid } from '../../../helpers/custom-validators/videos' |
12 | import { cleanUpReqFiles } from '../../../helpers/express-utils' | 11 | import { cleanUpReqFiles } from '../../../helpers/express-utils' |
diff --git a/server/middlewares/validators/videos/video-ownership-changes.ts b/server/middlewares/validators/videos/video-ownership-changes.ts index 06f86a4c8..a7f0b72c3 100644 --- a/server/middlewares/validators/videos/video-ownership-changes.ts +++ b/server/middlewares/validators/videos/video-ownership-changes.ts | |||
@@ -6,8 +6,14 @@ import { logger } from '@server/helpers/logger' | |||
6 | import { isAbleToUploadVideo } from '@server/lib/user' | 6 | import { isAbleToUploadVideo } from '@server/lib/user' |
7 | import { AccountModel } from '@server/models/account/account' | 7 | import { AccountModel } from '@server/models/account/account' |
8 | import { MVideoWithAllFiles } from '@server/types/models' | 8 | import { MVideoWithAllFiles } from '@server/types/models' |
9 | import { HttpStatusCode } from '@shared/models' | 9 | import { |
10 | import { ServerErrorCode, UserRight, VideoChangeOwnershipAccept, VideoChangeOwnershipStatus, VideoState } from '@shared/models' | 10 | HttpStatusCode, |
11 | ServerErrorCode, | ||
12 | UserRight, | ||
13 | VideoChangeOwnershipAccept, | ||
14 | VideoChangeOwnershipStatus, | ||
15 | VideoState | ||
16 | } from '@shared/models' | ||
11 | import { | 17 | import { |
12 | areValidationErrors, | 18 | areValidationErrors, |
13 | checkUserCanManageVideo, | 19 | checkUserCanManageVideo, |
diff --git a/server/tests/api/activitypub/cleaner.ts b/server/tests/api/activitypub/cleaner.ts index a5ce449f3..51cf6e599 100644 --- a/server/tests/api/activitypub/cleaner.ts +++ b/server/tests/api/activitypub/cleaner.ts | |||
@@ -4,8 +4,8 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | doubleFollow, | ||
8 | createMultipleServers, | 7 | createMultipleServers, |
8 | doubleFollow, | ||
9 | PeerTubeServer, | 9 | PeerTubeServer, |
10 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
11 | wait, | 11 | wait, |
diff --git a/server/tests/api/activitypub/client.ts b/server/tests/api/activitypub/client.ts index 53cc40663..c3e4b7f74 100644 --- a/server/tests/api/activitypub/client.ts +++ b/server/tests/api/activitypub/client.ts | |||
@@ -2,17 +2,16 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | doubleFollow, | ||
9 | createMultipleServers, | 7 | createMultipleServers, |
8 | doubleFollow, | ||
10 | makeActivityPubGetRequest, | 9 | makeActivityPubGetRequest, |
11 | PeerTubeServer, | 10 | PeerTubeServer, |
12 | setAccessTokensToServers, | 11 | setAccessTokensToServers, |
13 | setDefaultVideoChannel | 12 | setDefaultVideoChannel |
14 | } from '@shared/extra-utils' | 13 | } from '@shared/extra-utils' |
15 | import { VideoPlaylistPrivacy } from '@shared/models' | 14 | import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' |
16 | 15 | ||
17 | const expect = chai.expect | 16 | const expect = chai.expect |
18 | 17 | ||
diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.ts index ddfe6cfe0..422a75d6e 100644 --- a/server/tests/api/activitypub/fetch.ts +++ b/server/tests/api/activitypub/fetch.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 5 | import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
6 | 6 | ||
7 | const expect = chai.expect | 7 | const expect = chai.expect |
8 | 8 | ||
diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.ts index a0b72c7e6..81fee0044 100644 --- a/server/tests/api/activitypub/refresher.ts +++ b/server/tests/api/activitypub/refresher.ts | |||
@@ -1,11 +1,10 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { HttpStatusCode } from '@shared/models' | ||
5 | import { | 4 | import { |
6 | cleanupTests, | 5 | cleanupTests, |
7 | doubleFollow, | ||
8 | createMultipleServers, | 6 | createMultipleServers, |
7 | doubleFollow, | ||
9 | killallServers, | 8 | killallServers, |
10 | PeerTubeServer, | 9 | PeerTubeServer, |
11 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
@@ -13,7 +12,7 @@ import { | |||
13 | wait, | 12 | wait, |
14 | waitJobs | 13 | waitJobs |
15 | } from '@shared/extra-utils' | 14 | } from '@shared/extra-utils' |
16 | import { VideoPlaylistPrivacy } from '@shared/models' | 15 | import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' |
17 | 16 | ||
18 | describe('Test AP refresher', function () { | 17 | describe('Test AP refresher', function () { |
19 | let servers: PeerTubeServer[] = [] | 18 | let servers: PeerTubeServer[] = [] |
diff --git a/server/tests/api/check-params/abuses.ts b/server/tests/api/check-params/abuses.ts index 87d93195c..72f2cbd8f 100644 --- a/server/tests/api/check-params/abuses.ts +++ b/server/tests/api/check-params/abuses.ts | |||
@@ -1,22 +1,21 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { HttpStatusCode } from '@shared/models' | ||
5 | import { | 4 | import { |
6 | AbusesCommand, | 5 | AbusesCommand, |
7 | checkBadCountPagination, | 6 | checkBadCountPagination, |
8 | checkBadSortPagination, | 7 | checkBadSortPagination, |
9 | checkBadStartPagination, | 8 | checkBadStartPagination, |
10 | cleanupTests, | 9 | cleanupTests, |
11 | doubleFollow, | ||
12 | createSingleServer, | 10 | createSingleServer, |
11 | doubleFollow, | ||
13 | makeGetRequest, | 12 | makeGetRequest, |
14 | makePostBodyRequest, | 13 | makePostBodyRequest, |
15 | PeerTubeServer, | 14 | PeerTubeServer, |
16 | setAccessTokensToServers, | 15 | setAccessTokensToServers, |
17 | waitJobs | 16 | waitJobs |
18 | } from '@shared/extra-utils' | 17 | } from '@shared/extra-utils' |
19 | import { AbuseCreate, AbuseState } from '@shared/models' | 18 | import { AbuseCreate, AbuseState, HttpStatusCode } from '@shared/models' |
20 | 19 | ||
21 | describe('Test abuses API validators', function () { | 20 | describe('Test abuses API validators', function () { |
22 | const basePath = '/api/v1/abuses/' | 21 | const basePath = '/api/v1/abuses/' |
diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.ts index 0cae485d9..141d869b7 100644 --- a/server/tests/api/check-params/accounts.ts +++ b/server/tests/api/check-params/accounts.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { HttpStatusCode } from '@shared/models' | ||
5 | import { | 4 | import { |
6 | checkBadCountPagination, | 5 | checkBadCountPagination, |
7 | checkBadSortPagination, | 6 | checkBadSortPagination, |
@@ -10,6 +9,7 @@ import { | |||
10 | createSingleServer, | 9 | createSingleServer, |
11 | PeerTubeServer | 10 | PeerTubeServer |
12 | } from '@shared/extra-utils' | 11 | } from '@shared/extra-utils' |
12 | import { HttpStatusCode } from '@shared/models' | ||
13 | 13 | ||
14 | describe('Test accounts API validators', function () { | 14 | describe('Test accounts API validators', function () { |
15 | const path = '/api/v1/accounts/' | 15 | const path = '/api/v1/accounts/' |
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index c3438917e..87cb2287e 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { omit } from 'lodash' | 4 | import { omit } from 'lodash' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | createSingleServer, | 7 | createSingleServer, |
@@ -12,7 +11,7 @@ import { | |||
12 | PeerTubeServer, | 11 | PeerTubeServer, |
13 | setAccessTokensToServers | 12 | setAccessTokensToServers |
14 | } from '@shared/extra-utils' | 13 | } from '@shared/extra-utils' |
15 | import { CustomConfig } from '@shared/models' | 14 | import { CustomConfig, HttpStatusCode } from '@shared/models' |
16 | 15 | ||
17 | describe('Test config API validators', function () { | 16 | describe('Test config API validators', function () { |
18 | const path = '/api/v1/config/custom' | 17 | const path = '/api/v1/config/custom' |
diff --git a/server/tests/api/check-params/contact-form.ts b/server/tests/api/check-params/contact-form.ts index 8e755c69b..1df9993da 100644 --- a/server/tests/api/check-params/contact-form.ts +++ b/server/tests/api/check-params/contact-form.ts | |||
@@ -1,9 +1,9 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { HttpStatusCode } from '@shared/models' | ||
5 | import { cleanupTests, createSingleServer, killallServers, MockSmtpServer, PeerTubeServer } from '@shared/extra-utils' | 4 | import { cleanupTests, createSingleServer, killallServers, MockSmtpServer, PeerTubeServer } from '@shared/extra-utils' |
6 | import { ContactFormCommand } from '@shared/extra-utils/server' | 5 | import { ContactFormCommand } from '@shared/extra-utils/server' |
6 | import { HttpStatusCode } from '@shared/models' | ||
7 | 7 | ||
8 | describe('Test contact form API validators', function () { | 8 | describe('Test contact form API validators', function () { |
9 | let server: PeerTubeServer | 9 | let server: PeerTubeServer |
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts index 0ef86a538..700b4724d 100644 --- a/server/tests/api/check-params/live.ts +++ b/server/tests/api/check-params/live.ts | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { omit } from 'lodash' | 4 | import { omit } from 'lodash' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | buildAbsoluteFixturePath, | 6 | buildAbsoluteFixturePath, |
8 | cleanupTests, | 7 | cleanupTests, |
@@ -10,12 +9,12 @@ import { | |||
10 | LiveCommand, | 9 | LiveCommand, |
11 | makePostBodyRequest, | 10 | makePostBodyRequest, |
12 | makeUploadRequest, | 11 | makeUploadRequest, |
13 | sendRTMPStream, | ||
14 | PeerTubeServer, | 12 | PeerTubeServer, |
13 | sendRTMPStream, | ||
15 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
16 | stopFfmpeg | 15 | stopFfmpeg |
17 | } from '@shared/extra-utils' | 16 | } from '@shared/extra-utils' |
18 | import { VideoCreateResult, VideoPrivacy } from '@shared/models' | 17 | import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' |
19 | 18 | ||
20 | describe('Test video lives API validator', function () { | 19 | describe('Test video lives API validator', function () { |
21 | const path = '/api/v1/videos/live' | 20 | const path = '/api/v1/videos/live' |
diff --git a/server/tests/api/check-params/plugins.ts b/server/tests/api/check-params/plugins.ts index d3dda7fce..33f84ecbc 100644 --- a/server/tests/api/check-params/plugins.ts +++ b/server/tests/api/check-params/plugins.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { HttpStatusCode } from '@shared/models' | ||
5 | import { | 4 | import { |
6 | checkBadCountPagination, | 5 | checkBadCountPagination, |
7 | checkBadSortPagination, | 6 | checkBadSortPagination, |
@@ -14,7 +13,7 @@ import { | |||
14 | PeerTubeServer, | 13 | PeerTubeServer, |
15 | setAccessTokensToServers | 14 | setAccessTokensToServers |
16 | } from '@shared/extra-utils' | 15 | } from '@shared/extra-utils' |
17 | import { PeerTubePlugin, PluginType } from '@shared/models' | 16 | import { HttpStatusCode, PeerTubePlugin, PluginType } from '@shared/models' |
18 | 17 | ||
19 | describe('Test server plugins API validators', function () { | 18 | describe('Test server plugins API validators', function () { |
20 | let server: PeerTubeServer | 19 | let server: PeerTubeServer |
diff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.ts index b49169e38..a3da54e1f 100644 --- a/server/tests/api/check-params/search.ts +++ b/server/tests/api/check-params/search.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { HttpStatusCode } from '@shared/models' | ||
5 | import { | 4 | import { |
6 | checkBadCountPagination, | 5 | checkBadCountPagination, |
7 | checkBadSortPagination, | 6 | checkBadSortPagination, |
@@ -12,6 +11,7 @@ import { | |||
12 | PeerTubeServer, | 11 | PeerTubeServer, |
13 | setAccessTokensToServers | 12 | setAccessTokensToServers |
14 | } from '@shared/extra-utils' | 13 | } from '@shared/extra-utils' |
14 | import { HttpStatusCode } from '@shared/models' | ||
15 | 15 | ||
16 | function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) { | 16 | function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) { |
17 | return server.config.updateCustomSubConfig({ | 17 | return server.config.updateCustomSubConfig({ |
diff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.ts index 973b25598..4c4a5cade 100644 --- a/server/tests/api/check-params/services.ts +++ b/server/tests/api/check-params/services.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { HttpStatusCode } from '@shared/models' | ||
5 | import { | 4 | import { |
6 | cleanupTests, | 5 | cleanupTests, |
7 | createSingleServer, | 6 | createSingleServer, |
@@ -10,7 +9,7 @@ import { | |||
10 | setAccessTokensToServers, | 9 | setAccessTokensToServers, |
11 | setDefaultVideoChannel | 10 | setDefaultVideoChannel |
12 | } from '@shared/extra-utils' | 11 | } from '@shared/extra-utils' |
13 | import { VideoPlaylistPrivacy } from '@shared/models' | 12 | import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' |
14 | 13 | ||
15 | describe('Test services API validators', function () { | 14 | describe('Test services API validators', function () { |
16 | let server: PeerTubeServer | 15 | let server: PeerTubeServer |
diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts index 3b709ee5a..17edf5aa1 100644 --- a/server/tests/api/check-params/user-notifications.ts +++ b/server/tests/api/check-params/user-notifications.ts | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { io } from 'socket.io-client' | 4 | import { io } from 'socket.io-client' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | checkBadCountPagination, | 6 | checkBadCountPagination, |
8 | checkBadSortPagination, | 7 | checkBadSortPagination, |
@@ -16,7 +15,7 @@ import { | |||
16 | setAccessTokensToServers, | 15 | setAccessTokensToServers, |
17 | wait | 16 | wait |
18 | } from '@shared/extra-utils' | 17 | } from '@shared/extra-utils' |
19 | import { UserNotificationSetting, UserNotificationSettingValue } from '@shared/models' | 18 | import { HttpStatusCode, UserNotificationSetting, UserNotificationSettingValue } from '@shared/models' |
20 | 19 | ||
21 | describe('Test user notifications API validators', function () { | 20 | describe('Test user notifications API validators', function () { |
22 | let server: PeerTubeServer | 21 | let server: PeerTubeServer |
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index 34fe309f9..9d8f933db 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { omit } from 'lodash' | 4 | import { omit } from 'lodash' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | buildAbsoluteFixturePath, | 6 | buildAbsoluteFixturePath, |
8 | checkBadCountPagination, | 7 | checkBadCountPagination, |
@@ -20,7 +19,7 @@ import { | |||
20 | setAccessTokensToServers, | 19 | setAccessTokensToServers, |
21 | UsersCommand | 20 | UsersCommand |
22 | } from '@shared/extra-utils' | 21 | } from '@shared/extra-utils' |
23 | import { UserAdminFlag, UserRole, VideoCreateResult } from '@shared/models' | 22 | import { HttpStatusCode, UserAdminFlag, UserRole, VideoCreateResult } from '@shared/models' |
24 | 23 | ||
25 | describe('Test users API validators', function () { | 24 | describe('Test users API validators', function () { |
26 | const path = '/api/v1/users/' | 25 | const path = '/api/v1/users/' |
diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts index 2072df4b6..d28c6a952 100644 --- a/server/tests/api/check-params/video-blacklist.ts +++ b/server/tests/api/check-params/video-blacklist.ts | |||
@@ -2,22 +2,21 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | BlacklistCommand, | 6 | BlacklistCommand, |
8 | checkBadCountPagination, | 7 | checkBadCountPagination, |
9 | checkBadSortPagination, | 8 | checkBadSortPagination, |
10 | checkBadStartPagination, | 9 | checkBadStartPagination, |
11 | cleanupTests, | 10 | cleanupTests, |
12 | doubleFollow, | ||
13 | createMultipleServers, | 11 | createMultipleServers, |
12 | doubleFollow, | ||
14 | makePostBodyRequest, | 13 | makePostBodyRequest, |
15 | makePutBodyRequest, | 14 | makePutBodyRequest, |
16 | PeerTubeServer, | 15 | PeerTubeServer, |
17 | setAccessTokensToServers, | 16 | setAccessTokensToServers, |
18 | waitJobs | 17 | waitJobs |
19 | } from '@shared/extra-utils' | 18 | } from '@shared/extra-utils' |
20 | import { VideoBlacklistType } from '@shared/models' | 19 | import { HttpStatusCode, VideoBlacklistType } from '@shared/models' |
21 | 20 | ||
22 | describe('Test video blacklist API validators', function () { | 21 | describe('Test video blacklist API validators', function () { |
23 | let servers: PeerTubeServer[] | 22 | let servers: PeerTubeServer[] |
diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts index 1b3d1aa95..5aaeb27fe 100644 --- a/server/tests/api/check-params/video-captions.ts +++ b/server/tests/api/check-params/video-captions.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { HttpStatusCode } from '@shared/models' | ||
5 | import { | 4 | import { |
6 | buildAbsoluteFixturePath, | 5 | buildAbsoluteFixturePath, |
7 | cleanupTests, | 6 | cleanupTests, |
@@ -12,7 +11,7 @@ import { | |||
12 | PeerTubeServer, | 11 | PeerTubeServer, |
13 | setAccessTokensToServers | 12 | setAccessTokensToServers |
14 | } from '@shared/extra-utils' | 13 | } from '@shared/extra-utils' |
15 | import { VideoCreateResult } from '@shared/models' | 14 | import { HttpStatusCode, VideoCreateResult } from '@shared/models' |
16 | 15 | ||
17 | describe('Test video captions API validator', function () { | 16 | describe('Test video captions API validator', function () { |
18 | const path = '/api/v1/videos/' | 17 | const path = '/api/v1/videos/' |
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts index bbe42e43d..2e63916d4 100644 --- a/server/tests/api/check-params/video-channels.ts +++ b/server/tests/api/check-params/video-channels.ts | |||
@@ -3,7 +3,6 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { omit } from 'lodash' | 5 | import { omit } from 'lodash' |
6 | import { HttpStatusCode } from '@shared/models' | ||
7 | import { | 6 | import { |
8 | buildAbsoluteFixturePath, | 7 | buildAbsoluteFixturePath, |
9 | ChannelsCommand, | 8 | ChannelsCommand, |
@@ -19,7 +18,7 @@ import { | |||
19 | PeerTubeServer, | 18 | PeerTubeServer, |
20 | setAccessTokensToServers | 19 | setAccessTokensToServers |
21 | } from '@shared/extra-utils' | 20 | } from '@shared/extra-utils' |
22 | import { VideoChannelUpdate } from '@shared/models' | 21 | import { HttpStatusCode, VideoChannelUpdate } from '@shared/models' |
23 | 22 | ||
24 | const expect = chai.expect | 23 | const expect = chai.expect |
25 | 24 | ||
diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts index bfd9e0172..2d9ee1e0d 100644 --- a/server/tests/api/check-params/video-comments.ts +++ b/server/tests/api/check-params/video-comments.ts | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | checkBadCountPagination, | 6 | checkBadCountPagination, |
8 | checkBadSortPagination, | 7 | checkBadSortPagination, |
@@ -15,7 +14,7 @@ import { | |||
15 | PeerTubeServer, | 14 | PeerTubeServer, |
16 | setAccessTokensToServers | 15 | setAccessTokensToServers |
17 | } from '@shared/extra-utils' | 16 | } from '@shared/extra-utils' |
18 | import { VideoCreateResult } from '@shared/models' | 17 | import { HttpStatusCode, VideoCreateResult } from '@shared/models' |
19 | 18 | ||
20 | const expect = chai.expect | 19 | const expect = chai.expect |
21 | 20 | ||
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts index 957556c9b..d6d745488 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { omit } from 'lodash' | 4 | import { omit } from 'lodash' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | buildAbsoluteFixturePath, | 6 | buildAbsoluteFixturePath, |
8 | checkBadCountPagination, | 7 | checkBadCountPagination, |
@@ -17,7 +16,7 @@ import { | |||
17 | PeerTubeServer, | 16 | PeerTubeServer, |
18 | setAccessTokensToServers | 17 | setAccessTokensToServers |
19 | } from '@shared/extra-utils' | 18 | } from '@shared/extra-utils' |
20 | import { VideoPrivacy } from '@shared/models' | 19 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' |
21 | 20 | ||
22 | describe('Test video imports API validator', function () { | 21 | describe('Test video imports API validator', function () { |
23 | const path = '/api/v1/videos/imports' | 22 | const path = '/api/v1/videos/imports' |
diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts index 7dcb4935a..e4d541b48 100644 --- a/server/tests/api/check-params/video-playlists.ts +++ b/server/tests/api/check-params/video-playlists.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { HttpStatusCode } from '@shared/models' | ||
5 | import { | 4 | import { |
6 | checkBadCountPagination, | 5 | checkBadCountPagination, |
7 | checkBadSortPagination, | 6 | checkBadSortPagination, |
@@ -9,12 +8,13 @@ import { | |||
9 | cleanupTests, | 8 | cleanupTests, |
10 | createSingleServer, | 9 | createSingleServer, |
11 | makeGetRequest, | 10 | makeGetRequest, |
12 | PlaylistsCommand, | ||
13 | PeerTubeServer, | 11 | PeerTubeServer, |
12 | PlaylistsCommand, | ||
14 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
15 | setDefaultVideoChannel | 14 | setDefaultVideoChannel |
16 | } from '@shared/extra-utils' | 15 | } from '@shared/extra-utils' |
17 | import { | 16 | import { |
17 | HttpStatusCode, | ||
18 | VideoPlaylistCreate, | 18 | VideoPlaylistCreate, |
19 | VideoPlaylistCreateResult, | 19 | VideoPlaylistCreateResult, |
20 | VideoPlaylistElementCreate, | 20 | VideoPlaylistElementCreate, |
diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.ts index c2c69904f..d08570bbe 100644 --- a/server/tests/api/check-params/videos-filter.ts +++ b/server/tests/api/check-params/videos-filter.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { HttpStatusCode } from '@shared/models' | ||
5 | import { | 4 | import { |
6 | cleanupTests, | 5 | cleanupTests, |
7 | createSingleServer, | 6 | createSingleServer, |
@@ -10,7 +9,7 @@ import { | |||
10 | setAccessTokensToServers, | 9 | setAccessTokensToServers, |
11 | setDefaultVideoChannel | 10 | setDefaultVideoChannel |
12 | } from '@shared/extra-utils' | 11 | } from '@shared/extra-utils' |
13 | import { UserRole } from '@shared/models' | 12 | import { HttpStatusCode, UserRole } from '@shared/models' |
14 | 13 | ||
15 | async function testEndpoints (server: PeerTubeServer, token: string, filter: string, expectedStatus: HttpStatusCode) { | 14 | async function testEndpoints (server: PeerTubeServer, token: string, filter: string, expectedStatus: HttpStatusCode) { |
16 | const paths = [ | 15 | const paths = [ |
diff --git a/server/tests/api/check-params/videos-history.ts b/server/tests/api/check-params/videos-history.ts index 7283a4d28..c3c309ed2 100644 --- a/server/tests/api/check-params/videos-history.ts +++ b/server/tests/api/check-params/videos-history.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { HttpStatusCode } from '@shared/models' | ||
5 | import { | 4 | import { |
6 | checkBadCountPagination, | 5 | checkBadCountPagination, |
7 | checkBadStartPagination, | 6 | checkBadStartPagination, |
@@ -13,6 +12,7 @@ import { | |||
13 | PeerTubeServer, | 12 | PeerTubeServer, |
14 | setAccessTokensToServers | 13 | setAccessTokensToServers |
15 | } from '@shared/extra-utils' | 14 | } from '@shared/extra-utils' |
15 | import { HttpStatusCode } from '@shared/models' | ||
16 | 16 | ||
17 | describe('Test videos history API validator', function () { | 17 | describe('Test videos history API validator', function () { |
18 | const myHistoryPath = '/api/v1/users/me/history/videos' | 18 | const myHistoryPath = '/api/v1/users/me/history/videos' |
diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts index a00833569..20346113d 100644 --- a/server/tests/api/live/live-constraints.ts +++ b/server/tests/api/live/live-constraints.ts | |||
@@ -7,8 +7,8 @@ import { | |||
7 | checkLiveCleanup, | 7 | checkLiveCleanup, |
8 | cleanupTests, | 8 | cleanupTests, |
9 | ConfigCommand, | 9 | ConfigCommand, |
10 | doubleFollow, | ||
11 | createMultipleServers, | 10 | createMultipleServers, |
11 | doubleFollow, | ||
12 | PeerTubeServer, | 12 | PeerTubeServer, |
13 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
14 | setDefaultVideoChannel, | 14 | setDefaultVideoChannel, |
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts index 30d499e20..f07d4cfec 100644 --- a/server/tests/api/live/live-permanent.ts +++ b/server/tests/api/live/live-permanent.ts | |||
@@ -6,8 +6,8 @@ import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models' | |||
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
8 | ConfigCommand, | 8 | ConfigCommand, |
9 | doubleFollow, | ||
10 | createMultipleServers, | 9 | createMultipleServers, |
10 | doubleFollow, | ||
11 | PeerTubeServer, | 11 | PeerTubeServer, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | setDefaultVideoChannel, | 13 | setDefaultVideoChannel, |
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts index 095c51b97..bd15396ec 100644 --- a/server/tests/api/live/live-save-replay.ts +++ b/server/tests/api/live/live-save-replay.ts | |||
@@ -3,13 +3,12 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { FfmpegCommand } from 'fluent-ffmpeg' | 5 | import { FfmpegCommand } from 'fluent-ffmpeg' |
6 | import { HttpStatusCode } from '@shared/models' | ||
7 | import { | 6 | import { |
8 | checkLiveCleanup, | 7 | checkLiveCleanup, |
9 | cleanupTests, | 8 | cleanupTests, |
10 | ConfigCommand, | 9 | ConfigCommand, |
11 | doubleFollow, | ||
12 | createMultipleServers, | 10 | createMultipleServers, |
11 | doubleFollow, | ||
13 | PeerTubeServer, | 12 | PeerTubeServer, |
14 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
15 | setDefaultVideoChannel, | 14 | setDefaultVideoChannel, |
@@ -18,7 +17,7 @@ import { | |||
18 | wait, | 17 | wait, |
19 | waitJobs | 18 | waitJobs |
20 | } from '@shared/extra-utils' | 19 | } from '@shared/extra-utils' |
21 | import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models' | 20 | import { HttpStatusCode, LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models' |
22 | 21 | ||
23 | const expect = chai.expect | 22 | const expect = chai.expect |
24 | 23 | ||
diff --git a/server/tests/api/live/live-socket-messages.ts b/server/tests/api/live/live-socket-messages.ts index 3808964d1..2a1f9f108 100644 --- a/server/tests/api/live/live-socket-messages.ts +++ b/server/tests/api/live/live-socket-messages.ts | |||
@@ -5,8 +5,8 @@ import * as chai from 'chai' | |||
5 | import { VideoPrivacy, VideoState } from '@shared/models' | 5 | import { VideoPrivacy, VideoState } from '@shared/models' |
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
8 | doubleFollow, | ||
9 | createMultipleServers, | 8 | createMultipleServers, |
9 | doubleFollow, | ||
10 | PeerTubeServer, | 10 | PeerTubeServer, |
11 | setAccessTokensToServers, | 11 | setAccessTokensToServers, |
12 | setDefaultVideoChannel, | 12 | setDefaultVideoChannel, |
diff --git a/server/tests/api/live/live-views.ts b/server/tests/api/live/live-views.ts index 4a137b185..5e3a79c64 100644 --- a/server/tests/api/live/live-views.ts +++ b/server/tests/api/live/live-views.ts | |||
@@ -6,8 +6,8 @@ import { FfmpegCommand } from 'fluent-ffmpeg' | |||
6 | import { VideoPrivacy } from '@shared/models' | 6 | import { VideoPrivacy } from '@shared/models' |
7 | import { | 7 | import { |
8 | cleanupTests, | 8 | cleanupTests, |
9 | doubleFollow, | ||
10 | createMultipleServers, | 9 | createMultipleServers, |
10 | doubleFollow, | ||
11 | PeerTubeServer, | 11 | PeerTubeServer, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | setDefaultVideoChannel, | 13 | setDefaultVideoChannel, |
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index 88995910c..4676a840a 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts | |||
@@ -4,19 +4,18 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils' | 6 | import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils' |
7 | import { HttpStatusCode } from '@shared/models' | ||
8 | import { | 7 | import { |
9 | checkLiveCleanup, | 8 | checkLiveCleanup, |
10 | checkLiveSegmentHash, | 9 | checkLiveSegmentHash, |
11 | checkResolutionsInMasterPlaylist, | 10 | checkResolutionsInMasterPlaylist, |
12 | cleanupTests, | 11 | cleanupTests, |
13 | doubleFollow, | ||
14 | createMultipleServers, | 12 | createMultipleServers, |
13 | doubleFollow, | ||
15 | killallServers, | 14 | killallServers, |
16 | LiveCommand, | 15 | LiveCommand, |
17 | makeRawRequest, | 16 | makeRawRequest, |
18 | sendRTMPStream, | ||
19 | PeerTubeServer, | 17 | PeerTubeServer, |
18 | sendRTMPStream, | ||
20 | setAccessTokensToServers, | 19 | setAccessTokensToServers, |
21 | setDefaultVideoChannel, | 20 | setDefaultVideoChannel, |
22 | stopFfmpeg, | 21 | stopFfmpeg, |
@@ -26,7 +25,15 @@ import { | |||
26 | waitJobs, | 25 | waitJobs, |
27 | waitUntilLivePublishedOnAllServers | 26 | waitUntilLivePublishedOnAllServers |
28 | } from '@shared/extra-utils' | 27 | } from '@shared/extra-utils' |
29 | import { LiveVideo, LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models' | 28 | import { |
29 | HttpStatusCode, | ||
30 | LiveVideo, | ||
31 | LiveVideoCreate, | ||
32 | VideoDetails, | ||
33 | VideoPrivacy, | ||
34 | VideoState, | ||
35 | VideoStreamingPlaylistType | ||
36 | } from '@shared/models' | ||
30 | 37 | ||
31 | const expect = chai.expect | 38 | const expect = chai.expect |
32 | 39 | ||
diff --git a/server/tests/api/moderation/blocklist-notification.ts b/server/tests/api/moderation/blocklist-notification.ts index fdfbcbced..75b15c298 100644 --- a/server/tests/api/moderation/blocklist-notification.ts +++ b/server/tests/api/moderation/blocklist-notification.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 5 | import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
6 | import { UserNotificationType } from '@shared/models' | 6 | import { UserNotificationType } from '@shared/models' |
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.ts index 593291e87..8ed5ad9e5 100644 --- a/server/tests/api/moderation/blocklist.ts +++ b/server/tests/api/moderation/blocklist.ts | |||
@@ -6,8 +6,8 @@ import { | |||
6 | BlocklistCommand, | 6 | BlocklistCommand, |
7 | cleanupTests, | 7 | cleanupTests, |
8 | CommentsCommand, | 8 | CommentsCommand, |
9 | doubleFollow, | ||
10 | createMultipleServers, | 9 | createMultipleServers, |
10 | doubleFollow, | ||
11 | PeerTubeServer, | 11 | PeerTubeServer, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | waitJobs | 13 | waitJobs |
diff --git a/server/tests/api/notifications/admin-notifications.ts b/server/tests/api/notifications/admin-notifications.ts index d65551f0a..b36ba11a9 100644 --- a/server/tests/api/notifications/admin-notifications.ts +++ b/server/tests/api/notifications/admin-notifications.ts | |||
@@ -9,8 +9,8 @@ import { | |||
9 | cleanupTests, | 9 | cleanupTests, |
10 | MockJoinPeerTubeVersions, | 10 | MockJoinPeerTubeVersions, |
11 | MockSmtpServer, | 11 | MockSmtpServer, |
12 | prepareNotificationsTest, | ||
13 | PeerTubeServer, | 12 | PeerTubeServer, |
13 | prepareNotificationsTest, | ||
14 | wait | 14 | wait |
15 | } from '@shared/extra-utils' | 15 | } from '@shared/extra-utils' |
16 | import { PluginType, UserNotification, UserNotificationType } from '@shared/models' | 16 | import { PluginType, UserNotification, UserNotificationType } from '@shared/models' |
diff --git a/server/tests/api/notifications/comments-notifications.ts b/server/tests/api/notifications/comments-notifications.ts index d54819aaa..cbb46e510 100644 --- a/server/tests/api/notifications/comments-notifications.ts +++ b/server/tests/api/notifications/comments-notifications.ts | |||
@@ -8,8 +8,8 @@ import { | |||
8 | checkNewCommentOnMyVideo, | 8 | checkNewCommentOnMyVideo, |
9 | cleanupTests, | 9 | cleanupTests, |
10 | MockSmtpServer, | 10 | MockSmtpServer, |
11 | prepareNotificationsTest, | ||
12 | PeerTubeServer, | 11 | PeerTubeServer, |
12 | prepareNotificationsTest, | ||
13 | waitJobs | 13 | waitJobs |
14 | } from '@shared/extra-utils' | 14 | } from '@shared/extra-utils' |
15 | import { UserNotification } from '@shared/models' | 15 | import { UserNotification } from '@shared/models' |
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts index 3a294192b..6e8f8a2b4 100644 --- a/server/tests/api/notifications/moderation-notifications.ts +++ b/server/tests/api/notifications/moderation-notifications.ts | |||
@@ -19,8 +19,8 @@ import { | |||
19 | cleanupTests, | 19 | cleanupTests, |
20 | MockInstancesIndex, | 20 | MockInstancesIndex, |
21 | MockSmtpServer, | 21 | MockSmtpServer, |
22 | prepareNotificationsTest, | ||
23 | PeerTubeServer, | 22 | PeerTubeServer, |
23 | prepareNotificationsTest, | ||
24 | wait, | 24 | wait, |
25 | waitJobs | 25 | waitJobs |
26 | } from '@shared/extra-utils' | 26 | } from '@shared/extra-utils' |
diff --git a/server/tests/api/notifications/notifications-api.ts b/server/tests/api/notifications/notifications-api.ts index 178b20687..fa4b53db6 100644 --- a/server/tests/api/notifications/notifications-api.ts +++ b/server/tests/api/notifications/notifications-api.ts | |||
@@ -8,8 +8,8 @@ import { | |||
8 | cleanupTests, | 8 | cleanupTests, |
9 | getAllNotificationsSettings, | 9 | getAllNotificationsSettings, |
10 | MockSmtpServer, | 10 | MockSmtpServer, |
11 | prepareNotificationsTest, | ||
12 | PeerTubeServer, | 11 | PeerTubeServer, |
12 | prepareNotificationsTest, | ||
13 | waitJobs | 13 | waitJobs |
14 | } from '@shared/extra-utils' | 14 | } from '@shared/extra-utils' |
15 | import { UserNotification, UserNotificationSettingValue } from '@shared/models' | 15 | import { UserNotification, UserNotificationSettingValue } from '@shared/models' |
diff --git a/server/tests/api/redundancy/manage-redundancy.ts b/server/tests/api/redundancy/manage-redundancy.ts index aff64e2eb..5fd464ded 100644 --- a/server/tests/api/redundancy/manage-redundancy.ts +++ b/server/tests/api/redundancy/manage-redundancy.ts | |||
@@ -4,10 +4,10 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | doubleFollow, | ||
8 | createMultipleServers, | 7 | createMultipleServers, |
9 | RedundancyCommand, | 8 | doubleFollow, |
10 | PeerTubeServer, | 9 | PeerTubeServer, |
10 | RedundancyCommand, | ||
11 | setAccessTokensToServers, | 11 | setAccessTokensToServers, |
12 | waitJobs | 12 | waitJobs |
13 | } from '@shared/extra-utils' | 13 | } from '@shared/extra-utils' |
diff --git a/server/tests/api/redundancy/redundancy-constraints.ts b/server/tests/api/redundancy/redundancy-constraints.ts index 71b93901e..25cd11658 100644 --- a/server/tests/api/redundancy/redundancy-constraints.ts +++ b/server/tests/api/redundancy/redundancy-constraints.ts | |||
@@ -2,14 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { | 5 | import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
6 | cleanupTests, | ||
7 | createSingleServer, | ||
8 | killallServers, | ||
9 | PeerTubeServer, | ||
10 | setAccessTokensToServers, | ||
11 | waitJobs | ||
12 | } from '@shared/extra-utils' | ||
13 | import { VideoPrivacy } from '@shared/models' | 6 | import { VideoPrivacy } from '@shared/models' |
14 | 7 | ||
15 | describe('Test redundancy constraints', function () { | 8 | describe('Test redundancy constraints', function () { |
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts index 921a48856..a6559d304 100644 --- a/server/tests/api/redundancy/redundancy.ts +++ b/server/tests/api/redundancy/redundancy.ts | |||
@@ -5,22 +5,21 @@ import * as chai from 'chai' | |||
5 | import { readdir } from 'fs-extra' | 5 | import { readdir } from 'fs-extra' |
6 | import * as magnetUtil from 'magnet-uri' | 6 | import * as magnetUtil from 'magnet-uri' |
7 | import { join } from 'path' | 7 | import { join } from 'path' |
8 | import { HttpStatusCode } from '@shared/models' | ||
9 | import { | 8 | import { |
10 | checkSegmentHash, | 9 | checkSegmentHash, |
11 | checkVideoFilesWereRemoved, | 10 | checkVideoFilesWereRemoved, |
12 | cleanupTests, | 11 | cleanupTests, |
13 | doubleFollow, | ||
14 | createMultipleServers, | 12 | createMultipleServers, |
13 | doubleFollow, | ||
15 | killallServers, | 14 | killallServers, |
16 | makeGetRequest, | 15 | makeGetRequest, |
17 | root, | ||
18 | PeerTubeServer, | 16 | PeerTubeServer, |
17 | root, | ||
19 | setAccessTokensToServers, | 18 | setAccessTokensToServers, |
20 | wait, | 19 | wait, |
21 | waitJobs | 20 | waitJobs |
22 | } from '@shared/extra-utils' | 21 | } from '@shared/extra-utils' |
23 | import { VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '@shared/models' | 22 | import { HttpStatusCode, VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '@shared/models' |
24 | 23 | ||
25 | const expect = chai.expect | 24 | const expect = chai.expect |
26 | 25 | ||
diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts index b33f28266..426cbc8e1 100644 --- a/server/tests/api/search/search-activitypub-video-channels.ts +++ b/server/tests/api/search/search-activitypub-video-channels.ts | |||
@@ -5,8 +5,8 @@ import * as chai from 'chai' | |||
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | createMultipleServers, | 7 | createMultipleServers, |
8 | SearchCommand, | ||
9 | PeerTubeServer, | 8 | PeerTubeServer, |
9 | SearchCommand, | ||
10 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
11 | wait, | 11 | wait, |
12 | waitJobs | 12 | waitJobs |
diff --git a/server/tests/api/search/search-activitypub-video-playlists.ts b/server/tests/api/search/search-activitypub-video-playlists.ts index ada2d3d6c..33ca7be12 100644 --- a/server/tests/api/search/search-activitypub-video-playlists.ts +++ b/server/tests/api/search/search-activitypub-video-playlists.ts | |||
@@ -5,8 +5,8 @@ import * as chai from 'chai' | |||
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | createMultipleServers, | 7 | createMultipleServers, |
8 | SearchCommand, | ||
9 | PeerTubeServer, | 8 | PeerTubeServer, |
9 | SearchCommand, | ||
10 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
11 | setDefaultVideoChannel, | 11 | setDefaultVideoChannel, |
12 | wait, | 12 | wait, |
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts index a015b72a7..b3cfcacca 100644 --- a/server/tests/api/search/search-activitypub-videos.ts +++ b/server/tests/api/search/search-activitypub-videos.ts | |||
@@ -5,8 +5,8 @@ import * as chai from 'chai' | |||
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | createMultipleServers, | 7 | createMultipleServers, |
8 | SearchCommand, | ||
9 | PeerTubeServer, | 8 | PeerTubeServer, |
9 | SearchCommand, | ||
10 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
11 | wait, | 11 | wait, |
12 | waitJobs | 12 | waitJobs |
diff --git a/server/tests/api/search/search-channels.ts b/server/tests/api/search/search-channels.ts index 07e00a214..4da2d0ece 100644 --- a/server/tests/api/search/search-channels.ts +++ b/server/tests/api/search/search-channels.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, PeerTubeServer, SearchCommand, setAccessTokensToServers } from '@shared/extra-utils' |
6 | import { VideoChannel } from '@shared/models' | 6 | import { VideoChannel } from '@shared/models' |
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts index 38edcf7c6..feb35411f 100644 --- a/server/tests/api/search/search-index.ts +++ b/server/tests/api/search/search-index.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, PeerTubeServer, SearchCommand, setAccessTokensToServers } from '@shared/extra-utils' |
6 | import { BooleanBothQuery, VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models' | 6 | import { BooleanBothQuery, VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models' |
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
diff --git a/server/tests/api/search/search-playlists.ts b/server/tests/api/search/search-playlists.ts index b29c2d127..22e9b8fca 100644 --- a/server/tests/api/search/search-playlists.ts +++ b/server/tests/api/search/search-playlists.ts | |||
@@ -5,8 +5,8 @@ import * as chai from 'chai' | |||
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | createSingleServer, | 7 | createSingleServer, |
8 | SearchCommand, | ||
9 | PeerTubeServer, | 8 | PeerTubeServer, |
9 | SearchCommand, | ||
10 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
11 | setDefaultVideoChannel | 11 | setDefaultVideoChannel |
12 | } from '@shared/extra-utils' | 12 | } from '@shared/extra-utils' |
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts index a9b0a4fcd..f834c7f36 100644 --- a/server/tests/api/search/search-videos.ts +++ b/server/tests/api/search/search-videos.ts | |||
@@ -5,8 +5,8 @@ import * as chai from 'chai' | |||
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | createSingleServer, | 7 | createSingleServer, |
8 | SearchCommand, | ||
9 | PeerTubeServer, | 8 | PeerTubeServer, |
9 | SearchCommand, | ||
10 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
11 | setDefaultVideoChannel, | 11 | setDefaultVideoChannel, |
12 | stopFfmpeg, | 12 | stopFfmpeg, |
diff --git a/server/tests/api/server/bulk.ts b/server/tests/api/server/bulk.ts index 5d8c87983..16cbcd5c3 100644 --- a/server/tests/api/server/bulk.ts +++ b/server/tests/api/server/bulk.ts | |||
@@ -5,8 +5,8 @@ import * as chai from 'chai' | |||
5 | import { | 5 | import { |
6 | BulkCommand, | 6 | BulkCommand, |
7 | cleanupTests, | 7 | cleanupTests, |
8 | doubleFollow, | ||
9 | createMultipleServers, | 8 | createMultipleServers, |
9 | doubleFollow, | ||
10 | PeerTubeServer, | 10 | PeerTubeServer, |
11 | setAccessTokensToServers, | 11 | setAccessTokensToServers, |
12 | waitJobs | 12 | waitJobs |
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index a1c2f0f39..fd61e95df 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | createSingleServer, | 7 | createSingleServer, |
@@ -12,7 +11,7 @@ import { | |||
12 | PeerTubeServer, | 11 | PeerTubeServer, |
13 | setAccessTokensToServers | 12 | setAccessTokensToServers |
14 | } from '@shared/extra-utils' | 13 | } from '@shared/extra-utils' |
15 | import { CustomConfig } from '@shared/models' | 14 | import { CustomConfig, HttpStatusCode } from '@shared/models' |
16 | 15 | ||
17 | const expect = chai.expect | 16 | const expect = chai.expect |
18 | 17 | ||
diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.ts index fc5d0ad6a..c555661ad 100644 --- a/server/tests/api/server/contact-form.ts +++ b/server/tests/api/server/contact-form.ts | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | ContactFormCommand, | 7 | ContactFormCommand, |
@@ -13,6 +12,7 @@ import { | |||
13 | wait, | 12 | wait, |
14 | waitJobs | 13 | waitJobs |
15 | } from '@shared/extra-utils' | 14 | } from '@shared/extra-utils' |
15 | import { HttpStatusCode } from '@shared/models' | ||
16 | 16 | ||
17 | const expect = chai.expect | 17 | const expect = chai.expect |
18 | 18 | ||
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts index 4c5b296ee..ae86b380f 100644 --- a/server/tests/api/server/email.ts +++ b/server/tests/api/server/email.ts | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
6 | import { HttpStatusCode } from '@shared/models' | ||
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
9 | 9 | ||
diff --git a/server/tests/api/server/follow-constraints.ts b/server/tests/api/server/follow-constraints.ts index bd7b215db..471f5d8d0 100644 --- a/server/tests/api/server/follow-constraints.ts +++ b/server/tests/api/server/follow-constraints.ts | |||
@@ -2,9 +2,8 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | 5 | import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' |
6 | import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' | 6 | import { HttpStatusCode, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' |
7 | import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' | ||
8 | 7 | ||
9 | const expect = chai.expect | 8 | const expect = chai.expect |
10 | 9 | ||
@@ -157,7 +156,7 @@ describe('Test follow constraints', function () { | |||
157 | 156 | ||
158 | it('Should list local account videos', async function () { | 157 | it('Should list local account videos', async function () { |
159 | const { total, data } = await servers[0].videos.listByAccount({ | 158 | const { total, data } = await servers[0].videos.listByAccount({ |
160 | token: undefined, | 159 | token: null, |
161 | handle: 'root@localhost:' + servers[0].port | 160 | handle: 'root@localhost:' + servers[0].port |
162 | }) | 161 | }) |
163 | 162 | ||
@@ -167,7 +166,7 @@ describe('Test follow constraints', function () { | |||
167 | 166 | ||
168 | it('Should not list remote account videos', async function () { | 167 | it('Should not list remote account videos', async function () { |
169 | const { total, data } = await servers[0].videos.listByAccount({ | 168 | const { total, data } = await servers[0].videos.listByAccount({ |
170 | token: undefined, | 169 | token: null, |
171 | handle: 'root@localhost:' + servers[1].port | 170 | handle: 'root@localhost:' + servers[1].port |
172 | }) | 171 | }) |
173 | 172 | ||
@@ -177,7 +176,7 @@ describe('Test follow constraints', function () { | |||
177 | 176 | ||
178 | it('Should list local channel videos', async function () { | 177 | it('Should list local channel videos', async function () { |
179 | const handle = 'root_channel@localhost:' + servers[0].port | 178 | const handle = 'root_channel@localhost:' + servers[0].port |
180 | const { total, data } = await servers[0].videos.listByChannel({ token: undefined, handle }) | 179 | const { total, data } = await servers[0].videos.listByChannel({ token: null, handle }) |
181 | 180 | ||
182 | expect(total).to.equal(1) | 181 | expect(total).to.equal(1) |
183 | expect(data).to.have.lengthOf(1) | 182 | expect(data).to.have.lengthOf(1) |
@@ -185,7 +184,7 @@ describe('Test follow constraints', function () { | |||
185 | 184 | ||
186 | it('Should not list remote channel videos', async function () { | 185 | it('Should not list remote channel videos', async function () { |
187 | const handle = 'root_channel@localhost:' + servers[1].port | 186 | const handle = 'root_channel@localhost:' + servers[1].port |
188 | const { total, data } = await servers[0].videos.listByChannel({ token: undefined, handle }) | 187 | const { total, data } = await servers[0].videos.listByChannel({ token: null, handle }) |
189 | 188 | ||
190 | expect(total).to.equal(0) | 189 | expect(total).to.equal(0) |
191 | expect(data).to.have.lengthOf(0) | 190 | expect(data).to.have.lengthOf(0) |
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index 8856177b8..ff8f880a6 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts | |||
@@ -5,9 +5,9 @@ import * as chai from 'chai' | |||
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | completeVideoCheck, | 7 | completeVideoCheck, |
8 | createMultipleServers, | ||
8 | dateIsValid, | 9 | dateIsValid, |
9 | expectAccountFollows, | 10 | expectAccountFollows, |
10 | createMultipleServers, | ||
11 | FollowsCommand, | 11 | FollowsCommand, |
12 | PeerTubeServer, | 12 | PeerTubeServer, |
13 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index d22e843e0..1f751c957 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | CommentsCommand, | 7 | CommentsCommand, |
@@ -14,7 +13,7 @@ import { | |||
14 | wait, | 13 | wait, |
15 | waitJobs | 14 | waitJobs |
16 | } from '@shared/extra-utils' | 15 | } from '@shared/extra-utils' |
17 | import { JobState, VideoCreateResult, VideoPrivacy } from '@shared/models' | 16 | import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models' |
18 | 17 | ||
19 | const expect = chai.expect | 18 | const expect = chai.expect |
20 | 19 | ||
diff --git a/server/tests/api/server/homepage.ts b/server/tests/api/server/homepage.ts index 7eae3df20..cb3ba5677 100644 --- a/server/tests/api/server/homepage.ts +++ b/server/tests/api/server/homepage.ts | |||
@@ -5,8 +5,8 @@ import * as chai from 'chai' | |||
5 | import { HttpStatusCode } from '@shared/models' | 5 | import { HttpStatusCode } from '@shared/models' |
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
8 | CustomPagesCommand, | ||
9 | createSingleServer, | 8 | createSingleServer, |
9 | CustomPagesCommand, | ||
10 | killallServers, | 10 | killallServers, |
11 | PeerTubeServer, | 11 | PeerTubeServer, |
12 | setAccessTokensToServers | 12 | setAccessTokensToServers |
diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts index 376cd10d0..c10c154c2 100644 --- a/server/tests/api/server/jobs.ts +++ b/server/tests/api/server/jobs.ts | |||
@@ -4,9 +4,9 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | createMultipleServers, | ||
7 | dateIsValid, | 8 | dateIsValid, |
8 | doubleFollow, | 9 | doubleFollow, |
9 | createMultipleServers, | ||
10 | PeerTubeServer, | 10 | PeerTubeServer, |
11 | setAccessTokensToServers, | 11 | setAccessTokensToServers, |
12 | waitJobs | 12 | waitJobs |
diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts index 334adfe9d..5f9f4ffdd 100644 --- a/server/tests/api/server/plugins.ts +++ b/server/tests/api/server/plugins.ts | |||
@@ -2,18 +2,17 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | createSingleServer, | 7 | createSingleServer, |
9 | killallServers, | 8 | killallServers, |
10 | PluginsCommand, | ||
11 | PeerTubeServer, | 9 | PeerTubeServer, |
10 | PluginsCommand, | ||
12 | setAccessTokensToServers, | 11 | setAccessTokensToServers, |
13 | testHelloWorldRegisteredSettings, | 12 | testHelloWorldRegisteredSettings, |
14 | wait | 13 | wait |
15 | } from '@shared/extra-utils' | 14 | } from '@shared/extra-utils' |
16 | import { PluginType } from '@shared/models' | 15 | import { HttpStatusCode, PluginType } from '@shared/models' |
17 | 16 | ||
18 | const expect = chai.expect | 17 | const expect = chai.expect |
19 | 18 | ||
diff --git a/server/tests/api/server/reverse-proxy.ts b/server/tests/api/server/reverse-proxy.ts index 13b22bc0e..484f88d67 100644 --- a/server/tests/api/server/reverse-proxy.ts +++ b/server/tests/api/server/reverse-proxy.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { HttpStatusCode } from '@shared/models' | ||
5 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils' | 4 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | 6 | ||
7 | describe('Test application behind a reverse proxy', function () { | 7 | describe('Test application behind a reverse proxy', function () { |
8 | let server: PeerTubeServer | 8 | let server: PeerTubeServer |
diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.ts index f07d0fd39..942602b70 100644 --- a/server/tests/api/server/stats.ts +++ b/server/tests/api/server/stats.ts | |||
@@ -4,8 +4,8 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | doubleFollow, | ||
8 | createMultipleServers, | 7 | createMultipleServers, |
8 | doubleFollow, | ||
9 | PeerTubeServer, | 9 | PeerTubeServer, |
10 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
11 | wait, | 11 | wait, |
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts index d2bb9c387..565b4bd77 100644 --- a/server/tests/api/users/user-subscriptions.ts +++ b/server/tests/api/users/user-subscriptions.ts | |||
@@ -4,8 +4,8 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | doubleFollow, | ||
8 | createMultipleServers, | 7 | createMultipleServers, |
8 | doubleFollow, | ||
9 | PeerTubeServer, | 9 | PeerTubeServer, |
10 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
11 | SubscriptionsCommand, | 11 | SubscriptionsCommand, |
@@ -67,7 +67,8 @@ describe('Test users subscriptions', function () { | |||
67 | 67 | ||
68 | await waitJobs(servers) | 68 | await waitJobs(servers) |
69 | 69 | ||
70 | const { uuid } = await servers[2].videos.upload({ attributes: { name: 'video server 3 added after follow' } }) | 70 | const attributes = { name: 'video server 3 added after follow' } |
71 | const { uuid } = await servers[2].videos.upload({ token: users[2].accessToken, attributes }) | ||
71 | video3UUID = uuid | 72 | video3UUID = uuid |
72 | 73 | ||
73 | await waitJobs(servers) | 74 | await waitJobs(servers) |
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts index e304e5d67..225145957 100644 --- a/server/tests/api/users/users-multiple-servers.ts +++ b/server/tests/api/users/users-multiple-servers.ts | |||
@@ -7,8 +7,8 @@ import { | |||
7 | checkTmpIsEmpty, | 7 | checkTmpIsEmpty, |
8 | checkVideoFilesWereRemoved, | 8 | checkVideoFilesWereRemoved, |
9 | cleanupTests, | 9 | cleanupTests, |
10 | doubleFollow, | ||
11 | createMultipleServers, | 10 | createMultipleServers, |
11 | doubleFollow, | ||
12 | PeerTubeServer, | 12 | PeerTubeServer, |
13 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
14 | testImage, | 14 | testImage, |
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts index 56fc25048..f54463359 100644 --- a/server/tests/api/users/users-verification.ts +++ b/server/tests/api/users/users-verification.ts | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
6 | import { HttpStatusCode } from '@shared/models' | ||
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
9 | 9 | ||
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index be80c2616..066da88ee 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | createSingleServer, | 7 | createSingleServer, |
@@ -13,7 +12,7 @@ import { | |||
13 | testImage, | 12 | testImage, |
14 | waitJobs | 13 | waitJobs |
15 | } from '@shared/extra-utils' | 14 | } from '@shared/extra-utils' |
16 | import { AbuseState, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models' | 15 | import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models' |
17 | 16 | ||
18 | const expect = chai.expect | 17 | const expect = chai.expect |
19 | 18 | ||
diff --git a/server/tests/api/videos/audio-only.ts b/server/tests/api/videos/audio-only.ts index b9bf96650..15c3ae6d6 100644 --- a/server/tests/api/videos/audio-only.ts +++ b/server/tests/api/videos/audio-only.ts | |||
@@ -4,7 +4,7 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' | 6 | import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' |
7 | import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 7 | import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
8 | 8 | ||
9 | const expect = chai.expect | 9 | const expect = chai.expect |
10 | 10 | ||
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index edf2773cd..d916abb09 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts | |||
@@ -3,16 +3,15 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import * as request from 'supertest' | 5 | import * as request from 'supertest' |
6 | import { HttpStatusCode } from '@shared/models' | ||
7 | import { | 6 | import { |
8 | buildAbsoluteFixturePath, | 7 | buildAbsoluteFixturePath, |
9 | checkTmpIsEmpty, | 8 | checkTmpIsEmpty, |
10 | checkVideoFilesWereRemoved, | 9 | checkVideoFilesWereRemoved, |
11 | cleanupTests, | 10 | cleanupTests, |
12 | completeVideoCheck, | 11 | completeVideoCheck, |
12 | createMultipleServers, | ||
13 | dateIsValid, | 13 | dateIsValid, |
14 | doubleFollow, | 14 | doubleFollow, |
15 | createMultipleServers, | ||
16 | PeerTubeServer, | 15 | PeerTubeServer, |
17 | setAccessTokensToServers, | 16 | setAccessTokensToServers, |
18 | testImage, | 17 | testImage, |
@@ -20,7 +19,7 @@ import { | |||
20 | waitJobs, | 19 | waitJobs, |
21 | webtorrentAdd | 20 | webtorrentAdd |
22 | } from '@shared/extra-utils' | 21 | } from '@shared/extra-utils' |
23 | import { VideoCommentThreadTree, VideoPrivacy } from '@shared/models' | 22 | import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@shared/models' |
24 | 23 | ||
25 | const expect = chai.expect | 24 | const expect = chai.expect |
26 | 25 | ||
diff --git a/server/tests/api/videos/resumable-upload.ts b/server/tests/api/videos/resumable-upload.ts index 0e62972c2..13e47c85e 100644 --- a/server/tests/api/videos/resumable-upload.ts +++ b/server/tests/api/videos/resumable-upload.ts | |||
@@ -4,7 +4,6 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { pathExists, readdir, stat } from 'fs-extra' | 5 | import { pathExists, readdir, stat } from 'fs-extra' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { HttpStatusCode } from '@shared/models' | ||
8 | import { | 7 | import { |
9 | buildAbsoluteFixturePath, | 8 | buildAbsoluteFixturePath, |
10 | cleanupTests, | 9 | cleanupTests, |
@@ -13,7 +12,7 @@ import { | |||
13 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
14 | setDefaultVideoChannel | 13 | setDefaultVideoChannel |
15 | } from '@shared/extra-utils' | 14 | } from '@shared/extra-utils' |
16 | import { VideoPrivacy } from '@shared/models' | 15 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' |
17 | 16 | ||
18 | const expect = chai.expect | 17 | const expect = chai.expect |
19 | 18 | ||
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts index 6caba6aa6..e3d46e619 100644 --- a/server/tests/api/videos/video-captions.ts +++ b/server/tests/api/videos/video-captions.ts | |||
@@ -5,8 +5,8 @@ import * as chai from 'chai' | |||
5 | import { | 5 | import { |
6 | checkVideoFilesWereRemoved, | 6 | checkVideoFilesWereRemoved, |
7 | cleanupTests, | 7 | cleanupTests, |
8 | doubleFollow, | ||
9 | createMultipleServers, | 8 | createMultipleServers, |
9 | doubleFollow, | ||
10 | PeerTubeServer, | 10 | PeerTubeServer, |
11 | setAccessTokensToServers, | 11 | setAccessTokensToServers, |
12 | testCaptionFile, | 12 | testCaptionFile, |
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts index 792550101..6ae6d3004 100644 --- a/server/tests/api/videos/video-change-ownership.ts +++ b/server/tests/api/videos/video-change-ownership.ts | |||
@@ -2,19 +2,18 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | ChangeOwnershipCommand, | 6 | ChangeOwnershipCommand, |
8 | cleanupTests, | 7 | cleanupTests, |
9 | doubleFollow, | ||
10 | createMultipleServers, | 8 | createMultipleServers, |
11 | createSingleServer, | 9 | createSingleServer, |
10 | doubleFollow, | ||
12 | PeerTubeServer, | 11 | PeerTubeServer, |
13 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
14 | setDefaultVideoChannel, | 13 | setDefaultVideoChannel, |
15 | waitJobs | 14 | waitJobs |
16 | } from '@shared/extra-utils' | 15 | } from '@shared/extra-utils' |
17 | import { VideoPrivacy } from '@shared/models' | 16 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' |
18 | 17 | ||
19 | const expect = chai.expect | 18 | const expect = chai.expect |
20 | 19 | ||
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index eeaec5ad2..c25754eb6 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts | |||
@@ -6,8 +6,8 @@ import { basename } from 'path' | |||
6 | import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants' | 6 | import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants' |
7 | import { | 7 | import { |
8 | cleanupTests, | 8 | cleanupTests, |
9 | doubleFollow, | ||
10 | createMultipleServers, | 9 | createMultipleServers, |
10 | doubleFollow, | ||
11 | PeerTubeServer, | 11 | PeerTubeServer, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | setDefaultVideoChannel, | 13 | setDefaultVideoChannel, |
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts index 9709e0628..61ee54540 100644 --- a/server/tests/api/videos/video-comments.ts +++ b/server/tests/api/videos/video-comments.ts | |||
@@ -5,8 +5,8 @@ import * as chai from 'chai' | |||
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | CommentsCommand, | 7 | CommentsCommand, |
8 | dateIsValid, | ||
9 | createSingleServer, | 8 | createSingleServer, |
9 | dateIsValid, | ||
10 | PeerTubeServer, | 10 | PeerTubeServer, |
11 | setAccessTokensToServers, | 11 | setAccessTokensToServers, |
12 | testImage | 12 | testImage |
diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.ts index ce45eac80..d22b4ed96 100644 --- a/server/tests/api/videos/video-description.ts +++ b/server/tests/api/videos/video-description.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 5 | import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
6 | 6 | ||
7 | const expect = chai.expect | 7 | const expect = chai.expect |
8 | 8 | ||
diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts index df030110b..7845f7334 100644 --- a/server/tests/api/videos/video-hls.ts +++ b/server/tests/api/videos/video-hls.ts | |||
@@ -3,22 +3,21 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { HttpStatusCode } from '@shared/models' | ||
7 | import { | 6 | import { |
8 | checkDirectoryIsEmpty, | 7 | checkDirectoryIsEmpty, |
9 | checkResolutionsInMasterPlaylist, | 8 | checkResolutionsInMasterPlaylist, |
10 | checkSegmentHash, | 9 | checkSegmentHash, |
11 | checkTmpIsEmpty, | 10 | checkTmpIsEmpty, |
12 | cleanupTests, | 11 | cleanupTests, |
13 | doubleFollow, | ||
14 | createMultipleServers, | 12 | createMultipleServers, |
13 | doubleFollow, | ||
15 | makeRawRequest, | 14 | makeRawRequest, |
16 | PeerTubeServer, | 15 | PeerTubeServer, |
17 | setAccessTokensToServers, | 16 | setAccessTokensToServers, |
18 | waitJobs, | 17 | waitJobs, |
19 | webtorrentAdd | 18 | webtorrentAdd |
20 | } from '@shared/extra-utils' | 19 | } from '@shared/extra-utils' |
21 | import { VideoStreamingPlaylistType } from '@shared/models' | 20 | import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models' |
22 | import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants' | 21 | import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants' |
23 | 22 | ||
24 | const expect = chai.expect | 23 | const expect = chai.expect |
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts index 0a9e5ce3f..b5d183d62 100644 --- a/server/tests/api/videos/video-nsfw.ts +++ b/server/tests/api/videos/video-nsfw.ts | |||
@@ -30,8 +30,8 @@ describe('Test video NSFW policy', function () { | |||
30 | promises = [ | 30 | promises = [ |
31 | server.search.advancedVideoSearch({ token, search: { search: 'n', sort: '-publishedAt', ...query } }), | 31 | server.search.advancedVideoSearch({ token, search: { search: 'n', sort: '-publishedAt', ...query } }), |
32 | server.videos.listWithToken({ token, ...query }), | 32 | server.videos.listWithToken({ token, ...query }), |
33 | server.videos.listByAccount({ token, handle: channelName, ...query }), | 33 | server.videos.listByAccount({ token, handle: accountName, ...query }), |
34 | server.videos.listByChannel({ token, handle: accountName, ...query }) | 34 | server.videos.listByChannel({ token, handle: channelName, ...query }) |
35 | ] | 35 | ] |
36 | 36 | ||
37 | // Overviews do not support video filters | 37 | // Overviews do not support video filters |
@@ -47,8 +47,8 @@ describe('Test video NSFW policy', function () { | |||
47 | promises = [ | 47 | promises = [ |
48 | server.search.searchVideos({ search: 'n', sort: '-publishedAt' }), | 48 | server.search.searchVideos({ search: 'n', sort: '-publishedAt' }), |
49 | server.videos.list(), | 49 | server.videos.list(), |
50 | server.videos.listByAccount({ handle: channelName }), | 50 | server.videos.listByAccount({ token: null, handle: accountName }), |
51 | server.videos.listByChannel({ handle: accountName }) | 51 | server.videos.listByChannel({ token: null, handle: channelName }) |
52 | ] | 52 | ] |
53 | 53 | ||
54 | // Overviews do not support video filters | 54 | // Overviews do not support video filters |
@@ -82,6 +82,7 @@ describe('Test video NSFW policy', function () { | |||
82 | }) | 82 | }) |
83 | 83 | ||
84 | describe('Instance default NSFW policy', function () { | 84 | describe('Instance default NSFW policy', function () { |
85 | |||
85 | it('Should display NSFW videos with display default NSFW policy', async function () { | 86 | it('Should display NSFW videos with display default NSFW policy', async function () { |
86 | const serverConfig = await server.config.getConfig() | 87 | const serverConfig = await server.config.getConfig() |
87 | expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display') | 88 | expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display') |
diff --git a/server/tests/api/videos/video-playlist-thumbnails.ts b/server/tests/api/videos/video-playlist-thumbnails.ts index 9a682c12b..f0b2ca169 100644 --- a/server/tests/api/videos/video-playlist-thumbnails.ts +++ b/server/tests/api/videos/video-playlist-thumbnails.ts | |||
@@ -4,8 +4,8 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | doubleFollow, | ||
8 | createMultipleServers, | 7 | createMultipleServers, |
8 | doubleFollow, | ||
9 | PeerTubeServer, | 9 | PeerTubeServer, |
10 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
11 | setDefaultVideoChannel, | 11 | setDefaultVideoChannel, |
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index 9a28a421a..f42aee2ff 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts | |||
@@ -2,14 +2,13 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | checkPlaylistFilesWereRemoved, | 6 | checkPlaylistFilesWereRemoved, |
8 | cleanupTests, | 7 | cleanupTests, |
9 | doubleFollow, | ||
10 | createMultipleServers, | 8 | createMultipleServers, |
11 | PlaylistsCommand, | 9 | doubleFollow, |
12 | PeerTubeServer, | 10 | PeerTubeServer, |
11 | PlaylistsCommand, | ||
13 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
14 | setDefaultVideoChannel, | 13 | setDefaultVideoChannel, |
15 | testImage, | 14 | testImage, |
@@ -17,6 +16,7 @@ import { | |||
17 | waitJobs | 16 | waitJobs |
18 | } from '@shared/extra-utils' | 17 | } from '@shared/extra-utils' |
19 | import { | 18 | import { |
19 | HttpStatusCode, | ||
20 | VideoPlaylist, | 20 | VideoPlaylist, |
21 | VideoPlaylistCreateResult, | 21 | VideoPlaylistCreateResult, |
22 | VideoPlaylistElementType, | 22 | VideoPlaylistElementType, |
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts index 06011082d..b51b3bcdd 100644 --- a/server/tests/api/videos/video-privacy.ts +++ b/server/tests/api/videos/video-privacy.ts | |||
@@ -2,9 +2,8 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | 5 | import { cleanupTests, createSingleServer, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
6 | import { cleanupTests, doubleFollow, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 6 | import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' |
7 | import { VideoCreateResult, VideoPrivacy } from '@shared/models' | ||
8 | 7 | ||
9 | const expect = chai.expect | 8 | const expect = chai.expect |
10 | 9 | ||
@@ -162,7 +161,7 @@ describe('Test video privacy', function () { | |||
162 | }) | 161 | }) |
163 | 162 | ||
164 | it('Should not be able to get this unlisted video using its id', async function () { | 163 | it('Should not be able to get this unlisted video using its id', async function () { |
165 | await servers[1].videos.get({ id: unlistedVideo.id, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 164 | await servers[1].videos.get({ id: unlistedVideo.id, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
166 | }) | 165 | }) |
167 | 166 | ||
168 | it('Should be able to get this unlisted video using its uuid/shortUUID', async function () { | 167 | it('Should be able to get this unlisted video using its uuid/shortUUID', async function () { |
diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts index 22b5cf1c2..3f7738784 100644 --- a/server/tests/api/videos/video-schedule-update.ts +++ b/server/tests/api/videos/video-schedule-update.ts | |||
@@ -4,8 +4,8 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | doubleFollow, | ||
8 | createMultipleServers, | 7 | createMultipleServers, |
8 | doubleFollow, | ||
9 | PeerTubeServer, | 9 | PeerTubeServer, |
10 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
11 | wait, | 11 | wait, |
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts index 7510472e3..e4892bb24 100644 --- a/server/tests/api/videos/video-transcoder.ts +++ b/server/tests/api/videos/video-transcoder.ts | |||
@@ -4,12 +4,11 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { omit } from 'lodash' | 5 | import { omit } from 'lodash' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { HttpStatusCode } from '@shared/models' | ||
8 | import { | 7 | import { |
9 | buildAbsoluteFixturePath, | 8 | buildAbsoluteFixturePath, |
10 | cleanupTests, | 9 | cleanupTests, |
11 | doubleFollow, | ||
12 | createMultipleServers, | 10 | createMultipleServers, |
11 | doubleFollow, | ||
13 | generateHighBitrateVideo, | 12 | generateHighBitrateVideo, |
14 | generateVideoWithFramerate, | 13 | generateVideoWithFramerate, |
15 | makeGetRequest, | 14 | makeGetRequest, |
@@ -18,7 +17,7 @@ import { | |||
18 | waitJobs, | 17 | waitJobs, |
19 | webtorrentAdd | 18 | webtorrentAdd |
20 | } from '@shared/extra-utils' | 19 | } from '@shared/extra-utils' |
21 | import { getMaxBitrate, VideoResolution, VideoState } from '@shared/models' | 20 | import { getMaxBitrate, HttpStatusCode, VideoResolution, VideoState } from '@shared/models' |
22 | import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants' | 21 | import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants' |
23 | import { | 22 | import { |
24 | canDoQuickTranscode, | 23 | canDoQuickTranscode, |
diff --git a/server/tests/api/videos/videos-filter.ts b/server/tests/api/videos/videos-filter.ts index 88dff3e7f..2306807bf 100644 --- a/server/tests/api/videos/videos-filter.ts +++ b/server/tests/api/videos/videos-filter.ts | |||
@@ -2,16 +2,15 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | doubleFollow, | ||
9 | createMultipleServers, | 7 | createMultipleServers, |
8 | doubleFollow, | ||
10 | makeGetRequest, | 9 | makeGetRequest, |
11 | PeerTubeServer, | 10 | PeerTubeServer, |
12 | setAccessTokensToServers | 11 | setAccessTokensToServers |
13 | } from '@shared/extra-utils' | 12 | } from '@shared/extra-utils' |
14 | import { UserRole, Video, VideoPrivacy } from '@shared/models' | 13 | import { HttpStatusCode, UserRole, Video, VideoPrivacy } from '@shared/models' |
15 | 14 | ||
16 | async function getVideosNames (server: PeerTubeServer, token: string, filter: string, expectedStatus = HttpStatusCode.OK_200) { | 15 | async function getVideosNames (server: PeerTubeServer, token: string, filter: string, expectedStatus = HttpStatusCode.OK_200) { |
17 | const paths = [ | 16 | const paths = [ |
diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts index acb9d1a46..e4bc0bb3a 100644 --- a/server/tests/api/videos/videos-history.ts +++ b/server/tests/api/videos/videos-history.ts | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | createSingleServer, | 7 | createSingleServer, |
@@ -12,7 +11,7 @@ import { | |||
12 | setAccessTokensToServers, | 11 | setAccessTokensToServers, |
13 | wait | 12 | wait |
14 | } from '@shared/extra-utils' | 13 | } from '@shared/extra-utils' |
15 | import { Video } from '@shared/models' | 14 | import { HttpStatusCode, Video } from '@shared/models' |
16 | 15 | ||
17 | const expect = chai.expect | 16 | const expect = chai.expect |
18 | 17 | ||
diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts index 0be03ddd2..82268b1be 100644 --- a/server/tests/api/videos/videos-views-cleaner.ts +++ b/server/tests/api/videos/videos-views-cleaner.ts | |||
@@ -4,8 +4,8 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | doubleFollow, | ||
8 | createMultipleServers, | 7 | createMultipleServers, |
8 | doubleFollow, | ||
9 | killallServers, | 9 | killallServers, |
10 | PeerTubeServer, | 10 | PeerTubeServer, |
11 | setAccessTokensToServers, | 11 | setAccessTokensToServers, |
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts index e8cd71e09..bddcff5e7 100644 --- a/server/tests/cli/create-import-video-file-job.ts +++ b/server/tests/cli/create-import-video-file-job.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 5 | import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
6 | import { VideoFile } from '@shared/models' | 6 | import { VideoFile } from '@shared/models' |
7 | 7 | ||
8 | const expect = chai.expect | 8 | const expect = chai.expect |
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts index 53f187f90..df787ccdc 100644 --- a/server/tests/cli/create-transcoding-job.ts +++ b/server/tests/cli/create-transcoding-job.ts | |||
@@ -4,8 +4,8 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | doubleFollow, | ||
8 | createMultipleServers, | 7 | createMultipleServers, |
8 | doubleFollow, | ||
9 | PeerTubeServer, | 9 | PeerTubeServer, |
10 | setAccessTokensToServers, | 10 | setAccessTokensToServers, |
11 | waitJobs | 11 | waitJobs |
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts index 53f47a85e..685b3b7b8 100644 --- a/server/tests/cli/optimize-old-videos.ts +++ b/server/tests/cli/optimize-old-videos.ts | |||
@@ -5,8 +5,8 @@ import * as chai from 'chai' | |||
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { | 6 | import { |
7 | cleanupTests, | 7 | cleanupTests, |
8 | doubleFollow, | ||
9 | createMultipleServers, | 8 | createMultipleServers, |
9 | doubleFollow, | ||
10 | generateHighBitrateVideo, | 10 | generateHighBitrateVideo, |
11 | PeerTubeServer, | 11 | PeerTubeServer, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts index 42651d79c..07c78cc89 100644 --- a/server/tests/cli/plugins.ts +++ b/server/tests/cli/plugins.ts | |||
@@ -6,8 +6,8 @@ import { | |||
6 | cleanupTests, | 6 | cleanupTests, |
7 | createSingleServer, | 7 | createSingleServer, |
8 | killallServers, | 8 | killallServers, |
9 | PluginsCommand, | ||
10 | PeerTubeServer, | 9 | PeerTubeServer, |
10 | PluginsCommand, | ||
11 | setAccessTokensToServers | 11 | setAccessTokensToServers |
12 | } from '../../../shared/extra-utils' | 12 | } from '../../../shared/extra-utils' |
13 | 13 | ||
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts index 2bd4a466b..954a87833 100644 --- a/server/tests/cli/prune-storage.ts +++ b/server/tests/cli/prune-storage.ts | |||
@@ -5,12 +5,11 @@ import * as chai from 'chai' | |||
5 | import { createFile, readdir } from 'fs-extra' | 5 | import { createFile, readdir } from 'fs-extra' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { buildUUID } from '@server/helpers/uuid' | 7 | import { buildUUID } from '@server/helpers/uuid' |
8 | import { HttpStatusCode } from '@shared/models' | ||
9 | import { | 8 | import { |
10 | cleanupTests, | 9 | cleanupTests, |
11 | CLICommand, | 10 | CLICommand, |
12 | doubleFollow, | ||
13 | createMultipleServers, | 11 | createMultipleServers, |
12 | doubleFollow, | ||
14 | killallServers, | 13 | killallServers, |
15 | makeGetRequest, | 14 | makeGetRequest, |
16 | PeerTubeServer, | 15 | PeerTubeServer, |
@@ -19,7 +18,7 @@ import { | |||
19 | wait, | 18 | wait, |
20 | waitJobs | 19 | waitJobs |
21 | } from '@shared/extra-utils' | 20 | } from '@shared/extra-utils' |
22 | import { VideoPlaylistPrivacy } from '@shared/models' | 21 | import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' |
23 | 22 | ||
24 | const expect = chai.expect | 23 | const expect = chai.expect |
25 | 24 | ||
diff --git a/server/tests/cli/regenerate-thumbnails.ts b/server/tests/cli/regenerate-thumbnails.ts index 595d842ef..780c9b4bd 100644 --- a/server/tests/cli/regenerate-thumbnails.ts +++ b/server/tests/cli/regenerate-thumbnails.ts | |||
@@ -2,12 +2,11 @@ import 'mocha' | |||
2 | import { expect } from 'chai' | 2 | import { expect } from 'chai' |
3 | import { writeFile } from 'fs-extra' | 3 | import { writeFile } from 'fs-extra' |
4 | import { basename, join } from 'path' | 4 | import { basename, join } from 'path' |
5 | import { HttpStatusCode } from '@shared/models' | 5 | import { HttpStatusCode, Video } from '@shared/models' |
6 | import { Video } from '@shared/models' | ||
7 | import { | 6 | import { |
8 | cleanupTests, | 7 | cleanupTests, |
9 | doubleFollow, | ||
10 | createMultipleServers, | 8 | createMultipleServers, |
9 | doubleFollow, | ||
11 | makeRawRequest, | 10 | makeRawRequest, |
12 | PeerTubeServer, | 11 | PeerTubeServer, |
13 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
diff --git a/server/tests/client.ts b/server/tests/client.ts index 6255c6961..9c27a7aae 100644 --- a/server/tests/client.ts +++ b/server/tests/client.ts | |||
@@ -3,12 +3,11 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { omit } from 'lodash' | 5 | import { omit } from 'lodash' |
6 | import { HttpStatusCode } from '@shared/models' | 6 | import { Account, HTMLServerConfig, HttpStatusCode, ServerConfig, VideoPlaylistCreateResult, VideoPlaylistPrivacy } from '@shared/models' |
7 | import { Account, HTMLServerConfig, ServerConfig, VideoPlaylistCreateResult, VideoPlaylistPrivacy } from '@shared/models' | ||
8 | import { | 7 | import { |
9 | cleanupTests, | 8 | cleanupTests, |
10 | doubleFollow, | ||
11 | createMultipleServers, | 9 | createMultipleServers, |
10 | doubleFollow, | ||
12 | makeGetRequest, | 11 | makeGetRequest, |
13 | makeHTMLRequest, | 12 | makeHTMLRequest, |
14 | PeerTubeServer, | 13 | PeerTubeServer, |
diff --git a/server/tests/external-plugins/auth-ldap.ts b/server/tests/external-plugins/auth-ldap.ts index 12b4a1b8d..acec69df5 100644 --- a/server/tests/external-plugins/auth-ldap.ts +++ b/server/tests/external-plugins/auth-ldap.ts | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' |
6 | import { HttpStatusCode } from '@shared/models' | ||
7 | 7 | ||
8 | describe('Official plugin auth-ldap', function () { | 8 | describe('Official plugin auth-ldap', function () { |
9 | let server: PeerTubeServer | 9 | let server: PeerTubeServer |
diff --git a/server/tests/external-plugins/auto-block-videos.ts b/server/tests/external-plugins/auto-block-videos.ts index 78b13eded..0eb4bda9a 100644 --- a/server/tests/external-plugins/auto-block-videos.ts +++ b/server/tests/external-plugins/auto-block-videos.ts | |||
@@ -4,8 +4,8 @@ import 'mocha' | |||
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | doubleFollow, | ||
8 | createMultipleServers, | 7 | createMultipleServers, |
8 | doubleFollow, | ||
9 | killallServers, | 9 | killallServers, |
10 | MockBlocklist, | 10 | MockBlocklist, |
11 | PeerTubeServer, | 11 | PeerTubeServer, |
diff --git a/server/tests/external-plugins/auto-mute.ts b/server/tests/external-plugins/auto-mute.ts index b2046313b..271779dd4 100644 --- a/server/tests/external-plugins/auto-mute.ts +++ b/server/tests/external-plugins/auto-mute.ts | |||
@@ -2,11 +2,10 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | doubleFollow, | ||
9 | createMultipleServers, | 7 | createMultipleServers, |
8 | doubleFollow, | ||
10 | killallServers, | 9 | killallServers, |
11 | makeGetRequest, | 10 | makeGetRequest, |
12 | MockBlocklist, | 11 | MockBlocklist, |
@@ -14,6 +13,7 @@ import { | |||
14 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
15 | wait | 14 | wait |
16 | } from '@shared/extra-utils' | 15 | } from '@shared/extra-utils' |
16 | import { HttpStatusCode } from '@shared/models' | ||
17 | 17 | ||
18 | describe('Official plugin auto-mute', function () { | 18 | describe('Official plugin auto-mute', function () { |
19 | const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list' | 19 | const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list' |
diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts index 543c431dd..5667207c0 100644 --- a/server/tests/feeds/feeds.ts +++ b/server/tests/feeds/feeds.ts | |||
@@ -3,17 +3,16 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import * as xmlParser from 'fast-xml-parser' | 5 | import * as xmlParser from 'fast-xml-parser' |
6 | import { HttpStatusCode } from '@shared/models' | ||
7 | import { | 6 | import { |
8 | cleanupTests, | 7 | cleanupTests, |
9 | doubleFollow, | ||
10 | createMultipleServers, | 8 | createMultipleServers, |
11 | createSingleServer, | 9 | createSingleServer, |
10 | doubleFollow, | ||
12 | PeerTubeServer, | 11 | PeerTubeServer, |
13 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
14 | waitJobs | 13 | waitJobs |
15 | } from '@shared/extra-utils' | 14 | } from '@shared/extra-utils' |
16 | import { VideoPrivacy } from '@shared/models' | 15 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' |
17 | 16 | ||
18 | chai.use(require('chai-xml')) | 17 | chai.use(require('chai-xml')) |
19 | chai.use(require('chai-json-schema')) | 18 | chai.use(require('chai-json-schema')) |
diff --git a/server/tests/helpers/comment-model.ts b/server/tests/helpers/comment-model.ts index 4c51b7000..31dc6ec72 100644 --- a/server/tests/helpers/comment-model.ts +++ b/server/tests/helpers/comment-model.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import * as chai from 'chai' | ||
4 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | ||
5 | import { VideoCommentModel } from '../../models/video/video-comment' | 5 | import { VideoCommentModel } from '../../models/video/video-comment' |
6 | 6 | ||
7 | const expect = chai.expect | 7 | const expect = chai.expect |
diff --git a/server/tests/helpers/core-utils.ts b/server/tests/helpers/core-utils.ts index c028b316d..d5cac51a3 100644 --- a/server/tests/helpers/core-utils.ts +++ b/server/tests/helpers/core-utils.ts | |||
@@ -1,10 +1,10 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import * as chai from 'chai' | ||
4 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | ||
5 | import { snakeCase } from 'lodash' | 5 | import { snakeCase } from 'lodash' |
6 | import { objectConverter, parseBytes } from '../../helpers/core-utils' | ||
7 | import validator from 'validator' | 6 | import validator from 'validator' |
7 | import { objectConverter, parseBytes } from '../../helpers/core-utils' | ||
8 | 8 | ||
9 | const expect = chai.expect | 9 | const expect = chai.expect |
10 | 10 | ||
diff --git a/server/tests/helpers/image.ts b/server/tests/helpers/image.ts index 54911697f..9fe9aa4cb 100644 --- a/server/tests/helpers/image.ts +++ b/server/tests/helpers/image.ts | |||
@@ -1,11 +1,11 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | ||
4 | import { readFile, remove } from 'fs-extra' | 5 | import { readFile, remove } from 'fs-extra' |
5 | import { join } from 'path' | 6 | import { join } from 'path' |
6 | import { processImage } from '../../../server/helpers/image-utils' | 7 | import { processImage } from '../../../server/helpers/image-utils' |
7 | import { buildAbsoluteFixturePath, root } from '../../../shared/extra-utils' | 8 | import { buildAbsoluteFixturePath, root } from '../../../shared/extra-utils' |
8 | import { expect } from 'chai' | ||
9 | 9 | ||
10 | async function checkBuffers (path1: string, path2: string, equals: boolean) { | 10 | async function checkBuffers (path1: string, path2: string, equals: boolean) { |
11 | const [ buf1, buf2 ] = await Promise.all([ | 11 | const [ buf1, buf2 ] = await Promise.all([ |
diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts index 4d9c07f1a..4968eef08 100644 --- a/server/tests/misc-endpoints.ts +++ b/server/tests/misc-endpoints.ts | |||
@@ -2,9 +2,8 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' | 5 | import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' |
7 | import { VideoPrivacy } from '@shared/models' | 6 | import { HttpStatusCode, VideoPrivacy } from '@shared/models' |
8 | 7 | ||
9 | const expect = chai.expect | 8 | const expect = chai.expect |
10 | 9 | ||
diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts index b96de4e90..4c1bc7d06 100644 --- a/server/tests/plugins/action-hooks.ts +++ b/server/tests/plugins/action-hooks.ts | |||
@@ -120,7 +120,7 @@ describe('Test plugin action hooks', function () { | |||
120 | }) | 120 | }) |
121 | 121 | ||
122 | it('Should run action:api.user.oauth2-got-token', async function () { | 122 | it('Should run action:api.user.oauth2-got-token', async function () { |
123 | await servers[0].login.getAccessToken('created_user', 'super_password') | 123 | await servers[0].login.login({ user: { username: 'created_user' } }) |
124 | 124 | ||
125 | await checkHook('action:api.user.oauth2-got-token') | 125 | await checkHook('action:api.user.oauth2-got-token') |
126 | }) | 126 | }) |
diff --git a/server/tests/plugins/external-auth.ts b/server/tests/plugins/external-auth.ts index a2828603a..f3e018d43 100644 --- a/server/tests/plugins/external-auth.ts +++ b/server/tests/plugins/external-auth.ts | |||
@@ -2,17 +2,16 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | decodeQueryString, | ||
9 | createSingleServer, | 7 | createSingleServer, |
10 | PluginsCommand, | 8 | decodeQueryString, |
11 | PeerTubeServer, | 9 | PeerTubeServer, |
10 | PluginsCommand, | ||
12 | setAccessTokensToServers, | 11 | setAccessTokensToServers, |
13 | wait | 12 | wait |
14 | } from '@shared/extra-utils' | 13 | } from '@shared/extra-utils' |
15 | import { UserRole } from '@shared/models' | 14 | import { HttpStatusCode, UserRole } from '@shared/models' |
16 | 15 | ||
17 | async function loginExternal (options: { | 16 | async function loginExternal (options: { |
18 | server: PeerTubeServer | 17 | server: PeerTubeServer |
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index ba84dd27a..c00ac8f91 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | createMultipleServers, | 7 | createMultipleServers, |
@@ -15,7 +14,7 @@ import { | |||
15 | setDefaultVideoChannel, | 14 | setDefaultVideoChannel, |
16 | waitJobs | 15 | waitJobs |
17 | } from '@shared/extra-utils' | 16 | } from '@shared/extra-utils' |
18 | import { VideoDetails, VideoImportState, VideoPlaylist, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models' | 17 | import { HttpStatusCode, VideoDetails, VideoImportState, VideoPlaylist, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models' |
19 | 18 | ||
20 | const expect = chai.expect | 19 | const expect = chai.expect |
21 | 20 | ||
diff --git a/server/tests/plugins/html-injection.ts b/server/tests/plugins/html-injection.ts index 2902c39b7..95c0cd687 100644 --- a/server/tests/plugins/html-injection.ts +++ b/server/tests/plugins/html-injection.ts | |||
@@ -6,8 +6,8 @@ import { | |||
6 | cleanupTests, | 6 | cleanupTests, |
7 | createSingleServer, | 7 | createSingleServer, |
8 | makeHTMLRequest, | 8 | makeHTMLRequest, |
9 | PluginsCommand, | ||
10 | PeerTubeServer, | 9 | PeerTubeServer, |
10 | PluginsCommand, | ||
11 | setAccessTokensToServers | 11 | setAccessTokensToServers |
12 | } from '../../../shared/extra-utils' | 12 | } from '../../../shared/extra-utils' |
13 | 13 | ||
diff --git a/server/tests/plugins/id-and-pass-auth.ts b/server/tests/plugins/id-and-pass-auth.ts index a73d76caa..fde0166f9 100644 --- a/server/tests/plugins/id-and-pass-auth.ts +++ b/server/tests/plugins/id-and-pass-auth.ts | |||
@@ -2,9 +2,8 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | 5 | import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers, wait } from '@shared/extra-utils' |
6 | import { cleanupTests, createSingleServer, PluginsCommand, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils' | 6 | import { HttpStatusCode, UserRole } from '@shared/models' |
7 | import { UserRole } from '@shared/models' | ||
8 | 7 | ||
9 | describe('Test id and pass auth plugins', function () { | 8 | describe('Test id and pass auth plugins', function () { |
10 | let server: PeerTubeServer | 9 | let server: PeerTubeServer |
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts index 5cb664bda..242994273 100644 --- a/server/tests/plugins/plugin-helpers.ts +++ b/server/tests/plugins/plugin-helpers.ts | |||
@@ -2,19 +2,19 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | checkVideoFilesWereRemoved, | 6 | checkVideoFilesWereRemoved, |
8 | cleanupTests, | 7 | cleanupTests, |
9 | doubleFollow, | ||
10 | createMultipleServers, | 8 | createMultipleServers, |
9 | doubleFollow, | ||
11 | makeGetRequest, | 10 | makeGetRequest, |
12 | makePostBodyRequest, | 11 | makePostBodyRequest, |
13 | PluginsCommand, | ||
14 | PeerTubeServer, | 12 | PeerTubeServer, |
13 | PluginsCommand, | ||
15 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
16 | waitJobs | 15 | waitJobs |
17 | } from '@shared/extra-utils' | 16 | } from '@shared/extra-utils' |
17 | import { HttpStatusCode } from '@shared/models' | ||
18 | 18 | ||
19 | function postCommand (server: PeerTubeServer, command: string, bodyArg?: object) { | 19 | function postCommand (server: PeerTubeServer, command: string, bodyArg?: object) { |
20 | const body = { command } | 20 | const body = { command } |
diff --git a/server/tests/plugins/plugin-router.ts b/server/tests/plugins/plugin-router.ts index becb7c47b..b1ac9e2fe 100644 --- a/server/tests/plugins/plugin-router.ts +++ b/server/tests/plugins/plugin-router.ts | |||
@@ -2,16 +2,16 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | createSingleServer, | 7 | createSingleServer, |
9 | makeGetRequest, | 8 | makeGetRequest, |
10 | makePostBodyRequest, | 9 | makePostBodyRequest, |
11 | PluginsCommand, | ||
12 | PeerTubeServer, | 10 | PeerTubeServer, |
11 | PluginsCommand, | ||
13 | setAccessTokensToServers | 12 | setAccessTokensToServers |
14 | } from '@shared/extra-utils' | 13 | } from '@shared/extra-utils' |
14 | import { HttpStatusCode } from '@shared/models' | ||
15 | 15 | ||
16 | describe('Test plugin helpers', function () { | 16 | describe('Test plugin helpers', function () { |
17 | let server: PeerTubeServer | 17 | let server: PeerTubeServer |
diff --git a/server/tests/plugins/plugin-storage.ts b/server/tests/plugins/plugin-storage.ts index 90dafa3e1..e20c36dba 100644 --- a/server/tests/plugins/plugin-storage.ts +++ b/server/tests/plugins/plugin-storage.ts | |||
@@ -4,7 +4,6 @@ import 'mocha' | |||
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { pathExists, readdir, readFile } from 'fs-extra' | 5 | import { pathExists, readdir, readFile } from 'fs-extra' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { HttpStatusCode } from '@shared/models' | ||
8 | import { | 7 | import { |
9 | cleanupTests, | 8 | cleanupTests, |
10 | createSingleServer, | 9 | createSingleServer, |
@@ -13,6 +12,7 @@ import { | |||
13 | PluginsCommand, | 12 | PluginsCommand, |
14 | setAccessTokensToServers | 13 | setAccessTokensToServers |
15 | } from '@shared/extra-utils' | 14 | } from '@shared/extra-utils' |
15 | import { HttpStatusCode } from '@shared/models' | ||
16 | 16 | ||
17 | describe('Test plugin storage', function () { | 17 | describe('Test plugin storage', function () { |
18 | let server: PeerTubeServer | 18 | let server: PeerTubeServer |
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts index 3c54d3796..0bf1fab01 100644 --- a/server/tests/plugins/plugin-transcoding.ts +++ b/server/tests/plugins/plugin-transcoding.ts | |||
@@ -7,8 +7,8 @@ import { getAudioStream, getVideoFileFPS, getVideoStreamFromFile } from '@server | |||
7 | import { | 7 | import { |
8 | cleanupTests, | 8 | cleanupTests, |
9 | createSingleServer, | 9 | createSingleServer, |
10 | PluginsCommand, | ||
11 | PeerTubeServer, | 10 | PeerTubeServer, |
11 | PluginsCommand, | ||
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, |
13 | setDefaultVideoChannel, | 13 | setDefaultVideoChannel, |
14 | testFfmpegStreamError, | 14 | testFfmpegStreamError, |
diff --git a/server/tests/plugins/plugin-unloading.ts b/server/tests/plugins/plugin-unloading.ts index faf9cc599..6bf2fda9b 100644 --- a/server/tests/plugins/plugin-unloading.ts +++ b/server/tests/plugins/plugin-unloading.ts | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | ||
6 | import { | 5 | import { |
7 | cleanupTests, | 6 | cleanupTests, |
8 | createSingleServer, | 7 | createSingleServer, |
@@ -11,6 +10,7 @@ import { | |||
11 | PluginsCommand, | 10 | PluginsCommand, |
12 | setAccessTokensToServers | 11 | setAccessTokensToServers |
13 | } from '@shared/extra-utils' | 12 | } from '@shared/extra-utils' |
13 | import { HttpStatusCode } from '@shared/models' | ||
14 | 14 | ||
15 | describe('Test plugins module unloading', function () { | 15 | describe('Test plugins module unloading', function () { |
16 | let server: PeerTubeServer = null | 16 | let server: PeerTubeServer = null |
diff --git a/server/tests/plugins/video-constants.ts b/server/tests/plugins/video-constants.ts index dd3b40225..f527a2b30 100644 --- a/server/tests/plugins/video-constants.ts +++ b/server/tests/plugins/video-constants.ts | |||
@@ -2,9 +2,8 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { HttpStatusCode } from '@shared/models' | 5 | import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers } from '@shared/extra-utils' |
6 | import { cleanupTests, createSingleServer, PluginsCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' | 6 | import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' |
7 | import { VideoPlaylistPrivacy } from '@shared/models' | ||
8 | 7 | ||
9 | const expect = chai.expect | 8 | const expect = chai.expect |
10 | 9 | ||
diff --git a/server/tools/peertube-redundancy.ts b/server/tools/peertube-redundancy.ts index bcaae63a3..73b026ac8 100644 --- a/server/tools/peertube-redundancy.ts +++ b/server/tools/peertube-redundancy.ts | |||
@@ -6,8 +6,7 @@ import { Command, program } from 'commander' | |||
6 | import { uniq } from 'lodash' | 6 | import { uniq } from 'lodash' |
7 | import { URL } from 'url' | 7 | import { URL } from 'url' |
8 | import validator from 'validator' | 8 | import validator from 'validator' |
9 | import { HttpStatusCode } from '@shared/models' | 9 | import { HttpStatusCode, VideoRedundanciesTarget } from '@shared/models' |
10 | import { VideoRedundanciesTarget } from '@shared/models' | ||
11 | import { assignToken, buildServer, getServerCredentials } from './cli' | 10 | import { assignToken, buildServer, getServerCredentials } from './cli' |
12 | 11 | ||
13 | import bytes = require('bytes') | 12 | import bytes = require('bytes') |
diff --git a/shared/extra-utils/custom-pages/custom-pages-command.ts b/shared/extra-utils/custom-pages/custom-pages-command.ts index 6042233d4..cd869a8de 100644 --- a/shared/extra-utils/custom-pages/custom-pages-command.ts +++ b/shared/extra-utils/custom-pages/custom-pages-command.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { CustomPage } from '@shared/models' | 1 | import { CustomPage, HttpStatusCode } from '@shared/models' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class CustomPagesCommand extends AbstractCommand { | 4 | export class CustomPagesCommand extends AbstractCommand { |
diff --git a/shared/extra-utils/miscs/generate.ts b/shared/extra-utils/miscs/generate.ts index 4e70ab853..8d6435481 100644 --- a/shared/extra-utils/miscs/generate.ts +++ b/shared/extra-utils/miscs/generate.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as ffmpeg from 'fluent-ffmpeg' | ||
1 | import { ensureDir, pathExists } from 'fs-extra' | 2 | import { ensureDir, pathExists } from 'fs-extra' |
2 | import { dirname } from 'path' | 3 | import { dirname } from 'path' |
3 | import { buildAbsoluteFixturePath } from './tests' | 4 | import { buildAbsoluteFixturePath } from './tests' |
4 | import * as ffmpeg from 'fluent-ffmpeg' | ||
5 | 5 | ||
6 | async function generateHighBitrateVideo () { | 6 | async function generateHighBitrateVideo () { |
7 | const tempFixturePath = buildAbsoluteFixturePath('video_high_bitrate_1080p.mp4', true) | 7 | const tempFixturePath = buildAbsoluteFixturePath('video_high_bitrate_1080p.mp4', true) |
diff --git a/shared/extra-utils/moderation/abuses-command.ts b/shared/extra-utils/moderation/abuses-command.ts index 72f2c9951..7b3abb056 100644 --- a/shared/extra-utils/moderation/abuses-command.ts +++ b/shared/extra-utils/moderation/abuses-command.ts | |||
@@ -7,12 +7,12 @@ import { | |||
7 | AbuseUpdate, | 7 | AbuseUpdate, |
8 | AbuseVideoIs, | 8 | AbuseVideoIs, |
9 | AdminAbuse, | 9 | AdminAbuse, |
10 | HttpStatusCode, | ||
10 | ResultList, | 11 | ResultList, |
11 | UserAbuse | 12 | UserAbuse |
12 | } from '@shared/models' | 13 | } from '@shared/models' |
13 | import { HttpStatusCode } from '@shared/models' | ||
14 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | ||
15 | import { unwrapBody } from '../requests/requests' | 14 | import { unwrapBody } from '../requests/requests' |
15 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | ||
16 | 16 | ||
17 | export class AbusesCommand extends AbstractCommand { | 17 | export class AbusesCommand extends AbstractCommand { |
18 | 18 | ||
diff --git a/shared/extra-utils/overviews/overviews-command.ts b/shared/extra-utils/overviews/overviews-command.ts index d4a2ac254..06b4892d2 100644 --- a/shared/extra-utils/overviews/overviews-command.ts +++ b/shared/extra-utils/overviews/overviews-command.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | 1 | import { HttpStatusCode, VideosOverview } from '@shared/models' |
2 | import { VideosOverview } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class OverviewsCommand extends AbstractCommand { | 4 | export class OverviewsCommand extends AbstractCommand { |
diff --git a/shared/extra-utils/requests/activitypub.ts b/shared/extra-utils/requests/activitypub.ts index ecd8ce823..4ae878384 100644 --- a/shared/extra-utils/requests/activitypub.ts +++ b/shared/extra-utils/requests/activitypub.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { activityPubContextify } from '../../../server/helpers/activitypub' | ||
1 | import { doRequest } from '../../../server/helpers/requests' | 2 | import { doRequest } from '../../../server/helpers/requests' |
2 | import { HTTP_SIGNATURE } from '../../../server/initializers/constants' | 3 | import { HTTP_SIGNATURE } from '../../../server/initializers/constants' |
3 | import { buildGlobalHeaders } from '../../../server/lib/job-queue/handlers/utils/activitypub-http-utils' | 4 | import { buildGlobalHeaders } from '../../../server/lib/job-queue/handlers/utils/activitypub-http-utils' |
4 | import { activityPubContextify } from '../../../server/helpers/activitypub' | ||
5 | 5 | ||
6 | function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) { | 6 | function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) { |
7 | const options = { | 7 | const options = { |
diff --git a/shared/extra-utils/search/search-command.ts b/shared/extra-utils/search/search-command.ts index 09f5d3f1d..0fbbcd6ef 100644 --- a/shared/extra-utils/search/search-command.ts +++ b/shared/extra-utils/search/search-command.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import { | 1 | import { |
2 | HttpStatusCode, | ||
2 | ResultList, | 3 | ResultList, |
3 | Video, | 4 | Video, |
4 | VideoChannel, | 5 | VideoChannel, |
@@ -7,7 +8,6 @@ import { | |||
7 | VideoPlaylistsSearchQuery, | 8 | VideoPlaylistsSearchQuery, |
8 | VideosSearchQuery | 9 | VideosSearchQuery |
9 | } from '@shared/models' | 10 | } from '@shared/models' |
10 | import { HttpStatusCode } from '@shared/models' | ||
11 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 11 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
12 | 12 | ||
13 | export class SearchCommand extends AbstractCommand { | 13 | export class SearchCommand extends AbstractCommand { |
diff --git a/shared/extra-utils/server/config-command.ts b/shared/extra-utils/server/config-command.ts index 6e875fdf6..11148aa46 100644 --- a/shared/extra-utils/server/config-command.ts +++ b/shared/extra-utils/server/config-command.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { merge } from 'lodash' | 1 | import { merge } from 'lodash' |
2 | import { DeepPartial } from '@shared/core-utils' | 2 | import { DeepPartial } from '@shared/core-utils' |
3 | import { About, ServerConfig, HttpStatusCode } from '@shared/models' | 3 | import { About, HttpStatusCode, ServerConfig } from '@shared/models' |
4 | import { CustomConfig } from '../../models/server/custom-config.model' | 4 | import { CustomConfig } from '../../models/server/custom-config.model' |
5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
6 | 6 | ||
diff --git a/shared/extra-utils/server/debug-command.ts b/shared/extra-utils/server/debug-command.ts index 36704836d..3c5a785bb 100644 --- a/shared/extra-utils/server/debug-command.ts +++ b/shared/extra-utils/server/debug-command.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { Debug, SendDebugCommand } from '@shared/models' | 1 | import { Debug, HttpStatusCode, SendDebugCommand } from '@shared/models' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class DebugCommand extends AbstractCommand { | 4 | export class DebugCommand extends AbstractCommand { |
diff --git a/shared/extra-utils/server/follows-command.ts b/shared/extra-utils/server/follows-command.ts index 694f5ea24..dce674ac5 100644 --- a/shared/extra-utils/server/follows-command.ts +++ b/shared/extra-utils/server/follows-command.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import { pick } from 'lodash' | 1 | import { pick } from 'lodash' |
2 | import { ActivityPubActorType, ActorFollow, FollowState, ResultList } from '@shared/models' | 2 | import { ActivityPubActorType, ActorFollow, FollowState, HttpStatusCode, ResultList } from '@shared/models' |
3 | import { HttpStatusCode } from '@shared/models' | ||
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
5 | import { PeerTubeServer } from './server' | 4 | import { PeerTubeServer } from './server' |
6 | 5 | ||
diff --git a/shared/extra-utils/server/plugins-command.ts b/shared/extra-utils/server/plugins-command.ts index 59bc79b3d..b944475a2 100644 --- a/shared/extra-utils/server/plugins-command.ts +++ b/shared/extra-utils/server/plugins-command.ts | |||
@@ -3,8 +3,8 @@ | |||
3 | import { readJSON, writeJSON } from 'fs-extra' | 3 | import { readJSON, writeJSON } from 'fs-extra' |
4 | import { join } from 'path' | 4 | import { join } from 'path' |
5 | import { root } from '@server/helpers/core-utils' | 5 | import { root } from '@server/helpers/core-utils' |
6 | import { HttpStatusCode } from '@shared/models' | ||
7 | import { | 6 | import { |
7 | HttpStatusCode, | ||
8 | PeerTubePlugin, | 8 | PeerTubePlugin, |
9 | PeerTubePluginIndex, | 9 | PeerTubePluginIndex, |
10 | PeertubePluginIndexList, | 10 | PeertubePluginIndexList, |
diff --git a/shared/extra-utils/server/redundancy-command.ts b/shared/extra-utils/server/redundancy-command.ts index 137d7f01c..e7a8b3c29 100644 --- a/shared/extra-utils/server/redundancy-command.ts +++ b/shared/extra-utils/server/redundancy-command.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { ResultList, VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' | 1 | import { HttpStatusCode, ResultList, VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class RedundancyCommand extends AbstractCommand { | 4 | export class RedundancyCommand extends AbstractCommand { |
diff --git a/shared/extra-utils/server/stats-command.ts b/shared/extra-utils/server/stats-command.ts index 6db473588..64a452306 100644 --- a/shared/extra-utils/server/stats-command.ts +++ b/shared/extra-utils/server/stats-command.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { ServerStats } from '@shared/models' | 1 | import { HttpStatusCode, ServerStats } from '@shared/models' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class StatsCommand extends AbstractCommand { | 4 | export class StatsCommand extends AbstractCommand { |
diff --git a/shared/extra-utils/users/accounts-command.ts b/shared/extra-utils/users/accounts-command.ts index 08977e58b..2f586104e 100644 --- a/shared/extra-utils/users/accounts-command.ts +++ b/shared/extra-utils/users/accounts-command.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { ResultList } from '@shared/models' | 1 | import { HttpStatusCode, ResultList } from '@shared/models' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { Account } from '../../models/actors' | 2 | import { Account } from '../../models/actors' |
4 | import { AccountVideoRate, VideoRateType } from '../../models/videos' | 3 | import { AccountVideoRate, VideoRateType } from '../../models/videos' |
5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
diff --git a/shared/extra-utils/users/blocklist-command.ts b/shared/extra-utils/users/blocklist-command.ts index a9431acf3..14491a1ae 100644 --- a/shared/extra-utils/users/blocklist-command.ts +++ b/shared/extra-utils/users/blocklist-command.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import { HttpStatusCode } from '@shared/models' | 3 | import { AccountBlock, HttpStatusCode, ResultList, ServerBlock } from '@shared/models' |
4 | import { AccountBlock, ResultList, ServerBlock } from '@shared/models' | ||
5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
6 | 5 | ||
7 | type ListBlocklistOptions = OverrideCommandOptions & { | 6 | type ListBlocklistOptions = OverrideCommandOptions & { |
diff --git a/shared/extra-utils/users/login-command.ts b/shared/extra-utils/users/login-command.ts index b39577260..143f72a59 100644 --- a/shared/extra-utils/users/login-command.ts +++ b/shared/extra-utils/users/login-command.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | 1 | import { HttpStatusCode, PeerTubeProblemDocument } from '@shared/models' |
2 | import { PeerTubeProblemDocument } from '@shared/models' | ||
3 | import { unwrapBody } from '../requests' | 2 | import { unwrapBody } from '../requests' |
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
5 | 4 | ||
diff --git a/shared/extra-utils/users/notifications-command.ts b/shared/extra-utils/users/notifications-command.ts index a51fcc3af..2d79a3747 100644 --- a/shared/extra-utils/users/notifications-command.ts +++ b/shared/extra-utils/users/notifications-command.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { ResultList } from '@shared/models' | 1 | import { HttpStatusCode, ResultList } from '@shared/models' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { UserNotification, UserNotificationSetting } from '../../models/users' | 2 | import { UserNotification, UserNotificationSetting } from '../../models/users' |
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
5 | 4 | ||
diff --git a/shared/extra-utils/users/subscriptions-command.ts b/shared/extra-utils/users/subscriptions-command.ts index a69d2a194..edc60e612 100644 --- a/shared/extra-utils/users/subscriptions-command.ts +++ b/shared/extra-utils/users/subscriptions-command.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { ResultList, Video, VideoChannel } from '@shared/models' | 1 | import { HttpStatusCode, ResultList, Video, VideoChannel } from '@shared/models' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class SubscriptionsCommand extends AbstractCommand { | 4 | export class SubscriptionsCommand extends AbstractCommand { |
diff --git a/shared/extra-utils/users/users-command.ts b/shared/extra-utils/users/users-command.ts index f3a251e65..d66ad15f2 100644 --- a/shared/extra-utils/users/users-command.ts +++ b/shared/extra-utils/users/users-command.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { omit, pick } from 'lodash' | 1 | import { omit, pick } from 'lodash' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { | 2 | import { |
3 | HttpStatusCode, | ||
4 | MyUser, | 4 | MyUser, |
5 | ResultList, | 5 | ResultList, |
6 | User, | 6 | User, |
diff --git a/shared/extra-utils/videos/blacklist-command.ts b/shared/extra-utils/videos/blacklist-command.ts index 9404d4c08..3a2ef89ba 100644 --- a/shared/extra-utils/videos/blacklist-command.ts +++ b/shared/extra-utils/videos/blacklist-command.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | 1 | ||
2 | import { ResultList } from '@shared/models' | 2 | import { HttpStatusCode, ResultList } from '@shared/models' |
3 | import { HttpStatusCode } from '@shared/models' | ||
4 | import { VideoBlacklist, VideoBlacklistType } from '../../models/videos' | 3 | import { VideoBlacklist, VideoBlacklistType } from '../../models/videos' |
5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
6 | 5 | ||
diff --git a/shared/extra-utils/videos/captions-command.ts b/shared/extra-utils/videos/captions-command.ts index 04dd32f84..a0608e1a6 100644 --- a/shared/extra-utils/videos/captions-command.ts +++ b/shared/extra-utils/videos/captions-command.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | 1 | import { HttpStatusCode, ResultList, VideoCaption } from '@shared/models' |
2 | import { ResultList, VideoCaption } from '@shared/models' | ||
3 | import { buildAbsoluteFixturePath } from '../miscs' | 2 | import { buildAbsoluteFixturePath } from '../miscs' |
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
5 | 4 | ||
diff --git a/shared/extra-utils/videos/change-ownership-command.ts b/shared/extra-utils/videos/change-ownership-command.ts index ef6f07536..ad4c726ef 100644 --- a/shared/extra-utils/videos/change-ownership-command.ts +++ b/shared/extra-utils/videos/change-ownership-command.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | 1 | ||
2 | import { ResultList, VideoChangeOwnership } from '@shared/models' | 2 | import { HttpStatusCode, ResultList, VideoChangeOwnership } from '@shared/models' |
3 | import { HttpStatusCode } from '@shared/models' | ||
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
5 | 4 | ||
6 | export class ChangeOwnershipCommand extends AbstractCommand { | 5 | export class ChangeOwnershipCommand extends AbstractCommand { |
diff --git a/shared/extra-utils/videos/channels-command.ts b/shared/extra-utils/videos/channels-command.ts index e5393ff56..f8eb3f885 100644 --- a/shared/extra-utils/videos/channels-command.ts +++ b/shared/extra-utils/videos/channels-command.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import { pick } from 'lodash' | 1 | import { pick } from 'lodash' |
2 | import { ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models' | 2 | import { HttpStatusCode, ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models' |
3 | import { HttpStatusCode } from '@shared/models' | ||
4 | import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model' | 3 | import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model' |
5 | import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model' | 4 | import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model' |
6 | import { unwrapBody } from '../requests' | 5 | import { unwrapBody } from '../requests' |
diff --git a/shared/extra-utils/videos/comments-command.ts b/shared/extra-utils/videos/comments-command.ts index 7368f3ea2..dd14e4b64 100644 --- a/shared/extra-utils/videos/comments-command.ts +++ b/shared/extra-utils/videos/comments-command.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import { pick } from 'lodash' | 1 | import { pick } from 'lodash' |
2 | import { HttpStatusCode } from '@shared/models' | 2 | import { HttpStatusCode, ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models' |
3 | import { ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models' | ||
4 | import { unwrapBody } from '../requests' | 3 | import { unwrapBody } from '../requests' |
5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
6 | 5 | ||
diff --git a/shared/extra-utils/videos/history-command.ts b/shared/extra-utils/videos/history-command.ts index 41afc6bc6..13b7150c1 100644 --- a/shared/extra-utils/videos/history-command.ts +++ b/shared/extra-utils/videos/history-command.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | 1 | import { HttpStatusCode, ResultList, Video } from '@shared/models' |
2 | import { ResultList, Video } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class HistoryCommand extends AbstractCommand { | 4 | export class HistoryCommand extends AbstractCommand { |
diff --git a/shared/extra-utils/videos/imports-command.ts b/shared/extra-utils/videos/imports-command.ts index d30f9745b..e4944694d 100644 --- a/shared/extra-utils/videos/imports-command.ts +++ b/shared/extra-utils/videos/imports-command.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | 1 | ||
2 | import { HttpStatusCode } from '@shared/models' | 2 | import { HttpStatusCode, ResultList } from '@shared/models' |
3 | import { ResultList } from '@shared/models' | ||
4 | import { VideoImport, VideoImportCreate } from '../../models/videos' | 3 | import { VideoImport, VideoImportCreate } from '../../models/videos' |
5 | import { unwrapBody } from '../requests' | 4 | import { unwrapBody } from '../requests' |
6 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
diff --git a/shared/extra-utils/videos/live-command.ts b/shared/extra-utils/videos/live-command.ts index 9dfe3087e..bf9486a05 100644 --- a/shared/extra-utils/videos/live-command.ts +++ b/shared/extra-utils/videos/live-command.ts | |||
@@ -3,8 +3,7 @@ | |||
3 | import { readdir } from 'fs-extra' | 3 | import { readdir } from 'fs-extra' |
4 | import { omit } from 'lodash' | 4 | import { omit } from 'lodash' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { HttpStatusCode } from '@shared/models' | 6 | import { HttpStatusCode, LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models' |
7 | import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models' | ||
8 | import { wait } from '../miscs' | 7 | import { wait } from '../miscs' |
9 | import { unwrapBody } from '../requests' | 8 | import { unwrapBody } from '../requests' |
10 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 9 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
diff --git a/shared/extra-utils/videos/playlists-command.ts b/shared/extra-utils/videos/playlists-command.ts index 40162c30d..6f329800e 100644 --- a/shared/extra-utils/videos/playlists-command.ts +++ b/shared/extra-utils/videos/playlists-command.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { omit, pick } from 'lodash' | 1 | import { omit, pick } from 'lodash' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { | 2 | import { |
4 | BooleanBothQuery, | 3 | BooleanBothQuery, |
4 | HttpStatusCode, | ||
5 | ResultList, | 5 | ResultList, |
6 | VideoExistInPlaylist, | 6 | VideoExistInPlaylist, |
7 | VideoPlaylist, | 7 | VideoPlaylist, |
diff --git a/shared/extra-utils/videos/streaming-playlists.ts b/shared/extra-utils/videos/streaming-playlists.ts index 007d3d98d..1ae3fefc1 100644 --- a/shared/extra-utils/videos/streaming-playlists.ts +++ b/shared/extra-utils/videos/streaming-playlists.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import { expect } from 'chai' | 1 | import { expect } from 'chai' |
2 | import { sha256 } from '@server/helpers/core-utils' | 2 | import { sha256 } from '@server/helpers/core-utils' |
3 | import { HttpStatusCode } from '@shared/models' | 3 | import { HttpStatusCode, VideoStreamingPlaylist } from '@shared/models' |
4 | import { VideoStreamingPlaylist } from '@shared/models' | ||
5 | import { PeerTubeServer } from '../server' | 4 | import { PeerTubeServer } from '../server' |
6 | 5 | ||
7 | async function checkSegmentHash (options: { | 6 | async function checkSegmentHash (options: { |
diff --git a/shared/extra-utils/videos/videos-command.ts b/shared/extra-utils/videos/videos-command.ts index f46d386f4..40cc4dc28 100644 --- a/shared/extra-utils/videos/videos-command.ts +++ b/shared/extra-utils/videos/videos-command.ts | |||
@@ -7,8 +7,8 @@ import { omit, pick } from 'lodash' | |||
7 | import validator from 'validator' | 7 | import validator from 'validator' |
8 | import { buildUUID } from '@server/helpers/uuid' | 8 | import { buildUUID } from '@server/helpers/uuid' |
9 | import { loadLanguages } from '@server/initializers/constants' | 9 | import { loadLanguages } from '@server/initializers/constants' |
10 | import { HttpStatusCode } from '@shared/models' | ||
11 | import { | 10 | import { |
11 | HttpStatusCode, | ||
12 | ResultList, | 12 | ResultList, |
13 | UserVideoRateType, | 13 | UserVideoRateType, |
14 | Video, | 14 | Video, |
@@ -332,7 +332,7 @@ export class VideosCommand extends AbstractCommand { | |||
332 | attributes?: VideoEdit | 332 | attributes?: VideoEdit |
333 | mode?: 'legacy' | 'resumable' // default legacy | 333 | mode?: 'legacy' | 'resumable' // default legacy |
334 | } = {}) { | 334 | } = {}) { |
335 | const { mode = 'legacy', expectedStatus } = options | 335 | const { mode = 'legacy' } = options |
336 | let defaultChannelId = 1 | 336 | let defaultChannelId = 1 |
337 | 337 | ||
338 | try { | 338 | try { |
@@ -360,22 +360,23 @@ export class VideosCommand extends AbstractCommand { | |||
360 | ...options.attributes | 360 | ...options.attributes |
361 | } | 361 | } |
362 | 362 | ||
363 | const res = mode === 'legacy' | 363 | const created = mode === 'legacy' |
364 | ? await this.buildLegacyUpload({ ...options, attributes }) | 364 | ? await this.buildLegacyUpload({ ...options, attributes }) |
365 | : await this.buildResumeUpload({ ...options, attributes }) | 365 | : await this.buildResumeUpload({ ...options, attributes }) |
366 | 366 | ||
367 | // Wait torrent generation | 367 | // Wait torrent generation |
368 | const expectedStatus = this.buildExpectedStatus({ ...options, defaultExpectedStatus: HttpStatusCode.OK_200 }) | ||
368 | if (expectedStatus === HttpStatusCode.OK_200) { | 369 | if (expectedStatus === HttpStatusCode.OK_200) { |
369 | let video: VideoDetails | 370 | let video: VideoDetails |
370 | 371 | ||
371 | do { | 372 | do { |
372 | video = await this.getWithToken({ ...options, id: video.uuid }) | 373 | video = await this.getWithToken({ ...options, id: created.uuid }) |
373 | 374 | ||
374 | await wait(50) | 375 | await wait(50) |
375 | } while (!video.files[0].torrentUrl) | 376 | } while (!video.files[0].torrentUrl) |
376 | } | 377 | } |
377 | 378 | ||
378 | return res | 379 | return created |
379 | } | 380 | } |
380 | 381 | ||
381 | async buildLegacyUpload (options: OverrideCommandOptions & { | 382 | async buildLegacyUpload (options: OverrideCommandOptions & { |
@@ -535,13 +536,13 @@ export class VideosCommand extends AbstractCommand { | |||
535 | 536 | ||
536 | async randomUpload (options: OverrideCommandOptions & { | 537 | async randomUpload (options: OverrideCommandOptions & { |
537 | wait?: boolean // default true | 538 | wait?: boolean // default true |
538 | additionalParams?: VideoEdit & { prefixName: string } | 539 | additionalParams?: VideoEdit & { prefixName?: string } |
539 | } = {}) { | 540 | } = {}) { |
540 | const { wait = true, additionalParams } = options | 541 | const { wait = true, additionalParams } = options |
541 | const prefixName = additionalParams?.prefixName || '' | 542 | const prefixName = additionalParams?.prefixName || '' |
542 | const name = prefixName + buildUUID() | 543 | const name = prefixName + buildUUID() |
543 | 544 | ||
544 | const attributes = { name, additionalParams } | 545 | const attributes = { name, ...additionalParams } |
545 | 546 | ||
546 | const result = await this.upload({ ...options, attributes }) | 547 | const result = await this.upload({ ...options, attributes }) |
547 | 548 | ||
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts index a96073c56..9a9bfb3cf 100644 --- a/shared/extra-utils/videos/videos.ts +++ b/shared/extra-utils/videos/videos.ts | |||
@@ -202,7 +202,7 @@ async function uploadRandomVideoOnServers ( | |||
202 | additionalParams?: VideoEdit & { prefixName?: string } | 202 | additionalParams?: VideoEdit & { prefixName?: string } |
203 | ) { | 203 | ) { |
204 | const server = servers.find(s => s.serverNumber === serverNumber) | 204 | const server = servers.find(s => s.serverNumber === serverNumber) |
205 | const res = await server.videos.randomUpload({ wait: false, ...additionalParams }) | 205 | const res = await server.videos.randomUpload({ wait: false, additionalParams }) |
206 | 206 | ||
207 | await waitJobs(servers) | 207 | await waitJobs(servers) |
208 | 208 | ||