From 4c7e60bc17ee5830399bac4aa273356903421b4c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jul 2021 14:27:30 +0200 Subject: Reorganize imports --- server/tests/api/activitypub/cleaner.ts | 2 +- server/tests/api/activitypub/client.ts | 5 ++--- server/tests/api/activitypub/fetch.ts | 2 +- server/tests/api/activitypub/refresher.ts | 5 ++--- server/tests/api/check-params/abuses.ts | 5 ++--- server/tests/api/check-params/accounts.ts | 2 +- server/tests/api/check-params/config.ts | 3 +-- server/tests/api/check-params/contact-form.ts | 2 +- server/tests/api/check-params/live.ts | 5 ++--- server/tests/api/check-params/plugins.ts | 3 +-- server/tests/api/check-params/search.ts | 2 +- server/tests/api/check-params/services.ts | 3 +-- server/tests/api/check-params/user-notifications.ts | 3 +-- server/tests/api/check-params/users.ts | 3 +-- server/tests/api/check-params/video-blacklist.ts | 5 ++--- server/tests/api/check-params/video-captions.ts | 3 +-- server/tests/api/check-params/video-channels.ts | 3 +-- server/tests/api/check-params/video-comments.ts | 3 +-- server/tests/api/check-params/video-imports.ts | 3 +-- server/tests/api/check-params/video-playlists.ts | 4 ++-- server/tests/api/check-params/videos-filter.ts | 3 +-- server/tests/api/check-params/videos-history.ts | 2 +- server/tests/api/live/live-constraints.ts | 2 +- server/tests/api/live/live-permanent.ts | 2 +- server/tests/api/live/live-save-replay.ts | 5 ++--- server/tests/api/live/live-socket-messages.ts | 2 +- server/tests/api/live/live-views.ts | 2 +- server/tests/api/live/live.ts | 15 +++++++++++---- server/tests/api/moderation/blocklist-notification.ts | 2 +- server/tests/api/moderation/blocklist.ts | 2 +- server/tests/api/notifications/admin-notifications.ts | 2 +- server/tests/api/notifications/comments-notifications.ts | 2 +- .../tests/api/notifications/moderation-notifications.ts | 2 +- server/tests/api/notifications/notifications-api.ts | 2 +- server/tests/api/redundancy/manage-redundancy.ts | 4 ++-- server/tests/api/redundancy/redundancy-constraints.ts | 9 +-------- server/tests/api/redundancy/redundancy.ts | 7 +++---- .../tests/api/search/search-activitypub-video-channels.ts | 2 +- .../api/search/search-activitypub-video-playlists.ts | 2 +- server/tests/api/search/search-activitypub-videos.ts | 2 +- server/tests/api/search/search-channels.ts | 2 +- server/tests/api/search/search-index.ts | 2 +- server/tests/api/search/search-playlists.ts | 2 +- server/tests/api/search/search-videos.ts | 2 +- server/tests/api/server/bulk.ts | 2 +- server/tests/api/server/config.ts | 3 +-- server/tests/api/server/contact-form.ts | 2 +- server/tests/api/server/email.ts | 2 +- server/tests/api/server/follow-constraints.ts | 13 ++++++------- server/tests/api/server/follows.ts | 2 +- server/tests/api/server/handle-down.ts | 3 +-- server/tests/api/server/homepage.ts | 2 +- server/tests/api/server/jobs.ts | 2 +- server/tests/api/server/plugins.ts | 5 ++--- server/tests/api/server/reverse-proxy.ts | 2 +- server/tests/api/server/stats.ts | 2 +- server/tests/api/users/user-subscriptions.ts | 5 +++-- server/tests/api/users/users-multiple-servers.ts | 2 +- server/tests/api/users/users-verification.ts | 2 +- server/tests/api/users/users.ts | 3 +-- server/tests/api/videos/audio-only.ts | 2 +- server/tests/api/videos/multiple-servers.ts | 5 ++--- server/tests/api/videos/resumable-upload.ts | 3 +-- server/tests/api/videos/video-captions.ts | 2 +- server/tests/api/videos/video-change-ownership.ts | 5 ++--- server/tests/api/videos/video-channels.ts | 2 +- server/tests/api/videos/video-comments.ts | 2 +- server/tests/api/videos/video-description.ts | 2 +- server/tests/api/videos/video-hls.ts | 5 ++--- server/tests/api/videos/video-nsfw.ts | 9 +++++---- server/tests/api/videos/video-playlist-thumbnails.ts | 2 +- server/tests/api/videos/video-playlists.ts | 6 +++--- server/tests/api/videos/video-privacy.ts | 7 +++---- server/tests/api/videos/video-schedule-update.ts | 2 +- server/tests/api/videos/video-transcoder.ts | 5 ++--- server/tests/api/videos/videos-filter.ts | 5 ++--- server/tests/api/videos/videos-history.ts | 3 +-- server/tests/api/videos/videos-views-cleaner.ts | 2 +- 78 files changed, 119 insertions(+), 147 deletions(-) (limited to 'server/tests/api') 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' import * as chai from 'chai' import { cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, 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 @@ import 'mocha' import * as chai from 'chai' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, makeActivityPubGetRequest, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/extra-utils' -import { VideoPlaylistPrivacy } from '@shared/models' +import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' const expect = chai.expect 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 @@ import 'mocha' import * as chai from 'chai' -import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' +import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' const expect = chai.expect 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 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, killallServers, PeerTubeServer, setAccessTokensToServers, @@ -13,7 +12,7 @@ import { wait, waitJobs } from '@shared/extra-utils' -import { VideoPlaylistPrivacy } from '@shared/models' +import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' describe('Test AP refresher', function () { 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 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { HttpStatusCode } from '@shared/models' import { AbusesCommand, checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, cleanupTests, - doubleFollow, createSingleServer, + doubleFollow, makeGetRequest, makePostBodyRequest, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' -import { AbuseCreate, AbuseState } from '@shared/models' +import { AbuseCreate, AbuseState, HttpStatusCode } from '@shared/models' describe('Test abuses API validators', function () { const basePath = '/api/v1/abuses/' diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.ts index 0cae485d9..141d869b7 100644 --- a/server/tests/api/check-params/accounts.ts +++ b/server/tests/api/check-params/accounts.ts @@ -1,7 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { HttpStatusCode } from '@shared/models' import { checkBadCountPagination, checkBadSortPagination, @@ -10,6 +9,7 @@ import { createSingleServer, PeerTubeServer } from '@shared/extra-utils' +import { HttpStatusCode } from '@shared/models' describe('Test accounts API validators', function () { 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 @@ import 'mocha' import { omit } from 'lodash' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, @@ -12,7 +11,7 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' -import { CustomConfig } from '@shared/models' +import { CustomConfig, HttpStatusCode } from '@shared/models' describe('Test config API validators', function () { 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 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, killallServers, MockSmtpServer, PeerTubeServer } from '@shared/extra-utils' import { ContactFormCommand } from '@shared/extra-utils/server' +import { HttpStatusCode } from '@shared/models' describe('Test contact form API validators', function () { 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 @@ import 'mocha' import { omit } from 'lodash' -import { HttpStatusCode } from '@shared/models' import { buildAbsoluteFixturePath, cleanupTests, @@ -10,12 +9,12 @@ import { LiveCommand, makePostBodyRequest, makeUploadRequest, - sendRTMPStream, PeerTubeServer, + sendRTMPStream, setAccessTokensToServers, stopFfmpeg } from '@shared/extra-utils' -import { VideoCreateResult, VideoPrivacy } from '@shared/models' +import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' describe('Test video lives API validator', function () { const path = '/api/v1/videos/live' diff --git a/server/tests/api/check-params/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 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { HttpStatusCode } from '@shared/models' import { checkBadCountPagination, checkBadSortPagination, @@ -14,7 +13,7 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' -import { PeerTubePlugin, PluginType } from '@shared/models' +import { HttpStatusCode, PeerTubePlugin, PluginType } from '@shared/models' describe('Test server plugins API validators', function () { let server: PeerTubeServer diff --git a/server/tests/api/check-params/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 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { HttpStatusCode } from '@shared/models' import { checkBadCountPagination, checkBadSortPagination, @@ -12,6 +11,7 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' +import { HttpStatusCode } from '@shared/models' function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) { 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 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, @@ -10,7 +9,7 @@ import { setAccessTokensToServers, setDefaultVideoChannel } from '@shared/extra-utils' -import { VideoPlaylistPrivacy } from '@shared/models' +import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' describe('Test services API validators', function () { let server: PeerTubeServer diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts index 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 @@ import 'mocha' import { io } from 'socket.io-client' -import { HttpStatusCode } from '@shared/models' import { checkBadCountPagination, checkBadSortPagination, @@ -16,7 +15,7 @@ import { setAccessTokensToServers, wait } from '@shared/extra-utils' -import { UserNotificationSetting, UserNotificationSettingValue } from '@shared/models' +import { HttpStatusCode, UserNotificationSetting, UserNotificationSettingValue } from '@shared/models' describe('Test user notifications API validators', function () { let server: PeerTubeServer diff --git a/server/tests/api/check-params/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 @@ import 'mocha' import { omit } from 'lodash' -import { HttpStatusCode } from '@shared/models' import { buildAbsoluteFixturePath, checkBadCountPagination, @@ -20,7 +19,7 @@ import { setAccessTokensToServers, UsersCommand } from '@shared/extra-utils' -import { UserAdminFlag, UserRole, VideoCreateResult } from '@shared/models' +import { HttpStatusCode, UserAdminFlag, UserRole, VideoCreateResult } from '@shared/models' describe('Test users API validators', function () { const path = '/api/v1/users/' diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts index 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 @@ import 'mocha' import { expect } from 'chai' -import { HttpStatusCode } from '@shared/models' import { BlacklistCommand, checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, makePostBodyRequest, makePutBodyRequest, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' -import { VideoBlacklistType } from '@shared/models' +import { HttpStatusCode, VideoBlacklistType } from '@shared/models' describe('Test video blacklist API validators', function () { let servers: PeerTubeServer[] diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts index 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 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { HttpStatusCode } from '@shared/models' import { buildAbsoluteFixturePath, cleanupTests, @@ -12,7 +11,7 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' -import { VideoCreateResult } from '@shared/models' +import { HttpStatusCode, VideoCreateResult } from '@shared/models' describe('Test video captions API validator', function () { const path = '/api/v1/videos/' diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts index 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 @@ import 'mocha' import * as chai from 'chai' import { omit } from 'lodash' -import { HttpStatusCode } from '@shared/models' import { buildAbsoluteFixturePath, ChannelsCommand, @@ -19,7 +18,7 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' -import { VideoChannelUpdate } from '@shared/models' +import { HttpStatusCode, VideoChannelUpdate } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts index 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 @@ import 'mocha' import * as chai from 'chai' -import { HttpStatusCode } from '@shared/models' import { checkBadCountPagination, checkBadSortPagination, @@ -15,7 +14,7 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' -import { VideoCreateResult } from '@shared/models' +import { HttpStatusCode, VideoCreateResult } from '@shared/models' const expect = chai.expect 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 @@ import 'mocha' import { omit } from 'lodash' -import { HttpStatusCode } from '@shared/models' import { buildAbsoluteFixturePath, checkBadCountPagination, @@ -17,7 +16,7 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' -import { VideoPrivacy } from '@shared/models' +import { HttpStatusCode, VideoPrivacy } from '@shared/models' describe('Test video imports API validator', function () { const path = '/api/v1/videos/imports' diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts index 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 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { HttpStatusCode } from '@shared/models' import { checkBadCountPagination, checkBadSortPagination, @@ -9,12 +8,13 @@ import { cleanupTests, createSingleServer, makeGetRequest, - PlaylistsCommand, PeerTubeServer, + PlaylistsCommand, setAccessTokensToServers, setDefaultVideoChannel } from '@shared/extra-utils' import { + HttpStatusCode, VideoPlaylistCreate, VideoPlaylistCreateResult, 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 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, @@ -10,7 +9,7 @@ import { setAccessTokensToServers, setDefaultVideoChannel } from '@shared/extra-utils' -import { UserRole } from '@shared/models' +import { HttpStatusCode, UserRole } from '@shared/models' async function testEndpoints (server: PeerTubeServer, token: string, filter: string, expectedStatus: HttpStatusCode) { 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 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { HttpStatusCode } from '@shared/models' import { checkBadCountPagination, checkBadStartPagination, @@ -13,6 +12,7 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' +import { HttpStatusCode } from '@shared/models' describe('Test videos history API validator', function () { const myHistoryPath = '/api/v1/users/me/history/videos' diff --git a/server/tests/api/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 { checkLiveCleanup, cleanupTests, ConfigCommand, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, 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' import { cleanupTests, ConfigCommand, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, 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 @@ import 'mocha' import * as chai from 'chai' import { FfmpegCommand } from 'fluent-ffmpeg' -import { HttpStatusCode } from '@shared/models' import { checkLiveCleanup, cleanupTests, ConfigCommand, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel, @@ -18,7 +17,7 @@ import { wait, waitJobs } from '@shared/extra-utils' -import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models' +import { HttpStatusCode, LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/live/live-socket-messages.ts b/server/tests/api/live/live-socket-messages.ts index 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' import { VideoPrivacy, VideoState } from '@shared/models' import { cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, 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' import { VideoPrivacy } from '@shared/models' import { cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, 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' import * as chai from 'chai' import { join } from 'path' import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils' -import { HttpStatusCode } from '@shared/models' import { checkLiveCleanup, checkLiveSegmentHash, checkResolutionsInMasterPlaylist, cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, killallServers, LiveCommand, makeRawRequest, - sendRTMPStream, PeerTubeServer, + sendRTMPStream, setAccessTokensToServers, setDefaultVideoChannel, stopFfmpeg, @@ -26,7 +25,15 @@ import { waitJobs, waitUntilLivePublishedOnAllServers } from '@shared/extra-utils' -import { LiveVideo, LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models' +import { + HttpStatusCode, + LiveVideo, + LiveVideoCreate, + VideoDetails, + VideoPrivacy, + VideoState, + VideoStreamingPlaylistType +} from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/moderation/blocklist-notification.ts b/server/tests/api/moderation/blocklist-notification.ts index fdfbcbced..75b15c298 100644 --- a/server/tests/api/moderation/blocklist-notification.ts +++ b/server/tests/api/moderation/blocklist-notification.ts @@ -2,7 +2,7 @@ import 'mocha' import * as chai from 'chai' -import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' +import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' import { UserNotificationType } from '@shared/models' 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 { BlocklistCommand, cleanupTests, CommentsCommand, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, 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 { cleanupTests, MockJoinPeerTubeVersions, MockSmtpServer, - prepareNotificationsTest, PeerTubeServer, + prepareNotificationsTest, wait } from '@shared/extra-utils' 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 { checkNewCommentOnMyVideo, cleanupTests, MockSmtpServer, - prepareNotificationsTest, PeerTubeServer, + prepareNotificationsTest, waitJobs } from '@shared/extra-utils' 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 { cleanupTests, MockInstancesIndex, MockSmtpServer, - prepareNotificationsTest, PeerTubeServer, + prepareNotificationsTest, wait, waitJobs } 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 { cleanupTests, getAllNotificationsSettings, MockSmtpServer, - prepareNotificationsTest, PeerTubeServer, + prepareNotificationsTest, waitJobs } from '@shared/extra-utils' 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' import * as chai from 'chai' import { cleanupTests, - doubleFollow, createMultipleServers, - RedundancyCommand, + doubleFollow, PeerTubeServer, + RedundancyCommand, setAccessTokensToServers, waitJobs } 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 @@ import 'mocha' import { expect } from 'chai' -import { - cleanupTests, - createSingleServer, - killallServers, - PeerTubeServer, - setAccessTokensToServers, - waitJobs -} from '@shared/extra-utils' +import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' import { VideoPrivacy } from '@shared/models' 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' import { readdir } from 'fs-extra' import * as magnetUtil from 'magnet-uri' import { join } from 'path' -import { HttpStatusCode } from '@shared/models' import { checkSegmentHash, checkVideoFilesWereRemoved, cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, killallServers, makeGetRequest, - root, PeerTubeServer, + root, setAccessTokensToServers, wait, waitJobs } from '@shared/extra-utils' -import { VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '@shared/models' +import { HttpStatusCode, VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts index 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' import { cleanupTests, createMultipleServers, - SearchCommand, PeerTubeServer, + SearchCommand, setAccessTokensToServers, wait, 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' import { cleanupTests, createMultipleServers, - SearchCommand, PeerTubeServer, + SearchCommand, setAccessTokensToServers, setDefaultVideoChannel, 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' import { cleanupTests, createMultipleServers, - SearchCommand, PeerTubeServer, + SearchCommand, setAccessTokensToServers, wait, 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 @@ import 'mocha' import * as chai from 'chai' -import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' +import { cleanupTests, createSingleServer, PeerTubeServer, SearchCommand, setAccessTokensToServers } from '@shared/extra-utils' import { VideoChannel } from '@shared/models' 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 @@ import 'mocha' import * as chai from 'chai' -import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' +import { cleanupTests, createSingleServer, PeerTubeServer, SearchCommand, setAccessTokensToServers } from '@shared/extra-utils' import { BooleanBothQuery, VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models' 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' import { cleanupTests, createSingleServer, - SearchCommand, PeerTubeServer, + SearchCommand, setAccessTokensToServers, setDefaultVideoChannel } 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' import { cleanupTests, createSingleServer, - SearchCommand, PeerTubeServer, + SearchCommand, setAccessTokensToServers, setDefaultVideoChannel, 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' import { BulkCommand, cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, 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 @@ import 'mocha' import * as chai from 'chai' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, @@ -12,7 +11,7 @@ import { PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' -import { CustomConfig } from '@shared/models' +import { CustomConfig, HttpStatusCode } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.ts index fc5d0ad6a..c555661ad 100644 --- a/server/tests/api/server/contact-form.ts +++ b/server/tests/api/server/contact-form.ts @@ -2,7 +2,6 @@ import 'mocha' import * as chai from 'chai' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, ContactFormCommand, @@ -13,6 +12,7 @@ import { wait, waitJobs } from '@shared/extra-utils' +import { HttpStatusCode } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts index 4c5b296ee..ae86b380f 100644 --- a/server/tests/api/server/email.ts +++ b/server/tests/api/server/email.ts @@ -2,8 +2,8 @@ import 'mocha' import * as chai from 'chai' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' +import { HttpStatusCode } from '@shared/models' const expect = chai.expect 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 @@ import 'mocha' import * as chai from 'chai' -import { HttpStatusCode } from '@shared/models' -import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' -import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' +import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' +import { HttpStatusCode, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' const expect = chai.expect @@ -157,7 +156,7 @@ describe('Test follow constraints', function () { it('Should list local account videos', async function () { const { total, data } = await servers[0].videos.listByAccount({ - token: undefined, + token: null, handle: 'root@localhost:' + servers[0].port }) @@ -167,7 +166,7 @@ describe('Test follow constraints', function () { it('Should not list remote account videos', async function () { const { total, data } = await servers[0].videos.listByAccount({ - token: undefined, + token: null, handle: 'root@localhost:' + servers[1].port }) @@ -177,7 +176,7 @@ describe('Test follow constraints', function () { it('Should list local channel videos', async function () { const handle = 'root_channel@localhost:' + servers[0].port - const { total, data } = await servers[0].videos.listByChannel({ token: undefined, handle }) + const { total, data } = await servers[0].videos.listByChannel({ token: null, handle }) expect(total).to.equal(1) expect(data).to.have.lengthOf(1) @@ -185,7 +184,7 @@ describe('Test follow constraints', function () { it('Should not list remote channel videos', async function () { const handle = 'root_channel@localhost:' + servers[1].port - const { total, data } = await servers[0].videos.listByChannel({ token: undefined, handle }) + const { total, data } = await servers[0].videos.listByChannel({ token: null, handle }) expect(total).to.equal(0) 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' import { cleanupTests, completeVideoCheck, + createMultipleServers, dateIsValid, expectAccountFollows, - createMultipleServers, FollowsCommand, PeerTubeServer, 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 @@ import 'mocha' import * as chai from 'chai' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, CommentsCommand, @@ -14,7 +13,7 @@ import { wait, waitJobs } from '@shared/extra-utils' -import { JobState, VideoCreateResult, VideoPrivacy } from '@shared/models' +import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models' const expect = chai.expect 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' import { HttpStatusCode } from '@shared/models' import { cleanupTests, - CustomPagesCommand, createSingleServer, + CustomPagesCommand, killallServers, PeerTubeServer, 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' import * as chai from 'chai' import { cleanupTests, + createMultipleServers, dateIsValid, doubleFollow, - createMultipleServers, PeerTubeServer, setAccessTokensToServers, 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 @@ import 'mocha' import * as chai from 'chai' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, killallServers, - PluginsCommand, PeerTubeServer, + PluginsCommand, setAccessTokensToServers, testHelloWorldRegisteredSettings, wait } from '@shared/extra-utils' -import { PluginType } from '@shared/models' +import { HttpStatusCode, PluginType } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/server/reverse-proxy.ts b/server/tests/api/server/reverse-proxy.ts index 13b22bc0e..484f88d67 100644 --- a/server/tests/api/server/reverse-proxy.ts +++ b/server/tests/api/server/reverse-proxy.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import { expect } from 'chai' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils' +import { HttpStatusCode } from '@shared/models' describe('Test application behind a reverse proxy', function () { 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' import * as chai from 'chai' import { cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, 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' import * as chai from 'chai' import { cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, SubscriptionsCommand, @@ -67,7 +67,8 @@ describe('Test users subscriptions', function () { await waitJobs(servers) - const { uuid } = await servers[2].videos.upload({ attributes: { name: 'video server 3 added after follow' } }) + const attributes = { name: 'video server 3 added after follow' } + const { uuid } = await servers[2].videos.upload({ token: users[2].accessToken, attributes }) video3UUID = uuid 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 { checkTmpIsEmpty, checkVideoFilesWereRemoved, cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, 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 @@ import 'mocha' import * as chai from 'chai' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' +import { HttpStatusCode } from '@shared/models' const expect = chai.expect 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 @@ import 'mocha' import * as chai from 'chai' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, @@ -13,7 +12,7 @@ import { testImage, waitJobs } from '@shared/extra-utils' -import { AbuseState, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models' +import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/videos/audio-only.ts b/server/tests/api/videos/audio-only.ts index 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' import * as chai from 'chai' import { join } from 'path' import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' -import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' +import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' const expect = chai.expect 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 @@ import 'mocha' import * as chai from 'chai' import * as request from 'supertest' -import { HttpStatusCode } from '@shared/models' import { buildAbsoluteFixturePath, checkTmpIsEmpty, checkVideoFilesWereRemoved, cleanupTests, completeVideoCheck, + createMultipleServers, dateIsValid, doubleFollow, - createMultipleServers, PeerTubeServer, setAccessTokensToServers, testImage, @@ -20,7 +19,7 @@ import { waitJobs, webtorrentAdd } from '@shared/extra-utils' -import { VideoCommentThreadTree, VideoPrivacy } from '@shared/models' +import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@shared/models' const expect = chai.expect 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' import * as chai from 'chai' import { pathExists, readdir, stat } from 'fs-extra' import { join } from 'path' -import { HttpStatusCode } from '@shared/models' import { buildAbsoluteFixturePath, cleanupTests, @@ -13,7 +12,7 @@ import { setAccessTokensToServers, setDefaultVideoChannel } from '@shared/extra-utils' -import { VideoPrivacy } from '@shared/models' +import { HttpStatusCode, VideoPrivacy } from '@shared/models' const expect = chai.expect 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' import { checkVideoFilesWereRemoved, cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, 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 @@ import 'mocha' import * as chai from 'chai' -import { HttpStatusCode } from '@shared/models' import { ChangeOwnershipCommand, cleanupTests, - doubleFollow, createMultipleServers, createSingleServer, + doubleFollow, PeerTubeServer, setAccessTokensToServers, setDefaultVideoChannel, waitJobs } from '@shared/extra-utils' -import { VideoPrivacy } from '@shared/models' +import { HttpStatusCode, VideoPrivacy } from '@shared/models' const expect = chai.expect 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' import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants' import { cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, 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' import { cleanupTests, CommentsCommand, - dateIsValid, createSingleServer, + dateIsValid, PeerTubeServer, setAccessTokensToServers, 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 @@ import 'mocha' import * as chai from 'chai' -import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' +import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' const expect = chai.expect 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 @@ import 'mocha' import * as chai from 'chai' import { join } from 'path' -import { HttpStatusCode } from '@shared/models' import { checkDirectoryIsEmpty, checkResolutionsInMasterPlaylist, checkSegmentHash, checkTmpIsEmpty, cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, makeRawRequest, PeerTubeServer, setAccessTokensToServers, waitJobs, webtorrentAdd } from '@shared/extra-utils' -import { VideoStreamingPlaylistType } from '@shared/models' +import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models' import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants' const expect = chai.expect diff --git a/server/tests/api/videos/video-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 () { promises = [ server.search.advancedVideoSearch({ token, search: { search: 'n', sort: '-publishedAt', ...query } }), server.videos.listWithToken({ token, ...query }), - server.videos.listByAccount({ token, handle: channelName, ...query }), - server.videos.listByChannel({ token, handle: accountName, ...query }) + server.videos.listByAccount({ token, handle: accountName, ...query }), + server.videos.listByChannel({ token, handle: channelName, ...query }) ] // Overviews do not support video filters @@ -47,8 +47,8 @@ describe('Test video NSFW policy', function () { promises = [ server.search.searchVideos({ search: 'n', sort: '-publishedAt' }), server.videos.list(), - server.videos.listByAccount({ handle: channelName }), - server.videos.listByChannel({ handle: accountName }) + server.videos.listByAccount({ token: null, handle: accountName }), + server.videos.listByChannel({ token: null, handle: channelName }) ] // Overviews do not support video filters @@ -82,6 +82,7 @@ describe('Test video NSFW policy', function () { }) describe('Instance default NSFW policy', function () { + it('Should display NSFW videos with display default NSFW policy', async function () { const serverConfig = await server.config.getConfig() 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' import * as chai from 'chai' import { cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, 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 @@ import 'mocha' import * as chai from 'chai' -import { HttpStatusCode } from '@shared/models' import { checkPlaylistFilesWereRemoved, cleanupTests, - doubleFollow, createMultipleServers, - PlaylistsCommand, + doubleFollow, PeerTubeServer, + PlaylistsCommand, setAccessTokensToServers, setDefaultVideoChannel, testImage, @@ -17,6 +16,7 @@ import { waitJobs } from '@shared/extra-utils' import { + HttpStatusCode, VideoPlaylist, VideoPlaylistCreateResult, 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 @@ import 'mocha' import * as chai from 'chai' -import { HttpStatusCode } from '@shared/models' -import { cleanupTests, doubleFollow, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' -import { VideoCreateResult, VideoPrivacy } from '@shared/models' +import { cleanupTests, createSingleServer, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' +import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' const expect = chai.expect @@ -162,7 +161,7 @@ describe('Test video privacy', function () { }) it('Should not be able to get this unlisted video using its id', async function () { - await servers[1].videos.get({ id: unlistedVideo.id, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) + await servers[1].videos.get({ id: unlistedVideo.id, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) }) 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' import * as chai from 'chai' import { cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, PeerTubeServer, setAccessTokensToServers, 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' import * as chai from 'chai' import { omit } from 'lodash' import { join } from 'path' -import { HttpStatusCode } from '@shared/models' import { buildAbsoluteFixturePath, cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, generateHighBitrateVideo, generateVideoWithFramerate, makeGetRequest, @@ -18,7 +17,7 @@ import { waitJobs, webtorrentAdd } from '@shared/extra-utils' -import { getMaxBitrate, VideoResolution, VideoState } from '@shared/models' +import { getMaxBitrate, HttpStatusCode, VideoResolution, VideoState } from '@shared/models' import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants' import { 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 @@ import 'mocha' import { expect } from 'chai' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' -import { UserRole, Video, VideoPrivacy } from '@shared/models' +import { HttpStatusCode, UserRole, Video, VideoPrivacy } from '@shared/models' async function getVideosNames (server: PeerTubeServer, token: string, filter: string, expectedStatus = HttpStatusCode.OK_200) { 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 @@ import 'mocha' import * as chai from 'chai' -import { HttpStatusCode } from '@shared/models' import { cleanupTests, createSingleServer, @@ -12,7 +11,7 @@ import { setAccessTokensToServers, wait } from '@shared/extra-utils' -import { Video } from '@shared/models' +import { HttpStatusCode, Video } from '@shared/models' const expect = chai.expect diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts index 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' import * as chai from 'chai' import { cleanupTests, - doubleFollow, createMultipleServers, + doubleFollow, killallServers, PeerTubeServer, setAccessTokensToServers, -- cgit v1.2.3