From 9639bd175726b73f8fe664b5ced12a72407b1f0b Mon Sep 17 00:00:00 2001 From: buoyantair Date: Mon, 29 Oct 2018 22:18:31 +0530 Subject: Move utils to /shared Move utils used by /server/tools/* & /server/tests/**/* into /shared folder. Issue: #1336 --- server/tests/api/check-params/accounts.ts | 10 +++++++--- server/tests/api/check-params/blocklist.ts | 8 ++++++-- server/tests/api/check-params/config.ts | 2 +- server/tests/api/check-params/follows.ts | 8 ++++++-- server/tests/api/check-params/jobs.ts | 18 +++++++++++++++--- server/tests/api/check-params/redundancy.ts | 2 +- server/tests/api/check-params/search.ts | 8 ++++++-- server/tests/api/check-params/services.ts | 10 +++++++++- server/tests/api/check-params/user-subscriptions.ts | 8 ++++++-- server/tests/api/check-params/users.ts | 12 ++++++++---- server/tests/api/check-params/video-abuses.ts | 8 ++++++-- server/tests/api/check-params/video-blacklist.ts | 8 ++++++-- server/tests/api/check-params/video-captions.ts | 4 ++-- server/tests/api/check-params/video-channels.ts | 8 ++++++-- server/tests/api/check-params/video-comments.ts | 10 +++++++--- server/tests/api/check-params/video-imports.ts | 10 +++++++--- server/tests/api/check-params/videos-filter.ts | 2 +- server/tests/api/check-params/videos-history.ts | 2 +- server/tests/api/check-params/videos.ts | 10 +++++++--- 19 files changed, 108 insertions(+), 40 deletions(-) (limited to 'server/tests/api/check-params') diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.ts index 9e0b1e35c..567fd072c 100644 --- a/server/tests/api/check-params/accounts.ts +++ b/server/tests/api/check-params/accounts.ts @@ -2,9 +2,13 @@ import 'mocha' -import { flushTests, killallServers, runServer, ServerInfo } from '../../utils' -import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' -import { getAccount } from '../../utils/users/accounts' +import { flushTests, killallServers, runServer, ServerInfo } from '../../../../shared/utils' +import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination +} from '../../../../shared/utils/requests/check-api-params' +import { getAccount } from '../../../../shared/utils/users/accounts' describe('Test users API validators', function () { const path = '/api/v1/accounts/' diff --git a/server/tests/api/check-params/blocklist.ts b/server/tests/api/check-params/blocklist.ts index c745ac975..c20453c16 100644 --- a/server/tests/api/check-params/blocklist.ts +++ b/server/tests/api/check-params/blocklist.ts @@ -13,8 +13,12 @@ import { makePostBodyRequest, ServerInfo, setAccessTokensToServers, userLogin -} from '../../utils' -import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' +} from '../../../../shared/utils' +import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination +} from '../../../../shared/utils/requests/check-api-params' describe('Test blocklist API validators', function () { let servers: ServerInfo[] diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index d807f910b..ffae380c1 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts @@ -7,7 +7,7 @@ import { CustomConfig } from '../../../../shared/models/server/custom-config.mod import { createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePutBodyRequest, runServer, ServerInfo, setAccessTokensToServers, userLogin, immutableAssign -} from '../../utils' +} from '../../../../shared/utils' describe('Test config API validators', function () { const path = '/api/v1/config/custom' diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts index cdc95c81a..2ad1575a3 100644 --- a/server/tests/api/check-params/follows.ts +++ b/server/tests/api/check-params/follows.ts @@ -5,8 +5,12 @@ import 'mocha' import { createUser, flushTests, killallServers, makeDeleteRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, userLogin -} from '../../utils' -import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' +} from '../../../../shared/utils' +import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination +} from '../../../../shared/utils/requests/check-api-params' describe('Test server follows API validators', function () { let server: ServerInfo diff --git a/server/tests/api/check-params/jobs.ts b/server/tests/api/check-params/jobs.ts index ce3ac8809..89760ff98 100644 --- a/server/tests/api/check-params/jobs.ts +++ b/server/tests/api/check-params/jobs.ts @@ -2,9 +2,21 @@ import 'mocha' -import { createUser, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, userLogin } from '../../utils' -import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' -import { makeGetRequest } from '../../utils/requests/requests' +import { + createUser, + flushTests, + killallServers, + runServer, + ServerInfo, + setAccessTokensToServers, + userLogin +} from '../../../../shared/utils' +import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination +} from '../../../../shared/utils/requests/check-api-params' +import { makeGetRequest } from '../../../../shared/utils/requests/requests' describe('Test jobs API validators', function () { const path = '/api/v1/jobs/failed' diff --git a/server/tests/api/check-params/redundancy.ts b/server/tests/api/check-params/redundancy.ts index aa588e3dd..ff4726ceb 100644 --- a/server/tests/api/check-params/redundancy.ts +++ b/server/tests/api/check-params/redundancy.ts @@ -12,7 +12,7 @@ import { ServerInfo, setAccessTokensToServers, userLogin -} from '../../utils' +} from '../../../../shared/utils' describe('Test server redundancy API validators', function () { let servers: ServerInfo[] diff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.ts index eabf602ac..aa81965f3 100644 --- a/server/tests/api/check-params/search.ts +++ b/server/tests/api/check-params/search.ts @@ -2,8 +2,12 @@ import 'mocha' -import { flushTests, immutableAssign, killallServers, makeGetRequest, runServer, ServerInfo } from '../../utils' -import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' +import { flushTests, immutableAssign, killallServers, makeGetRequest, runServer, ServerInfo } from '../../../../shared/utils' +import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination +} from '../../../../shared/utils/requests/check-api-params' describe('Test videos API validator', function () { let server: ServerInfo diff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.ts index fcde7e179..28591af9d 100644 --- a/server/tests/api/check-params/services.ts +++ b/server/tests/api/check-params/services.ts @@ -2,7 +2,15 @@ import 'mocha' -import { flushTests, killallServers, makeGetRequest, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils' +import { + flushTests, + killallServers, + makeGetRequest, + runServer, + ServerInfo, + setAccessTokensToServers, + uploadVideo +} from '../../../../shared/utils' describe('Test services API validators', function () { let server: ServerInfo diff --git a/server/tests/api/check-params/user-subscriptions.ts b/server/tests/api/check-params/user-subscriptions.ts index 9fba99ac8..2cf5a2415 100644 --- a/server/tests/api/check-params/user-subscriptions.ts +++ b/server/tests/api/check-params/user-subscriptions.ts @@ -13,8 +13,12 @@ import { ServerInfo, setAccessTokensToServers, userLogin -} from '../../utils' -import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' +} from '../../../../shared/utils' +import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination +} from '../../../../shared/utils/requests/check-api-params' describe('Test user subscriptions API validators', function () { const path = '/api/v1/users/me/subscriptions' diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index ec46609a4..f4c177621 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts @@ -9,11 +9,15 @@ import { createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest, makePostBodyRequest, makeUploadRequest, makePutBodyRequest, registerUser, removeUser, runServer, ServerInfo, setAccessTokensToServers, updateUser, uploadVideo, userLogin, deleteMe, unblockUser, blockUser -} from '../../utils' -import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' -import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../utils/videos/video-imports' +} from '../../../../shared/utils' +import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination +} from '../../../../shared/utils/requests/check-api-params' +import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../../../shared/utils/videos/video-imports' import { VideoPrivacy } from '../../../../shared/models/videos' -import { waitJobs } from '../../utils/server/jobs' +import { waitJobs } from '../../../../shared/utils/server/jobs' import { expect } from 'chai' describe('Test users API validators', function () { diff --git a/server/tests/api/check-params/video-abuses.ts b/server/tests/api/check-params/video-abuses.ts index d2bed6a2a..a79ab4201 100644 --- a/server/tests/api/check-params/video-abuses.ts +++ b/server/tests/api/check-params/video-abuses.ts @@ -15,8 +15,12 @@ import { updateVideoAbuse, uploadVideo, userLogin -} from '../../utils' -import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' +} from '../../../../shared/utils' +import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination +} from '../../../../shared/utils/requests/check-api-params' import { VideoAbuseState } from '../../../../shared/models/videos' describe('Test video abuses API validators', function () { diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts index 473216236..8e1206db3 100644 --- a/server/tests/api/check-params/video-blacklist.ts +++ b/server/tests/api/check-params/video-blacklist.ts @@ -15,8 +15,12 @@ import { setAccessTokensToServers, uploadVideo, userLogin -} from '../../utils' -import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' +} from '../../../../shared/utils' +import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination +} from '../../../../shared/utils/requests/check-api-params' import { VideoDetails } from '../../../../shared/models/videos' import { expect } from 'chai' diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts index 8d46971a1..e4d36fd4f 100644 --- a/server/tests/api/check-params/video-captions.ts +++ b/server/tests/api/check-params/video-captions.ts @@ -13,9 +13,9 @@ import { setAccessTokensToServers, uploadVideo, userLogin -} from '../../utils' +} from '../../../../shared/utils' import { join } from 'path' -import { createVideoCaption } from '../../utils/videos/video-captions' +import { createVideoCaption } from '../../../../shared/utils/videos/video-captions' 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 e5696224d..14e4deaf7 100644 --- a/server/tests/api/check-params/video-channels.ts +++ b/server/tests/api/check-params/video-channels.ts @@ -20,8 +20,12 @@ import { ServerInfo, setAccessTokensToServers, userLogin -} from '../../utils' -import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' +} from '../../../../shared/utils' +import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination +} from '../../../../shared/utils/requests/check-api-params' import { User } from '../../../../shared/models/users' import { join } from 'path' diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts index 5241832fe..5981780ed 100644 --- a/server/tests/api/check-params/video-comments.ts +++ b/server/tests/api/check-params/video-comments.ts @@ -6,9 +6,13 @@ import { createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, uploadVideo, userLogin -} from '../../utils' -import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' -import { addVideoCommentThread } from '../../utils/videos/video-comments' +} from '../../../../shared/utils' +import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination +} from '../../../../shared/utils/requests/check-api-params' +import { addVideoCommentThread } from '../../../../shared/utils/videos/video-comments' 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 b51f3d2cd..7bf187007 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts @@ -18,9 +18,13 @@ import { setAccessTokensToServers, updateCustomSubConfig, userLogin -} from '../../utils' -import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' -import { getMagnetURI, getYoutubeVideoUrl } from '../../utils/videos/video-imports' +} from '../../../../shared/utils' +import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination +} from '../../../../shared/utils/requests/check-api-params' +import { getMagnetURI, getYoutubeVideoUrl } from '../../../../shared/utils/videos/video-imports' describe('Test video imports API validator', function () { const path = '/api/v1/videos/imports' diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.ts index 784cd8ba1..e998c8a3d 100644 --- a/server/tests/api/check-params/videos-filter.ts +++ b/server/tests/api/check-params/videos-filter.ts @@ -11,7 +11,7 @@ import { ServerInfo, setAccessTokensToServers, userLogin -} from '../../utils' +} from '../../../../shared/utils' import { UserRole } from '../../../../shared/models/users' const expect = chai.expect diff --git a/server/tests/api/check-params/videos-history.ts b/server/tests/api/check-params/videos-history.ts index 808c3b616..09c6f7861 100644 --- a/server/tests/api/check-params/videos-history.ts +++ b/server/tests/api/check-params/videos-history.ts @@ -11,7 +11,7 @@ import { ServerInfo, setAccessTokensToServers, uploadVideo -} from '../../utils' +} from '../../../../shared/utils' const expect = chai.expect diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index 699f135c7..d94eccf8e 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts @@ -8,9 +8,13 @@ import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enu import { createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest, makeGetRequest, makeUploadRequest, makePutBodyRequest, removeVideo, runServer, ServerInfo, setAccessTokensToServers, userLogin -} from '../../utils' -import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' -import { getAccountsList } from '../../utils/users/accounts' +} from '../../../../shared/utils' +import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination +} from '../../../../shared/utils/requests/check-api-params' +import { getAccountsList } from '../../../../shared/utils/users/accounts' const expect = chai.expect -- cgit v1.2.3