diff options
author | Chocobozzz <me@florianbigard.com> | 2018-11-19 17:08:18 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-11-19 17:08:18 +0100 |
commit | d175a6f7ab9dd53e36f9f52769ac02dbfdc57e3e (patch) | |
tree | 1c313c3a3e0680101516dea3a787cd307006c76d /server/tests | |
parent | 0b2f03d3712f438f67eccf86b67acd047284f9b4 (diff) | |
download | PeerTube-d175a6f7ab9dd53e36f9f52769ac02dbfdc57e3e.tar.gz PeerTube-d175a6f7ab9dd53e36f9f52769ac02dbfdc57e3e.tar.zst PeerTube-d175a6f7ab9dd53e36f9f52769ac02dbfdc57e3e.zip |
Cleanup tests imports
Diffstat (limited to 'server/tests')
22 files changed, 28 insertions, 29 deletions
diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.ts index e7899bb14..7349749f1 100644 --- a/server/tests/api/activitypub/security.ts +++ b/server/tests/api/activitypub/security.ts | |||
@@ -2,12 +2,13 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | 4 | ||
5 | import { flushAndRunMultipleServers, flushTests, killallServers, makePOSTAPRequest, makeFollowRequest, ServerInfo } from '../../utils' | 5 | import { flushAndRunMultipleServers, flushTests, killallServers, ServerInfo } from '../../utils' |
6 | import { HTTP_SIGNATURE } from '../../../initializers' | 6 | import { HTTP_SIGNATURE } from '../../../initializers' |
7 | import { buildDigest, buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activitypub-http-utils' | 7 | import { buildDigest, buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activitypub-http-utils' |
8 | import * as chai from 'chai' | 8 | import * as chai from 'chai' |
9 | import { setActorField } from '../../utils/miscs/sql' | 9 | import { setActorField } from '../../utils/miscs/sql' |
10 | import { activityPubContextify, buildSignedActivity } from '../../../helpers/activitypub' | 10 | import { activityPubContextify, buildSignedActivity } from '../../../helpers/activitypub' |
11 | import { makeFollowRequest, makePOSTAPRequest } from '../../utils/requests/activitypub' | ||
11 | 12 | ||
12 | const expect = chai.expect | 13 | const expect = chai.expect |
13 | 14 | ||
diff --git a/server/tests/api/users/index.ts b/server/tests/api/users/index.ts index 0a1b8b0b2..ff433315d 100644 --- a/server/tests/api/users/index.ts +++ b/server/tests/api/users/index.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import './blocklist' | 1 | import './blocklist' |
2 | import './user-subscriptions' | 2 | import './user-subscriptions' |
3 | import './users' | 3 | import './users' |
4 | import './users-verification' | ||
5 | import './users-multiple-servers' | 4 | import './users-multiple-servers' |
5 | import './users-verification' | ||
diff --git a/server/tests/api/videos/video-blacklist-management.ts b/server/tests/api/videos/video-blacklist-management.ts index 7bf39dc99..fab577b30 100644 --- a/server/tests/api/videos/video-blacklist-management.ts +++ b/server/tests/api/videos/video-blacklist-management.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* tslint:disable:no-unused-expression */ |
2 | 2 | ||
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import * as lodash from 'lodash' | 4 | import { orderBy } from 'lodash' |
5 | import 'mocha' | 5 | import 'mocha' |
6 | import { | 6 | import { |
7 | addVideoToBlacklist, | 7 | addVideoToBlacklist, |
@@ -22,7 +22,6 @@ import { waitJobs } from '../../utils/server/jobs' | |||
22 | import { VideoAbuse } from '../../../../shared/models/videos' | 22 | import { VideoAbuse } from '../../../../shared/models/videos' |
23 | 23 | ||
24 | const expect = chai.expect | 24 | const expect = chai.expect |
25 | const orderBy = lodash.orderBy | ||
26 | 25 | ||
27 | describe('Test video blacklist management', function () { | 26 | describe('Test video blacklist management', function () { |
28 | let servers: ServerInfo[] = [] | 27 | let servers: ServerInfo[] = [] |
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index 8138c65d6..41429a3d8 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts | |||
@@ -7,10 +7,12 @@ import { | |||
7 | createUser, | 7 | createUser, |
8 | doubleFollow, | 8 | doubleFollow, |
9 | flushAndRunMultipleServers, | 9 | flushAndRunMultipleServers, |
10 | getVideoChannelVideos, serverLogin, testImage, | 10 | getVideoChannelVideos, |
11 | testImage, | ||
11 | updateVideo, | 12 | updateVideo, |
12 | updateVideoChannelAvatar, | 13 | updateVideoChannelAvatar, |
13 | uploadVideo, wait, userLogin | 14 | uploadVideo, |
15 | userLogin | ||
14 | } from '../../utils' | 16 | } from '../../utils' |
15 | import { | 17 | import { |
16 | addVideoChannel, | 18 | addVideoChannel, |
diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts index a260fa4da..b226a9d50 100644 --- a/server/tests/api/videos/video-schedule-update.ts +++ b/server/tests/api/videos/video-schedule-update.ts | |||
@@ -16,7 +16,6 @@ import { | |||
16 | uploadVideo, | 16 | uploadVideo, |
17 | wait | 17 | wait |
18 | } from '../../utils' | 18 | } from '../../utils' |
19 | import { join } from 'path' | ||
20 | import { waitJobs } from '../../utils/server/jobs' | 19 | import { waitJobs } from '../../utils/server/jobs' |
21 | 20 | ||
22 | const expect = chai.expect | 21 | const expect = chai.expect |
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts index 85795d2ed..23920d452 100644 --- a/server/tests/api/videos/video-transcoder.ts +++ b/server/tests/api/videos/video-transcoder.ts | |||
@@ -3,13 +3,13 @@ | |||
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import 'mocha' | 4 | import 'mocha' |
5 | import { omit } from 'lodash' | 5 | import { omit } from 'lodash' |
6 | import * as ffmpeg from 'fluent-ffmpeg' | ||
7 | import { getMaxBitrate, VideoDetails, VideoResolution, VideoState } from '../../../../shared/models/videos' | 6 | import { getMaxBitrate, VideoDetails, VideoResolution, VideoState } from '../../../../shared/models/videos' |
8 | import { audio, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' | 7 | import { audio, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' |
9 | import { | 8 | import { |
10 | buildAbsoluteFixturePath, | 9 | buildAbsoluteFixturePath, |
11 | doubleFollow, | 10 | doubleFollow, |
12 | flushAndRunMultipleServers, | 11 | flushAndRunMultipleServers, |
12 | generateHighBitrateVideo, | ||
13 | getMyVideos, | 13 | getMyVideos, |
14 | getVideo, | 14 | getVideo, |
15 | getVideosList, | 15 | getVideosList, |
@@ -18,12 +18,10 @@ import { | |||
18 | ServerInfo, | 18 | ServerInfo, |
19 | setAccessTokensToServers, | 19 | setAccessTokensToServers, |
20 | uploadVideo, | 20 | uploadVideo, |
21 | webtorrentAdd, | 21 | webtorrentAdd |
22 | generateHighBitrateVideo | ||
23 | } from '../../utils' | 22 | } from '../../utils' |
24 | import { join } from 'path' | 23 | import { join } from 'path' |
25 | import { waitJobs } from '../../utils/server/jobs' | 24 | import { waitJobs } from '../../utils/server/jobs' |
26 | import { pathExists } from 'fs-extra' | ||
27 | import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants' | 25 | import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants' |
28 | 26 | ||
29 | const expect = chai.expect | 27 | const expect = chai.expect |
diff --git a/server/tests/utils/index.ts b/server/tests/utils/index.ts index 905d93823..8349631c9 100644 --- a/server/tests/utils/index.ts +++ b/server/tests/utils/index.ts | |||
@@ -7,7 +7,6 @@ export * from './miscs/miscs' | |||
7 | export * from './miscs/stubs' | 7 | export * from './miscs/stubs' |
8 | export * from './server/follows' | 8 | export * from './server/follows' |
9 | export * from './requests/requests' | 9 | export * from './requests/requests' |
10 | export * from './requests/activitypub' | ||
11 | export * from './server/servers' | 10 | export * from './server/servers' |
12 | export * from './videos/services' | 11 | export * from './videos/services' |
13 | export * from './users/users' | 12 | export * from './users/users' |
diff --git a/server/tests/utils/requests/check-api-params.ts b/server/tests/utils/requests/check-api-params.ts index edb47e0e9..a2a549682 100644 --- a/server/tests/utils/requests/check-api-params.ts +++ b/server/tests/utils/requests/check-api-params.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { makeGetRequest } from './requests' | 1 | import { makeGetRequest } from './requests' |
2 | import { immutableAssign } from '..' | 2 | import { immutableAssign } from '../miscs/miscs' |
3 | 3 | ||
4 | function checkBadStartPagination (url: string, path: string, token?: string, query = {}) { | 4 | function checkBadStartPagination (url: string, path: string, token?: string, query = {}) { |
5 | return makeGetRequest({ | 5 | return makeGetRequest({ |
diff --git a/server/tests/utils/search/videos.ts b/server/tests/utils/search/videos.ts index 3a0c10e42..8c0037ccc 100644 --- a/server/tests/utils/search/videos.ts +++ b/server/tests/utils/search/videos.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import * as request from 'supertest' | 3 | import * as request from 'supertest' |
4 | import { VideosSearchQuery } from '../../../../shared/models/search' | 4 | import { VideosSearchQuery } from '../../../../shared/models/search' |
5 | import { immutableAssign } from '..' | 5 | import { immutableAssign } from '../miscs/miscs' |
6 | 6 | ||
7 | function searchVideo (url: string, search: string) { | 7 | function searchVideo (url: string, search: string) { |
8 | const path = '/api/v1/search/videos' | 8 | const path = '/api/v1/search/videos' |
diff --git a/server/tests/utils/server/config.ts b/server/tests/utils/server/config.ts index b85e02ab7..aa3100d34 100644 --- a/server/tests/utils/server/config.ts +++ b/server/tests/utils/server/config.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../' | 1 | import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests' |
2 | import { CustomConfig } from '../../../../shared/models/server/custom-config.model' | 2 | import { CustomConfig } from '../../../../shared/models/server/custom-config.model' |
3 | 3 | ||
4 | function getConfig (url: string) { | 4 | function getConfig (url: string) { |
diff --git a/server/tests/utils/server/jobs.ts b/server/tests/utils/server/jobs.ts index 4c02cace5..26180ec72 100644 --- a/server/tests/utils/server/jobs.ts +++ b/server/tests/utils/server/jobs.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import * as request from 'supertest' | 1 | import * as request from 'supertest' |
2 | import { Job, JobState } from '../../../../shared/models' | 2 | import { Job, JobState } from '../../../../shared/models' |
3 | import { ServerInfo, wait } from '../index' | 3 | import { ServerInfo } from './servers' |
4 | import { wait } from '../miscs/miscs' | ||
4 | 5 | ||
5 | function getJobsList (url: string, accessToken: string, state: JobState) { | 6 | function getJobsList (url: string, accessToken: string, state: JobState) { |
6 | const path = '/api/v1/jobs/' + state | 7 | const path = '/api/v1/jobs/' + state |
diff --git a/server/tests/utils/server/stats.ts b/server/tests/utils/server/stats.ts index 01989d952..6f079ad18 100644 --- a/server/tests/utils/server/stats.ts +++ b/server/tests/utils/server/stats.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { makeGetRequest } from '../' | 1 | import { makeGetRequest } from '../requests/requests' |
2 | 2 | ||
3 | function getStats (url: string, useCache = false) { | 3 | function getStats (url: string, useCache = false) { |
4 | const path = '/api/v1/server/stats' | 4 | const path = '/api/v1/server/stats' |
diff --git a/server/tests/utils/users/accounts.ts b/server/tests/utils/users/accounts.ts index f82b8d906..257fa5b27 100644 --- a/server/tests/utils/users/accounts.ts +++ b/server/tests/utils/users/accounts.ts | |||
@@ -4,7 +4,7 @@ import { expect } from 'chai' | |||
4 | import { existsSync, readdir } from 'fs-extra' | 4 | import { existsSync, readdir } from 'fs-extra' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { Account } from '../../../../shared/models/actors' | 6 | import { Account } from '../../../../shared/models/actors' |
7 | import { root } from '../index' | 7 | import { root } from '../miscs/miscs' |
8 | import { makeGetRequest } from '../requests/requests' | 8 | import { makeGetRequest } from '../requests/requests' |
9 | 9 | ||
10 | function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) { | 10 | function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) { |
diff --git a/server/tests/utils/users/blocklist.ts b/server/tests/utils/users/blocklist.ts index 35b537571..0ead5e5f6 100644 --- a/server/tests/utils/users/blocklist.ts +++ b/server/tests/utils/users/blocklist.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* tslint:disable:no-unused-expression */ |
2 | 2 | ||
3 | import { makeDeleteRequest, makePostBodyRequest } from '../index' | 3 | import { makeDeleteRequest, makePostBodyRequest } from '../requests/requests' |
4 | import { makeGetRequest } from '../requests/requests' | 4 | import { makeGetRequest } from '../requests/requests' |
5 | 5 | ||
6 | function getAccountBlocklistByAccount ( | 6 | function getAccountBlocklistByAccount ( |
diff --git a/server/tests/utils/users/user-subscriptions.ts b/server/tests/utils/users/user-subscriptions.ts index b0e7da7cc..7148fbfca 100644 --- a/server/tests/utils/users/user-subscriptions.ts +++ b/server/tests/utils/users/user-subscriptions.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { makeDeleteRequest, makeGetRequest, makePostBodyRequest } from '../' | 1 | import { makeDeleteRequest, makeGetRequest, makePostBodyRequest } from '../requests/requests' |
2 | 2 | ||
3 | function addUserSubscription (url: string, token: string, targetUri: string, statusCodeExpected = 204) { | 3 | function addUserSubscription (url: string, token: string, targetUri: string, statusCodeExpected = 204) { |
4 | const path = '/api/v1/users/me/subscriptions' | 4 | const path = '/api/v1/users/me/subscriptions' |
diff --git a/server/tests/utils/users/users.ts b/server/tests/utils/users/users.ts index d77233d62..2c21a9ecf 100644 --- a/server/tests/utils/users/users.ts +++ b/server/tests/utils/users/users.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as request from 'supertest' | 1 | import * as request from 'supertest' |
2 | import { makePostBodyRequest, makePutBodyRequest, updateAvatarRequest } from '../' | 2 | import { makePostBodyRequest, makePutBodyRequest, updateAvatarRequest } from '../requests/requests' |
3 | 3 | ||
4 | import { UserRole } from '../../../../shared/index' | 4 | import { UserRole } from '../../../../shared/index' |
5 | import { NSFWPolicyType } from '../../../../shared/models/videos/nsfw-policy.type' | 5 | import { NSFWPolicyType } from '../../../../shared/models/videos/nsfw-policy.type' |
diff --git a/server/tests/utils/videos/video-abuses.ts b/server/tests/utils/videos/video-abuses.ts index 14907e6a0..4ad82ad8c 100644 --- a/server/tests/utils/videos/video-abuses.ts +++ b/server/tests/utils/videos/video-abuses.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as request from 'supertest' | 1 | import * as request from 'supertest' |
2 | import { VideoAbuseUpdate } from '../../../../shared/models/videos/abuse/video-abuse-update.model' | 2 | import { VideoAbuseUpdate } from '../../../../shared/models/videos/abuse/video-abuse-update.model' |
3 | import { makeDeleteRequest, makePutBodyRequest } from '..' | 3 | import { makeDeleteRequest, makePutBodyRequest } from '../requests/requests' |
4 | 4 | ||
5 | function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 200) { | 5 | function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 200) { |
6 | const path = '/api/v1/videos/' + videoId + '/abuse' | 6 | const path = '/api/v1/videos/' + videoId + '/abuse' |
diff --git a/server/tests/utils/videos/video-captions.ts b/server/tests/utils/videos/video-captions.ts index 41e52be07..8d67f617b 100644 --- a/server/tests/utils/videos/video-captions.ts +++ b/server/tests/utils/videos/video-captions.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { makeDeleteRequest, makeGetRequest } from '../' | 1 | import { makeDeleteRequest, makeGetRequest, makeUploadRequest } from '../requests/requests' |
2 | import { buildAbsoluteFixturePath, makeUploadRequest } from '../index' | ||
3 | import * as request from 'supertest' | 2 | import * as request from 'supertest' |
4 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import { buildAbsoluteFixturePath } from '../miscs/miscs' | ||
5 | 5 | ||
6 | const expect = chai.expect | 6 | const expect = chai.expect |
7 | 7 | ||
diff --git a/server/tests/utils/videos/video-channels.ts b/server/tests/utils/videos/video-channels.ts index 092985777..70e8d1a6b 100644 --- a/server/tests/utils/videos/video-channels.ts +++ b/server/tests/utils/videos/video-channels.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as request from 'supertest' | 1 | import * as request from 'supertest' |
2 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../../shared/models/videos' | 2 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../../shared/models/videos' |
3 | import { updateAvatarRequest } from '../index' | 3 | import { updateAvatarRequest } from '../requests/requests' |
4 | 4 | ||
5 | function getVideoChannelsList (url: string, start: number, count: number, sort?: string) { | 5 | function getVideoChannelsList (url: string, start: number, count: number, sort?: string) { |
6 | const path = '/api/v1/video-channels' | 6 | const path = '/api/v1/video-channels' |
diff --git a/server/tests/utils/videos/video-comments.ts b/server/tests/utils/videos/video-comments.ts index 7d4cae364..0ebf69ced 100644 --- a/server/tests/utils/videos/video-comments.ts +++ b/server/tests/utils/videos/video-comments.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as request from 'supertest' | 1 | import * as request from 'supertest' |
2 | import { makeDeleteRequest } from '../' | 2 | import { makeDeleteRequest } from '../requests/requests' |
3 | 3 | ||
4 | function getVideoCommentThreads (url: string, videoId: number | string, start: number, count: number, sort?: string, token?: string) { | 4 | function getVideoCommentThreads (url: string, videoId: number | string, start: number, count: number, sort?: string, token?: string) { |
5 | const path = '/api/v1/videos/' + videoId + '/comment-threads' | 5 | const path = '/api/v1/videos/' + videoId + '/comment-threads' |
diff --git a/server/tests/utils/videos/video-imports.ts b/server/tests/utils/videos/video-imports.ts index 59dfd481a..eb985a5b1 100644 --- a/server/tests/utils/videos/video-imports.ts +++ b/server/tests/utils/videos/video-imports.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { VideoImportCreate } from '../../../../shared/models/videos' | 1 | import { VideoImportCreate } from '../../../../shared/models/videos' |
2 | import { makeGetRequest, makeUploadRequest } from '..' | 2 | import { makeGetRequest, makeUploadRequest } from '../requests/requests' |
3 | 3 | ||
4 | function getYoutubeVideoUrl () { | 4 | function getYoutubeVideoUrl () { |
5 | return 'https://youtu.be/msX3jv1XdvM' | 5 | return 'https://youtu.be/msX3jv1XdvM' |
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index 87c385f38..d6c3e5dac 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts | |||
@@ -17,8 +17,8 @@ import { | |||
17 | testImage | 17 | testImage |
18 | } from '../' | 18 | } from '../' |
19 | import { VideoDetails, VideoPrivacy } from '../../../../shared/models/videos' | 19 | import { VideoDetails, VideoPrivacy } from '../../../../shared/models/videos' |
20 | import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../initializers' | 20 | import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../initializers/constants' |
21 | import { dateIsValid, webtorrentAdd } from '../index' | 21 | import { dateIsValid, webtorrentAdd } from '../miscs/miscs' |
22 | 22 | ||
23 | type VideoAttributes = { | 23 | type VideoAttributes = { |
24 | name?: string | 24 | name?: string |