Merge branch 'move-utils-to-shared' of https://github.com/buoyantair/PeerTube into buoyantair-move-utils-to-shared
This commit is contained in:
commit
2a8c5d0af1
|
@ -13,7 +13,6 @@ import { forwardVideoRelatedActivity } from '../send/utils'
|
||||||
import { Redis } from '../../redis'
|
import { Redis } from '../../redis'
|
||||||
import { createOrUpdateCacheFile } from '../cache-file'
|
import { createOrUpdateCacheFile } from '../cache-file'
|
||||||
import { getVideoDislikeActivityPubUrl } from '../url'
|
import { getVideoDislikeActivityPubUrl } from '../url'
|
||||||
import { VideoModel } from '../../../models/video/video'
|
|
||||||
|
|
||||||
async function processCreateActivity (activity: ActivityCreate, byActor: ActorModel) {
|
async function processCreateActivity (activity: ActivityCreate, byActor: ActorModel) {
|
||||||
const activityObject = activity.object
|
const activityObject = activity.object
|
||||||
|
|
|
@ -8,10 +8,10 @@ import {
|
||||||
flushTests,
|
flushTests,
|
||||||
killallServers,
|
killallServers,
|
||||||
makeActivityPubGetRequest,
|
makeActivityPubGetRequest,
|
||||||
runServer,
|
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers, uploadVideo
|
setAccessTokensToServers,
|
||||||
} from '../../utils'
|
uploadVideo
|
||||||
|
} from '../../../../shared/utils'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,13 @@ import {
|
||||||
killallServers,
|
killallServers,
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
|
setActorField,
|
||||||
|
setVideoField,
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
userLogin
|
userLogin,
|
||||||
} from '../../utils'
|
waitJobs
|
||||||
|
} from '../../../../shared/utils'
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
import { setActorField, setVideoField } from '../../utils/miscs/sql'
|
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
|
||||||
import { Video } from '../../../../shared/models/videos'
|
import { Video } from '../../../../shared/models/videos'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import { buildRequestStub } from '../../utils'
|
import { buildRequestStub } from '../../../../shared/utils/miscs/stubs'
|
||||||
import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto'
|
import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import { buildSignedActivity } from '../../../helpers/activitypub'
|
import { buildSignedActivity } from '../../../helpers/activitypub'
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
/* tslint:disable:no-unused-expression */
|
/* tslint:disable:no-unused-expression */
|
||||||
|
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import { doubleFollow, getVideo, reRunServer } from '../../utils'
|
import {
|
||||||
import { flushAndRunMultipleServers, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo, wait } from '../../utils/index'
|
doubleFollow,
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
flushAndRunMultipleServers,
|
||||||
import { setVideoField } from '../../utils/miscs/sql'
|
getVideo,
|
||||||
|
killallServers,
|
||||||
|
reRunServer,
|
||||||
|
ServerInfo,
|
||||||
|
setAccessTokensToServers,
|
||||||
|
uploadVideo,
|
||||||
|
wait,
|
||||||
|
setVideoField,
|
||||||
|
waitJobs
|
||||||
|
} from '../../../../shared/utils'
|
||||||
|
|
||||||
describe('Test AP refresher', function () {
|
describe('Test AP refresher', function () {
|
||||||
let servers: ServerInfo[] = []
|
let servers: ServerInfo[] = []
|
||||||
|
|
|
@ -2,13 +2,19 @@
|
||||||
|
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
|
|
||||||
import { flushAndRunMultipleServers, flushTests, killallServers, ServerInfo } from '../../utils'
|
import {
|
||||||
|
flushAndRunMultipleServers,
|
||||||
|
flushTests,
|
||||||
|
killallServers,
|
||||||
|
makeFollowRequest,
|
||||||
|
makePOSTAPRequest,
|
||||||
|
ServerInfo,
|
||||||
|
setActorField
|
||||||
|
} from '../../../../shared/utils'
|
||||||
import { HTTP_SIGNATURE } from '../../../initializers'
|
import { HTTP_SIGNATURE } from '../../../initializers'
|
||||||
import { buildDigest, buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activitypub-http-utils'
|
import { buildDigest, buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activitypub-http-utils'
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
import { setActorField } from '../../utils/miscs/sql'
|
|
||||||
import { activityPubContextify, buildSignedActivity } from '../../../helpers/activitypub'
|
import { activityPubContextify, buildSignedActivity } from '../../../helpers/activitypub'
|
||||||
import { makeFollowRequest, makePOSTAPRequest } from '../../utils/requests/activitypub'
|
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,13 @@
|
||||||
|
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
|
|
||||||
import { flushTests, killallServers, runServer, ServerInfo } from '../../utils'
|
import { flushTests, killallServers, runServer, ServerInfo } from '../../../../shared/utils'
|
||||||
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
|
import {
|
||||||
import { getAccount } from '../../utils/users/accounts'
|
checkBadCountPagination,
|
||||||
|
checkBadSortPagination,
|
||||||
|
checkBadStartPagination
|
||||||
|
} from '../../../../shared/utils/requests/check-api-params'
|
||||||
|
import { getAccount } from '../../../../shared/utils/users/accounts'
|
||||||
|
|
||||||
describe('Test users API validators', function () {
|
describe('Test users API validators', function () {
|
||||||
const path = '/api/v1/accounts/'
|
const path = '/api/v1/accounts/'
|
||||||
|
|
|
@ -13,8 +13,12 @@ import {
|
||||||
makePostBodyRequest,
|
makePostBodyRequest,
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers, userLogin
|
setAccessTokensToServers, userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
|
import {
|
||||||
|
checkBadCountPagination,
|
||||||
|
checkBadSortPagination,
|
||||||
|
checkBadStartPagination
|
||||||
|
} from '../../../../shared/utils/requests/check-api-params'
|
||||||
|
|
||||||
describe('Test blocklist API validators', function () {
|
describe('Test blocklist API validators', function () {
|
||||||
let servers: ServerInfo[]
|
let servers: ServerInfo[]
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { CustomConfig } from '../../../../shared/models/server/custom-config.mod
|
||||||
import {
|
import {
|
||||||
createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePutBodyRequest, runServer, ServerInfo,
|
createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePutBodyRequest, runServer, ServerInfo,
|
||||||
setAccessTokensToServers, userLogin, immutableAssign
|
setAccessTokensToServers, userLogin, immutableAssign
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
|
|
||||||
describe('Test config API validators', function () {
|
describe('Test config API validators', function () {
|
||||||
const path = '/api/v1/config/custom'
|
const path = '/api/v1/config/custom'
|
||||||
|
|
|
@ -5,8 +5,12 @@ import 'mocha'
|
||||||
import {
|
import {
|
||||||
createUser, flushTests, killallServers, makeDeleteRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers,
|
createUser, flushTests, killallServers, makeDeleteRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers,
|
||||||
userLogin
|
userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
|
import {
|
||||||
|
checkBadCountPagination,
|
||||||
|
checkBadSortPagination,
|
||||||
|
checkBadStartPagination
|
||||||
|
} from '../../../../shared/utils/requests/check-api-params'
|
||||||
|
|
||||||
describe('Test server follows API validators', function () {
|
describe('Test server follows API validators', function () {
|
||||||
let server: ServerInfo
|
let server: ServerInfo
|
||||||
|
|
|
@ -2,9 +2,21 @@
|
||||||
|
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
|
|
||||||
import { createUser, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, userLogin } from '../../utils'
|
import {
|
||||||
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
|
createUser,
|
||||||
import { makeGetRequest } from '../../utils/requests/requests'
|
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 () {
|
describe('Test jobs API validators', function () {
|
||||||
const path = '/api/v1/jobs/failed'
|
const path = '/api/v1/jobs/failed'
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
userLogin
|
userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
|
|
||||||
describe('Test server redundancy API validators', function () {
|
describe('Test server redundancy API validators', function () {
|
||||||
let servers: ServerInfo[]
|
let servers: ServerInfo[]
|
||||||
|
|
|
@ -2,8 +2,12 @@
|
||||||
|
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
|
|
||||||
import { flushTests, immutableAssign, killallServers, makeGetRequest, runServer, ServerInfo } from '../../utils'
|
import { flushTests, immutableAssign, killallServers, makeGetRequest, runServer, ServerInfo } from '../../../../shared/utils'
|
||||||
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
|
import {
|
||||||
|
checkBadCountPagination,
|
||||||
|
checkBadSortPagination,
|
||||||
|
checkBadStartPagination
|
||||||
|
} from '../../../../shared/utils/requests/check-api-params'
|
||||||
|
|
||||||
describe('Test videos API validator', function () {
|
describe('Test videos API validator', function () {
|
||||||
let server: ServerInfo
|
let server: ServerInfo
|
||||||
|
|
|
@ -2,7 +2,15 @@
|
||||||
|
|
||||||
import 'mocha'
|
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 () {
|
describe('Test services API validators', function () {
|
||||||
let server: ServerInfo
|
let server: ServerInfo
|
||||||
|
|
|
@ -13,9 +13,14 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
userLogin
|
userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
|
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import {
|
||||||
|
checkBadCountPagination,
|
||||||
|
checkBadSortPagination,
|
||||||
|
checkBadStartPagination
|
||||||
|
} from '../../../../shared/utils/requests/check-api-params'
|
||||||
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
describe('Test user subscriptions API validators', function () {
|
describe('Test user subscriptions API validators', function () {
|
||||||
const path = '/api/v1/users/me/subscriptions'
|
const path = '/api/v1/users/me/subscriptions'
|
||||||
|
|
|
@ -9,11 +9,15 @@ import {
|
||||||
createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest,
|
createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest,
|
||||||
makePostBodyRequest, makeUploadRequest, makePutBodyRequest, registerUser, removeUser, runServer, ServerInfo, setAccessTokensToServers,
|
makePostBodyRequest, makeUploadRequest, makePutBodyRequest, registerUser, removeUser, runServer, ServerInfo, setAccessTokensToServers,
|
||||||
updateUser, uploadVideo, userLogin, deleteMe, unblockUser, blockUser
|
updateUser, uploadVideo, userLogin, deleteMe, unblockUser, blockUser
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
|
import {
|
||||||
import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../utils/videos/video-imports'
|
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 { VideoPrivacy } from '../../../../shared/models/videos'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
|
|
||||||
describe('Test users API validators', function () {
|
describe('Test users API validators', function () {
|
||||||
|
|
|
@ -15,8 +15,12 @@ import {
|
||||||
updateVideoAbuse,
|
updateVideoAbuse,
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
userLogin
|
userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
|
import {
|
||||||
|
checkBadCountPagination,
|
||||||
|
checkBadSortPagination,
|
||||||
|
checkBadStartPagination
|
||||||
|
} from '../../../../shared/utils/requests/check-api-params'
|
||||||
import { VideoAbuseState } from '../../../../shared/models/videos'
|
import { VideoAbuseState } from '../../../../shared/models/videos'
|
||||||
|
|
||||||
describe('Test video abuses API validators', function () {
|
describe('Test video abuses API validators', function () {
|
||||||
|
|
|
@ -15,8 +15,12 @@ import {
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
userLogin
|
userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
|
import {
|
||||||
|
checkBadCountPagination,
|
||||||
|
checkBadSortPagination,
|
||||||
|
checkBadStartPagination
|
||||||
|
} from '../../../../shared/utils/requests/check-api-params'
|
||||||
import { VideoDetails } from '../../../../shared/models/videos'
|
import { VideoDetails } from '../../../../shared/models/videos'
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ import {
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
userLogin
|
userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { join } from 'path'
|
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 () {
|
describe('Test video captions API validator', function () {
|
||||||
const path = '/api/v1/videos/'
|
const path = '/api/v1/videos/'
|
||||||
|
|
|
@ -20,8 +20,12 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
userLogin
|
userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
|
import {
|
||||||
|
checkBadCountPagination,
|
||||||
|
checkBadSortPagination,
|
||||||
|
checkBadStartPagination
|
||||||
|
} from '../../../../shared/utils/requests/check-api-params'
|
||||||
import { User } from '../../../../shared/models/users'
|
import { User } from '../../../../shared/models/users'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,13 @@ import {
|
||||||
createUser,
|
createUser,
|
||||||
flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers,
|
flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers,
|
||||||
uploadVideo, userLogin
|
uploadVideo, userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
|
import {
|
||||||
import { addVideoCommentThread } from '../../utils/videos/video-comments'
|
checkBadCountPagination,
|
||||||
|
checkBadSortPagination,
|
||||||
|
checkBadStartPagination
|
||||||
|
} from '../../../../shared/utils/requests/check-api-params'
|
||||||
|
import { addVideoCommentThread } from '../../../../shared/utils/videos/video-comments'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,13 @@ import {
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
updateCustomSubConfig,
|
updateCustomSubConfig,
|
||||||
userLogin
|
userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
|
import {
|
||||||
import { getMagnetURI, getYoutubeVideoUrl } from '../../utils/videos/video-imports'
|
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 () {
|
describe('Test video imports API validator', function () {
|
||||||
const path = '/api/v1/videos/imports'
|
const path = '/api/v1/videos/imports'
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
userLogin
|
userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { UserRole } from '../../../../shared/models/users'
|
import { UserRole } from '../../../../shared/models/users'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo
|
uploadVideo
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,13 @@ import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enu
|
||||||
import {
|
import {
|
||||||
createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest,
|
createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest,
|
||||||
makeGetRequest, makeUploadRequest, makePutBodyRequest, removeVideo, runServer, ServerInfo, setAccessTokensToServers, userLogin
|
makeGetRequest, makeUploadRequest, makePutBodyRequest, removeVideo, runServer, ServerInfo, setAccessTokensToServers, userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
|
import {
|
||||||
import { getAccountsList } from '../../utils/users/accounts'
|
checkBadCountPagination,
|
||||||
|
checkBadSortPagination,
|
||||||
|
checkBadStartPagination
|
||||||
|
} from '../../../../shared/utils/requests/check-api-params'
|
||||||
|
import { getAccountsList } from '../../../../shared/utils/users/accounts'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -18,15 +18,16 @@ import {
|
||||||
wait,
|
wait,
|
||||||
waitUntilLog,
|
waitUntilLog,
|
||||||
checkVideoFilesWereRemoved, removeVideo, getVideoWithToken
|
checkVideoFilesWereRemoved, removeVideo, getVideoWithToken
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
import * as magnetUtil from 'magnet-uri'
|
import * as magnetUtil from 'magnet-uri'
|
||||||
import { updateRedundancy } from '../../utils/server/redundancy'
|
import { updateRedundancy } from '../../../../shared/utils/server/redundancy'
|
||||||
import { ActorFollow } from '../../../../shared/models/actors'
|
import { ActorFollow } from '../../../../shared/models/actors'
|
||||||
import { readdir } from 'fs-extra'
|
import { readdir } from 'fs-extra'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { VideoRedundancyStrategy } from '../../../../shared/models/redundancy'
|
import { VideoRedundancyStrategy } from '../../../../shared/models/redundancy'
|
||||||
import { getStats } from '../../utils/server/stats'
|
import { getStats } from '../../../../shared/utils/server/stats'
|
||||||
import { ServerStats } from '../../../../shared/models/server/server-stats.model'
|
import { ServerStats } from '../../../../shared/models/server/server-stats.model'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -17,10 +17,10 @@ import {
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
userLogin,
|
userLogin,
|
||||||
wait
|
wait
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
import { VideoChannel } from '../../../../shared/models/videos'
|
import { VideoChannel } from '../../../../shared/models/videos'
|
||||||
import { searchVideoChannel } from '../../utils/search/video-channels'
|
import { searchVideoChannel } from '../../../../shared/utils/search/video-channels'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ import {
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
wait,
|
wait,
|
||||||
searchVideo
|
searchVideo
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
import { Video, VideoPrivacy } from '../../../../shared/models/videos'
|
import { Video, VideoPrivacy } from '../../../../shared/models/videos'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
wait,
|
wait,
|
||||||
immutableAssign
|
immutableAssign
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,11 @@ import 'mocha'
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
import { About } from '../../../../shared/models/server/about.model'
|
import { About } from '../../../../shared/models/server/about.model'
|
||||||
import { CustomConfig } from '../../../../shared/models/server/custom-config.model'
|
import { CustomConfig } from '../../../../shared/models/server/custom-config.model'
|
||||||
import { deleteCustomConfig, getAbout, killallServers, reRunServer } from '../../utils'
|
|
||||||
import {
|
import {
|
||||||
|
deleteCustomConfig,
|
||||||
|
getAbout,
|
||||||
|
killallServers,
|
||||||
|
reRunServer,
|
||||||
flushTests,
|
flushTests,
|
||||||
getConfig,
|
getConfig,
|
||||||
getCustomConfig,
|
getCustomConfig,
|
||||||
|
@ -13,7 +16,7 @@ import {
|
||||||
runServer,
|
runServer,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
updateCustomConfig
|
updateCustomConfig
|
||||||
} from '../../utils/index'
|
} from '../../../../shared/utils'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,14 @@ import {
|
||||||
unblockUser,
|
unblockUser,
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
userLogin,
|
userLogin,
|
||||||
verifyEmail
|
verifyEmail,
|
||||||
} from '../../utils'
|
flushTests,
|
||||||
import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from '../../utils/index'
|
killallServers,
|
||||||
import { mockSmtpServer } from '../../utils/miscs/email'
|
ServerInfo,
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
setAccessTokensToServers
|
||||||
|
} from '../../../../shared/utils'
|
||||||
|
import { mockSmtpServer } from '../../../../shared/utils/miscs/email'
|
||||||
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,21 @@
|
||||||
|
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import { doubleFollow, getAccountVideos, getVideo, getVideoChannelVideos, getVideoWithToken } from '../../utils'
|
import {
|
||||||
import { flushAndRunMultipleServers, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils/index'
|
doubleFollow,
|
||||||
import { unfollow } from '../../utils/server/follows'
|
getAccountVideos,
|
||||||
import { userLogin } from '../../utils/users/login'
|
getVideo,
|
||||||
import { createUser } from '../../utils/users/users'
|
getVideoChannelVideos,
|
||||||
|
getVideoWithToken,
|
||||||
|
flushAndRunMultipleServers,
|
||||||
|
killallServers,
|
||||||
|
ServerInfo,
|
||||||
|
setAccessTokensToServers,
|
||||||
|
uploadVideo
|
||||||
|
} from '../../../../shared/utils'
|
||||||
|
import { unfollow } from '../../../../shared/utils/server/follows'
|
||||||
|
import { userLogin } from '../../../../shared/utils/users/login'
|
||||||
|
import { createUser } from '../../../../shared/utils/users/users'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as chai from 'chai'
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import { Video, VideoPrivacy } from '../../../../shared/models/videos'
|
import { Video, VideoPrivacy } from '../../../../shared/models/videos'
|
||||||
import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
|
import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
|
||||||
import { completeVideoCheck } from '../../utils'
|
import { completeVideoCheck } from '../../../../shared/utils'
|
||||||
import {
|
import {
|
||||||
flushAndRunMultipleServers,
|
flushAndRunMultipleServers,
|
||||||
getVideosList,
|
getVideosList,
|
||||||
|
@ -12,21 +12,26 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo
|
uploadVideo
|
||||||
} from '../../utils/index'
|
} from '../../../../shared/utils/index'
|
||||||
import { dateIsValid } from '../../utils/miscs/miscs'
|
import { dateIsValid } from '../../../../shared/utils/miscs/miscs'
|
||||||
import { follow, getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, unfollow } from '../../utils/server/follows'
|
import {
|
||||||
import { expectAccountFollows } from '../../utils/users/accounts'
|
follow,
|
||||||
import { userLogin } from '../../utils/users/login'
|
getFollowersListPaginationAndSort,
|
||||||
import { createUser } from '../../utils/users/users'
|
getFollowingListPaginationAndSort,
|
||||||
|
unfollow
|
||||||
|
} from '../../../../shared/utils/server/follows'
|
||||||
|
import { expectAccountFollows } from '../../../../shared/utils/users/accounts'
|
||||||
|
import { userLogin } from '../../../../shared/utils/users/login'
|
||||||
|
import { createUser } from '../../../../shared/utils/users/users'
|
||||||
import {
|
import {
|
||||||
addVideoCommentReply,
|
addVideoCommentReply,
|
||||||
addVideoCommentThread,
|
addVideoCommentThread,
|
||||||
getVideoCommentThreads,
|
getVideoCommentThreads,
|
||||||
getVideoThreadComments
|
getVideoThreadComments
|
||||||
} from '../../utils/videos/video-comments'
|
} from '../../../../shared/utils/videos/video-comments'
|
||||||
import { rateVideo } from '../../utils/videos/videos'
|
import { rateVideo } from '../../../../shared/utils/videos/videos'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
import { createVideoCaption, listVideoCaptions, testCaptionFile } from '../../utils/videos/video-captions'
|
import { createVideoCaption, listVideoCaptions, testCaptionFile } from '../../../../shared/utils/videos/video-captions'
|
||||||
import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model'
|
import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -5,24 +5,31 @@ import 'mocha'
|
||||||
import { JobState, Video } from '../../../../shared/models'
|
import { JobState, Video } from '../../../../shared/models'
|
||||||
import { VideoPrivacy } from '../../../../shared/models/videos'
|
import { VideoPrivacy } from '../../../../shared/models/videos'
|
||||||
import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
|
import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
|
||||||
import { completeVideoCheck, getVideo, immutableAssign, reRunServer, unfollow, updateVideo, viewVideo } from '../../utils'
|
|
||||||
import {
|
import {
|
||||||
|
completeVideoCheck,
|
||||||
|
getVideo,
|
||||||
|
immutableAssign,
|
||||||
|
reRunServer,
|
||||||
|
unfollow,
|
||||||
|
viewVideo,
|
||||||
flushAndRunMultipleServers,
|
flushAndRunMultipleServers,
|
||||||
getVideosList,
|
getVideosList,
|
||||||
killallServers,
|
killallServers,
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
|
updateVideo,
|
||||||
wait
|
wait
|
||||||
} from '../../utils/index'
|
} from '../../../../shared/utils'
|
||||||
import { follow, getFollowersListPaginationAndSort } from '../../utils/server/follows'
|
import { follow, getFollowersListPaginationAndSort } from '../../../../shared/utils/server/follows'
|
||||||
import { getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs'
|
import { getJobsListPaginationAndSort, waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
import {
|
import {
|
||||||
addVideoCommentReply,
|
addVideoCommentReply,
|
||||||
addVideoCommentThread,
|
addVideoCommentThread,
|
||||||
getVideoCommentThreads,
|
getVideoCommentThreads,
|
||||||
getVideoThreadComments
|
getVideoThreadComments
|
||||||
} from '../../utils/videos/video-comments'
|
} from '../../../../shared/utils/videos/video-comments'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import { killallServers, ServerInfo, setAccessTokensToServers } from '../../utils/index'
|
import { killallServers, ServerInfo, setAccessTokensToServers } from '../../../../shared/utils/index'
|
||||||
import { doubleFollow } from '../../utils/server/follows'
|
import { doubleFollow } from '../../../../shared/utils/server/follows'
|
||||||
import { getJobsList, getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs'
|
import { getJobsList, getJobsListPaginationAndSort, waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
import { flushAndRunMultipleServers } from '../../utils/server/servers'
|
import { flushAndRunMultipleServers } from '../../../../shared/utils/server/servers'
|
||||||
import { uploadVideo } from '../../utils/videos/videos'
|
import { uploadVideo } from '../../../../shared/utils/videos/videos'
|
||||||
import { dateIsValid } from '../../utils/miscs/miscs'
|
import { dateIsValid } from '../../../../shared/utils/miscs/miscs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ import {
|
||||||
flushTests,
|
flushTests,
|
||||||
killallServers,
|
killallServers,
|
||||||
ServerInfo
|
ServerInfo
|
||||||
} from '../../utils/index'
|
} from '../../../../shared/utils'
|
||||||
import { runServer } from '../../utils/server/servers'
|
import { runServer } from '../../../../shared/utils/server/servers'
|
||||||
|
|
||||||
describe('Start and stop server without web client routes', function () {
|
describe('Start and stop server without web client routes', function () {
|
||||||
let server: ServerInfo
|
let server: ServerInfo
|
||||||
|
|
|
@ -0,0 +1,479 @@
|
||||||
|
/* tslint:disable:no-unused-expression */
|
||||||
|
|
||||||
|
import * as chai from 'chai'
|
||||||
|
import 'mocha'
|
||||||
|
import { VideoDetails } from '../../../../shared/models/videos'
|
||||||
|
import {
|
||||||
|
doubleFollow,
|
||||||
|
flushAndRunMultipleServers,
|
||||||
|
getFollowingListPaginationAndSort,
|
||||||
|
getVideo,
|
||||||
|
immutableAssign,
|
||||||
|
killallServers, makeGetRequest,
|
||||||
|
root,
|
||||||
|
ServerInfo,
|
||||||
|
setAccessTokensToServers, unfollow,
|
||||||
|
uploadVideo,
|
||||||
|
viewVideo,
|
||||||
|
wait,
|
||||||
|
waitUntilLog,
|
||||||
|
checkVideoFilesWereRemoved, removeVideo
|
||||||
|
} from '../../../../shared/utils'
|
||||||
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
import * as magnetUtil from 'magnet-uri'
|
||||||
|
import { updateRedundancy } from '../../../../shared/utils/server/redundancy'
|
||||||
|
import { ActorFollow } from '../../../../shared/models/actors'
|
||||||
|
import { readdir } from 'fs-extra'
|
||||||
|
import { join } from 'path'
|
||||||
|
import { VideoRedundancyStrategy } from '../../../../shared/models/redundancy'
|
||||||
|
import { getStats } from '../../../../shared/utils/server/stats'
|
||||||
|
import { ServerStats } from '../../../../shared/models/server/server-stats.model'
|
||||||
|
|
||||||
|
const expect = chai.expect
|
||||||
|
|
||||||
|
let servers: ServerInfo[] = []
|
||||||
|
let video1Server2UUID: string
|
||||||
|
|
||||||
|
function checkMagnetWebseeds (file: { magnetUri: string, resolution: { id: number } }, baseWebseeds: string[], server: ServerInfo) {
|
||||||
|
const parsed = magnetUtil.decode(file.magnetUri)
|
||||||
|
|
||||||
|
for (const ws of baseWebseeds) {
|
||||||
|
const found = parsed.urlList.find(url => url === `${ws}-${file.resolution.id}.mp4`)
|
||||||
|
expect(found, `Webseed ${ws} not found in ${file.magnetUri} on server ${server.url}`).to.not.be.undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(parsed.urlList).to.have.lengthOf(baseWebseeds.length)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function runServers (strategy: VideoRedundancyStrategy, additionalParams: any = {}) {
|
||||||
|
const config = {
|
||||||
|
redundancy: {
|
||||||
|
videos: {
|
||||||
|
check_interval: '5 seconds',
|
||||||
|
strategies: [
|
||||||
|
immutableAssign({
|
||||||
|
min_lifetime: '1 hour',
|
||||||
|
strategy: strategy,
|
||||||
|
size: '100KB'
|
||||||
|
}, additionalParams)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
servers = await flushAndRunMultipleServers(3, config)
|
||||||
|
|
||||||
|
// Get the access tokens
|
||||||
|
await setAccessTokensToServers(servers)
|
||||||
|
|
||||||
|
{
|
||||||
|
const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 1 server 2' })
|
||||||
|
video1Server2UUID = res.body.video.uuid
|
||||||
|
|
||||||
|
await viewVideo(servers[ 1 ].url, video1Server2UUID)
|
||||||
|
}
|
||||||
|
|
||||||
|
await waitJobs(servers)
|
||||||
|
|
||||||
|
// Server 1 and server 2 follow each other
|
||||||
|
await doubleFollow(servers[ 0 ], servers[ 1 ])
|
||||||
|
// Server 1 and server 3 follow each other
|
||||||
|
await doubleFollow(servers[ 0 ], servers[ 2 ])
|
||||||
|
// Server 2 and server 3 follow each other
|
||||||
|
await doubleFollow(servers[ 1 ], servers[ 2 ])
|
||||||
|
|
||||||
|
await waitJobs(servers)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function check1WebSeed (strategy: VideoRedundancyStrategy, videoUUID?: string) {
|
||||||
|
if (!videoUUID) videoUUID = video1Server2UUID
|
||||||
|
|
||||||
|
const webseeds = [
|
||||||
|
'http://localhost:9002/static/webseed/' + videoUUID
|
||||||
|
]
|
||||||
|
|
||||||
|
for (const server of servers) {
|
||||||
|
{
|
||||||
|
const res = await getVideo(server.url, videoUUID)
|
||||||
|
|
||||||
|
const video: VideoDetails = res.body
|
||||||
|
for (const f of video.files) {
|
||||||
|
checkMagnetWebseeds(f, webseeds, server)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function checkStatsWith2Webseed (strategy: VideoRedundancyStrategy) {
|
||||||
|
const res = await getStats(servers[0].url)
|
||||||
|
const data: ServerStats = res.body
|
||||||
|
|
||||||
|
expect(data.videosRedundancy).to.have.lengthOf(1)
|
||||||
|
const stat = data.videosRedundancy[0]
|
||||||
|
|
||||||
|
expect(stat.strategy).to.equal(strategy)
|
||||||
|
expect(stat.totalSize).to.equal(102400)
|
||||||
|
expect(stat.totalUsed).to.be.at.least(1).and.below(102401)
|
||||||
|
expect(stat.totalVideoFiles).to.equal(4)
|
||||||
|
expect(stat.totalVideos).to.equal(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function checkStatsWith1Webseed (strategy: VideoRedundancyStrategy) {
|
||||||
|
const res = await getStats(servers[0].url)
|
||||||
|
const data: ServerStats = res.body
|
||||||
|
|
||||||
|
expect(data.videosRedundancy).to.have.lengthOf(1)
|
||||||
|
|
||||||
|
const stat = data.videosRedundancy[0]
|
||||||
|
expect(stat.strategy).to.equal(strategy)
|
||||||
|
expect(stat.totalSize).to.equal(102400)
|
||||||
|
expect(stat.totalUsed).to.equal(0)
|
||||||
|
expect(stat.totalVideoFiles).to.equal(0)
|
||||||
|
expect(stat.totalVideos).to.equal(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function check2Webseeds (strategy: VideoRedundancyStrategy, videoUUID?: string) {
|
||||||
|
if (!videoUUID) videoUUID = video1Server2UUID
|
||||||
|
|
||||||
|
const webseeds = [
|
||||||
|
'http://localhost:9001/static/webseed/' + videoUUID,
|
||||||
|
'http://localhost:9002/static/webseed/' + videoUUID
|
||||||
|
]
|
||||||
|
|
||||||
|
for (const server of servers) {
|
||||||
|
const res = await getVideo(server.url, videoUUID)
|
||||||
|
|
||||||
|
const video: VideoDetails = res.body
|
||||||
|
|
||||||
|
for (const file of video.files) {
|
||||||
|
checkMagnetWebseeds(file, webseeds, server)
|
||||||
|
|
||||||
|
// Only servers 1 and 2 have the video
|
||||||
|
if (server.serverNumber !== 3) {
|
||||||
|
await makeGetRequest({
|
||||||
|
url: server.url,
|
||||||
|
statusCodeExpected: 200,
|
||||||
|
path: '/static/webseed/' + `${videoUUID}-${file.resolution.id}.mp4`,
|
||||||
|
contentType: null
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const directory of [ 'test1', 'test2' ]) {
|
||||||
|
const files = await readdir(join(root(), directory, 'videos'))
|
||||||
|
expect(files).to.have.length.at.least(4)
|
||||||
|
|
||||||
|
for (const resolution of [ 240, 360, 480, 720 ]) {
|
||||||
|
expect(files.find(f => f === `${videoUUID}-${resolution}.mp4`)).to.not.be.undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function enableRedundancyOnServer1 () {
|
||||||
|
await updateRedundancy(servers[ 0 ].url, servers[ 0 ].accessToken, servers[ 1 ].host, true)
|
||||||
|
|
||||||
|
const res = await getFollowingListPaginationAndSort(servers[ 0 ].url, 0, 5, '-createdAt')
|
||||||
|
const follows: ActorFollow[] = res.body.data
|
||||||
|
const server2 = follows.find(f => f.following.host === 'localhost:9002')
|
||||||
|
const server3 = follows.find(f => f.following.host === 'localhost:9003')
|
||||||
|
|
||||||
|
expect(server3).to.not.be.undefined
|
||||||
|
expect(server3.following.hostRedundancyAllowed).to.be.false
|
||||||
|
|
||||||
|
expect(server2).to.not.be.undefined
|
||||||
|
expect(server2.following.hostRedundancyAllowed).to.be.true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function disableRedundancyOnServer1 () {
|
||||||
|
await updateRedundancy(servers[ 0 ].url, servers[ 0 ].accessToken, servers[ 1 ].host, false)
|
||||||
|
|
||||||
|
const res = await getFollowingListPaginationAndSort(servers[ 0 ].url, 0, 5, '-createdAt')
|
||||||
|
const follows: ActorFollow[] = res.body.data
|
||||||
|
const server2 = follows.find(f => f.following.host === 'localhost:9002')
|
||||||
|
const server3 = follows.find(f => f.following.host === 'localhost:9003')
|
||||||
|
|
||||||
|
expect(server3).to.not.be.undefined
|
||||||
|
expect(server3.following.hostRedundancyAllowed).to.be.false
|
||||||
|
|
||||||
|
expect(server2).to.not.be.undefined
|
||||||
|
expect(server2.following.hostRedundancyAllowed).to.be.false
|
||||||
|
}
|
||||||
|
|
||||||
|
async function cleanServers () {
|
||||||
|
killallServers(servers)
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Test videos redundancy', function () {
|
||||||
|
|
||||||
|
describe('With most-views strategy', function () {
|
||||||
|
const strategy = 'most-views'
|
||||||
|
|
||||||
|
before(function () {
|
||||||
|
this.timeout(120000)
|
||||||
|
|
||||||
|
return runServers(strategy)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should have 1 webseed on the first video', async function () {
|
||||||
|
await check1WebSeed(strategy)
|
||||||
|
await checkStatsWith1Webseed(strategy)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should enable redundancy on server 1', function () {
|
||||||
|
return enableRedundancyOnServer1()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should have 2 webseed on the first video', async function () {
|
||||||
|
this.timeout(40000)
|
||||||
|
|
||||||
|
await waitJobs(servers)
|
||||||
|
await waitUntilLog(servers[0], 'Duplicated ', 4)
|
||||||
|
await waitJobs(servers)
|
||||||
|
|
||||||
|
await check2Webseeds(strategy)
|
||||||
|
await checkStatsWith2Webseed(strategy)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should undo redundancy on server 1 and remove duplicated videos', async function () {
|
||||||
|
this.timeout(40000)
|
||||||
|
|
||||||
|
await disableRedundancyOnServer1()
|
||||||
|
|
||||||
|
await waitJobs(servers)
|
||||||
|
await wait(5000)
|
||||||
|
|
||||||
|
await check1WebSeed(strategy)
|
||||||
|
|
||||||
|
await checkVideoFilesWereRemoved(video1Server2UUID, servers[0].serverNumber, [ 'videos' ])
|
||||||
|
})
|
||||||
|
|
||||||
|
after(function () {
|
||||||
|
return cleanServers()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('With trending strategy', function () {
|
||||||
|
const strategy = 'trending'
|
||||||
|
|
||||||
|
before(function () {
|
||||||
|
this.timeout(120000)
|
||||||
|
|
||||||
|
return runServers(strategy)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should have 1 webseed on the first video', async function () {
|
||||||
|
await check1WebSeed(strategy)
|
||||||
|
await checkStatsWith1Webseed(strategy)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should enable redundancy on server 1', function () {
|
||||||
|
return enableRedundancyOnServer1()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should have 2 webseed on the first video', async function () {
|
||||||
|
this.timeout(40000)
|
||||||
|
|
||||||
|
await waitJobs(servers)
|
||||||
|
await waitUntilLog(servers[0], 'Duplicated ', 4)
|
||||||
|
await waitJobs(servers)
|
||||||
|
|
||||||
|
await check2Webseeds(strategy)
|
||||||
|
await checkStatsWith2Webseed(strategy)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should unfollow on server 1 and remove duplicated videos', async function () {
|
||||||
|
this.timeout(40000)
|
||||||
|
|
||||||
|
await unfollow(servers[0].url, servers[0].accessToken, servers[1])
|
||||||
|
|
||||||
|
await waitJobs(servers)
|
||||||
|
await wait(5000)
|
||||||
|
|
||||||
|
await check1WebSeed(strategy)
|
||||||
|
|
||||||
|
await checkVideoFilesWereRemoved(video1Server2UUID, servers[0].serverNumber, [ 'videos' ])
|
||||||
|
})
|
||||||
|
|
||||||
|
after(function () {
|
||||||
|
return cleanServers()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('With recently added strategy', function () {
|
||||||
|
const strategy = 'recently-added'
|
||||||
|
|
||||||
|
before(function () {
|
||||||
|
this.timeout(120000)
|
||||||
|
|
||||||
|
return runServers(strategy, { min_views: 3 })
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should have 1 webseed on the first video', async function () {
|
||||||
|
await check1WebSeed(strategy)
|
||||||
|
await checkStatsWith1Webseed(strategy)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should enable redundancy on server 1', function () {
|
||||||
|
return enableRedundancyOnServer1()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should still have 1 webseed on the first video', async function () {
|
||||||
|
this.timeout(40000)
|
||||||
|
|
||||||
|
await waitJobs(servers)
|
||||||
|
await wait(15000)
|
||||||
|
await waitJobs(servers)
|
||||||
|
|
||||||
|
await check1WebSeed(strategy)
|
||||||
|
await checkStatsWith1Webseed(strategy)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should view 2 times the first video to have > min_views config', async function () {
|
||||||
|
this.timeout(40000)
|
||||||
|
|
||||||
|
await viewVideo(servers[ 0 ].url, video1Server2UUID)
|
||||||
|
await viewVideo(servers[ 2 ].url, video1Server2UUID)
|
||||||
|
|
||||||
|
await wait(10000)
|
||||||
|
await waitJobs(servers)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should have 2 webseed on the first video', async function () {
|
||||||
|
this.timeout(40000)
|
||||||
|
|
||||||
|
await waitJobs(servers)
|
||||||
|
await waitUntilLog(servers[0], 'Duplicated ', 4)
|
||||||
|
await waitJobs(servers)
|
||||||
|
|
||||||
|
await check2Webseeds(strategy)
|
||||||
|
await checkStatsWith2Webseed(strategy)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should remove the video and the redundancy files', async function () {
|
||||||
|
this.timeout(20000)
|
||||||
|
|
||||||
|
await removeVideo(servers[1].url, servers[1].accessToken, video1Server2UUID)
|
||||||
|
|
||||||
|
await waitJobs(servers)
|
||||||
|
|
||||||
|
for (const server of servers) {
|
||||||
|
await checkVideoFilesWereRemoved(video1Server2UUID, server.serverNumber)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
after(function () {
|
||||||
|
return cleanServers()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('Test expiration', function () {
|
||||||
|
const strategy = 'recently-added'
|
||||||
|
|
||||||
|
async function checkContains (servers: ServerInfo[], str: string) {
|
||||||
|
for (const server of servers) {
|
||||||
|
const res = await getVideo(server.url, video1Server2UUID)
|
||||||
|
const video: VideoDetails = res.body
|
||||||
|
|
||||||
|
for (const f of video.files) {
|
||||||
|
expect(f.magnetUri).to.contain(str)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function checkNotContains (servers: ServerInfo[], str: string) {
|
||||||
|
for (const server of servers) {
|
||||||
|
const res = await getVideo(server.url, video1Server2UUID)
|
||||||
|
const video: VideoDetails = res.body
|
||||||
|
|
||||||
|
for (const f of video.files) {
|
||||||
|
expect(f.magnetUri).to.not.contain(str)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
before(async function () {
|
||||||
|
this.timeout(120000)
|
||||||
|
|
||||||
|
await runServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
|
||||||
|
|
||||||
|
await enableRedundancyOnServer1()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should still have 2 webseeds after 10 seconds', async function () {
|
||||||
|
this.timeout(40000)
|
||||||
|
|
||||||
|
await wait(10000)
|
||||||
|
|
||||||
|
try {
|
||||||
|
await checkContains(servers, 'http%3A%2F%2Flocalhost%3A9001')
|
||||||
|
} catch {
|
||||||
|
// Maybe a server deleted a redundancy in the scheduler
|
||||||
|
await wait(2000)
|
||||||
|
|
||||||
|
await checkContains(servers, 'http%3A%2F%2Flocalhost%3A9001')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should stop server 1 and expire video redundancy', async function () {
|
||||||
|
this.timeout(40000)
|
||||||
|
|
||||||
|
killallServers([ servers[0] ])
|
||||||
|
|
||||||
|
await wait(15000)
|
||||||
|
|
||||||
|
await checkNotContains([ servers[1], servers[2] ], 'http%3A%2F%2Flocalhost%3A9001')
|
||||||
|
})
|
||||||
|
|
||||||
|
after(function () {
|
||||||
|
return killallServers([ servers[1], servers[2] ])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('Test file replacement', function () {
|
||||||
|
let video2Server2UUID: string
|
||||||
|
const strategy = 'recently-added'
|
||||||
|
|
||||||
|
before(async function () {
|
||||||
|
this.timeout(120000)
|
||||||
|
|
||||||
|
await runServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
|
||||||
|
|
||||||
|
await enableRedundancyOnServer1()
|
||||||
|
|
||||||
|
await waitJobs(servers)
|
||||||
|
await waitUntilLog(servers[0], 'Duplicated ', 4)
|
||||||
|
await waitJobs(servers)
|
||||||
|
|
||||||
|
await check2Webseeds(strategy)
|
||||||
|
await checkStatsWith2Webseed(strategy)
|
||||||
|
|
||||||
|
const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 2 server 2' })
|
||||||
|
video2Server2UUID = res.body.video.uuid
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should cache video 2 webseed on the first video', async function () {
|
||||||
|
this.timeout(120000)
|
||||||
|
|
||||||
|
await waitJobs(servers)
|
||||||
|
|
||||||
|
let checked = false
|
||||||
|
|
||||||
|
while (checked === false) {
|
||||||
|
await wait(1000)
|
||||||
|
|
||||||
|
try {
|
||||||
|
await check1WebSeed(strategy, video1Server2UUID)
|
||||||
|
await check2Webseeds(strategy, video2Server2UUID)
|
||||||
|
|
||||||
|
checked = true
|
||||||
|
} catch {
|
||||||
|
checked = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
after(function () {
|
||||||
|
return cleanServers()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
|
@ -15,7 +15,7 @@ import {
|
||||||
userLogin,
|
userLogin,
|
||||||
viewVideo,
|
viewVideo,
|
||||||
wait
|
wait
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -23,7 +23,7 @@ import {
|
||||||
flushTests,
|
flushTests,
|
||||||
runServer,
|
runServer,
|
||||||
registerUser, getCustomConfig, setAccessTokensToServers, updateCustomConfig
|
registerUser, getCustomConfig, setAccessTokensToServers, updateCustomConfig
|
||||||
} from '../../utils/index'
|
} from '../../../../shared/utils/index'
|
||||||
|
|
||||||
describe('Test application behind a reverse proxy', function () {
|
describe('Test application behind a reverse proxy', function () {
|
||||||
let server = null
|
let server = null
|
||||||
|
|
|
@ -13,11 +13,11 @@ import {
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
viewVideo,
|
viewVideo,
|
||||||
wait
|
wait
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { flushTests, setAccessTokensToServers } from '../../utils/index'
|
import { flushTests, setAccessTokensToServers } from '../../../../shared/utils/index'
|
||||||
import { getStats } from '../../utils/server/stats'
|
import { getStats } from '../../../../shared/utils/server/stats'
|
||||||
import { addVideoCommentThread } from '../../utils/videos/video-comments'
|
import { addVideoCommentThread } from '../../../../shared/utils/videos/video-comments'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
import * as magnetUtil from 'magnet-uri'
|
import * as magnetUtil from 'magnet-uri'
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import { getVideo, killallServers, runServer, ServerInfo, uploadVideo } from '../../utils'
|
import { getVideo, killallServers, runServer, ServerInfo, uploadVideo } from '../../../../shared/utils'
|
||||||
import { flushTests, setAccessTokensToServers } from '../../utils/index'
|
import { flushTests, setAccessTokensToServers } from '../../../../shared/utils/index'
|
||||||
import { VideoDetails } from '../../../../shared/models/videos'
|
import { VideoDetails } from '../../../../shared/models/videos'
|
||||||
import * as WebTorrent from 'webtorrent'
|
import * as WebTorrent from 'webtorrent'
|
||||||
|
|
||||||
|
|
|
@ -12,16 +12,16 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
userLogin
|
userLogin
|
||||||
} from '../../utils/index'
|
} from '../../../../shared/utils/index'
|
||||||
import { setAccessTokensToServers } from '../../utils/users/login'
|
import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
|
||||||
import { getVideosListWithToken, getVideosList } from '../../utils/videos/videos'
|
import { getVideosListWithToken, getVideosList } from '../../../../shared/utils/videos/videos'
|
||||||
import {
|
import {
|
||||||
addVideoCommentReply,
|
addVideoCommentReply,
|
||||||
addVideoCommentThread,
|
addVideoCommentThread,
|
||||||
getVideoCommentThreads,
|
getVideoCommentThreads,
|
||||||
getVideoThreadComments
|
getVideoThreadComments
|
||||||
} from '../../utils/videos/video-comments'
|
} from '../../../../shared/utils/videos/video-comments'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
|
import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
|
||||||
import {
|
import {
|
||||||
addAccountToAccountBlocklist,
|
addAccountToAccountBlocklist,
|
||||||
|
@ -36,7 +36,7 @@ import {
|
||||||
removeAccountFromServerBlocklist,
|
removeAccountFromServerBlocklist,
|
||||||
removeServerFromAccountBlocklist,
|
removeServerFromAccountBlocklist,
|
||||||
removeServerFromServerBlocklist
|
removeServerFromServerBlocklist
|
||||||
} from '../../utils/users/blocklist'
|
} from '../../../../shared/utils/users/blocklist'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,27 @@
|
||||||
|
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import { createUser, doubleFollow, flushAndRunMultipleServers, follow, getVideosList, unfollow, updateVideo, userLogin } from '../../utils'
|
import {
|
||||||
import { killallServers, ServerInfo, uploadVideo } from '../../utils/index'
|
createUser,
|
||||||
import { setAccessTokensToServers } from '../../utils/users/login'
|
doubleFollow,
|
||||||
|
flushAndRunMultipleServers,
|
||||||
|
follow,
|
||||||
|
getVideosList,
|
||||||
|
unfollow,
|
||||||
|
updateVideo,
|
||||||
|
userLogin
|
||||||
|
} from '../../../../shared/utils'
|
||||||
|
import { killallServers, ServerInfo, uploadVideo } from '../../../../shared/utils/index'
|
||||||
|
import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
|
||||||
import { Video, VideoChannel } from '../../../../shared/models/videos'
|
import { Video, VideoChannel } from '../../../../shared/models/videos'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
import {
|
import {
|
||||||
addUserSubscription,
|
addUserSubscription,
|
||||||
listUserSubscriptions,
|
listUserSubscriptions,
|
||||||
listUserSubscriptionVideos,
|
listUserSubscriptionVideos,
|
||||||
removeUserSubscription,
|
removeUserSubscription,
|
||||||
getUserSubscription, areSubscriptionsExist
|
getUserSubscription, areSubscriptionsExist
|
||||||
} from '../../utils/users/user-subscriptions'
|
} from '../../../../shared/utils/users/user-subscriptions'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -13,13 +13,13 @@ import {
|
||||||
removeUser,
|
removeUser,
|
||||||
updateMyUser,
|
updateMyUser,
|
||||||
userLogin
|
userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { getMyUserInformation, killallServers, ServerInfo, testImage, updateMyAvatar, uploadVideo } from '../../utils/index'
|
import { getMyUserInformation, killallServers, ServerInfo, testImage, updateMyAvatar, uploadVideo } from '../../../../shared/utils/index'
|
||||||
import { checkActorFilesWereRemoved, getAccount, getAccountsList } from '../../utils/users/accounts'
|
import { checkActorFilesWereRemoved, getAccount, getAccountsList } from '../../../../shared/utils/users/accounts'
|
||||||
import { setAccessTokensToServers } from '../../utils/users/login'
|
import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
|
||||||
import { User } from '../../../../shared/models/users'
|
import { User } from '../../../../shared/models/users'
|
||||||
import { VideoChannel } from '../../../../shared/models/videos'
|
import { VideoChannel } from '../../../../shared/models/videos'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@ import 'mocha'
|
||||||
import {
|
import {
|
||||||
registerUser, flushTests, getUserInformation, getMyUserInformation, killallServers,
|
registerUser, flushTests, getUserInformation, getMyUserInformation, killallServers,
|
||||||
userLogin, login, runServer, ServerInfo, verifyEmail, updateCustomSubConfig
|
userLogin, login, runServer, ServerInfo, verifyEmail, updateCustomSubConfig
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { setAccessTokensToServers } from '../../utils/users/login'
|
import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
|
||||||
import { mockSmtpServer } from '../../utils/miscs/email'
|
import { mockSmtpServer } from '../../../../shared/utils/miscs/email'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,10 @@ import {
|
||||||
updateUser,
|
updateUser,
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
userLogin
|
userLogin
|
||||||
} from '../../utils/index'
|
} from '../../../../shared/utils/index'
|
||||||
import { follow } from '../../utils/server/follows'
|
import { follow } from '../../../../shared/utils/server/follows'
|
||||||
import { setAccessTokensToServers } from '../../utils/users/login'
|
import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
|
||||||
import { getMyVideos } from '../../utils/videos/videos'
|
import { getMyVideos } from '../../../../shared/utils/videos/videos'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -31,15 +31,15 @@ import {
|
||||||
viewVideo,
|
viewVideo,
|
||||||
wait,
|
wait,
|
||||||
webtorrentAdd
|
webtorrentAdd
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import {
|
import {
|
||||||
addVideoCommentReply,
|
addVideoCommentReply,
|
||||||
addVideoCommentThread,
|
addVideoCommentThread,
|
||||||
deleteVideoComment,
|
deleteVideoComment,
|
||||||
getVideoCommentThreads,
|
getVideoCommentThreads,
|
||||||
getVideoThreadComments
|
getVideoThreadComments
|
||||||
} from '../../utils/videos/video-comments'
|
} from '../../../../shared/utils/videos/video-comments'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,16 @@
|
||||||
|
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import { flushTests, getOEmbed, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils/index'
|
import {
|
||||||
import { runServer } from '../../utils/server/servers'
|
flushTests,
|
||||||
|
getOEmbed,
|
||||||
|
getVideosList,
|
||||||
|
killallServers,
|
||||||
|
ServerInfo,
|
||||||
|
setAccessTokensToServers,
|
||||||
|
uploadVideo
|
||||||
|
} from '../../../../shared/utils/index'
|
||||||
|
import { runServer } from '../../../../shared/utils/server/servers'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import {
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
viewVideo,
|
viewVideo,
|
||||||
wait
|
wait
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ import {
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
updateVideoAbuse,
|
updateVideoAbuse,
|
||||||
uploadVideo
|
uploadVideo
|
||||||
} from '../../utils/index'
|
} from '../../../../shared/utils/index'
|
||||||
import { doubleFollow } from '../../utils/server/follows'
|
import { doubleFollow } from '../../../../shared/utils/server/follows'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,9 @@ import {
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
updateVideoBlacklist,
|
updateVideoBlacklist,
|
||||||
uploadVideo
|
uploadVideo
|
||||||
} from '../../utils/index'
|
} from '../../../../shared/utils/index'
|
||||||
import { doubleFollow } from '../../utils/server/follows'
|
import { doubleFollow } from '../../../../shared/utils/server/follows'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
import { VideoAbuse } from '../../../../shared/models/videos'
|
import { VideoAbuse } from '../../../../shared/models/videos'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -11,9 +11,9 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo
|
uploadVideo
|
||||||
} from '../../utils/index'
|
} from '../../../../shared/utils/index'
|
||||||
import { doubleFollow } from '../../utils/server/follows'
|
import { doubleFollow } from '../../../../shared/utils/server/follows'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,17 @@
|
||||||
|
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import { checkVideoFilesWereRemoved, doubleFollow, flushAndRunMultipleServers, removeVideo, uploadVideo, wait } from '../../utils'
|
import {
|
||||||
import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from '../../utils/index'
|
checkVideoFilesWereRemoved,
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
doubleFollow,
|
||||||
import { createVideoCaption, deleteVideoCaption, listVideoCaptions, testCaptionFile } from '../../utils/videos/video-captions'
|
flushAndRunMultipleServers,
|
||||||
|
removeVideo,
|
||||||
|
uploadVideo,
|
||||||
|
wait
|
||||||
|
} from '../../../../shared/utils'
|
||||||
|
import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from '../../../../shared/utils/index'
|
||||||
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
import { createVideoCaption, deleteVideoCaption, listVideoCaptions, testCaptionFile } from '../../../../shared/utils/videos/video-captions'
|
||||||
import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model'
|
import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -18,8 +18,8 @@ import {
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
userLogin,
|
userLogin,
|
||||||
getVideo
|
getVideo
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
import { User } from '../../../../shared/models/users'
|
import { User } from '../../../../shared/models/users'
|
||||||
import { VideoDetails } from '../../../../shared/models/videos'
|
import { VideoDetails } from '../../../../shared/models/videos'
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
updateVideoChannelAvatar,
|
updateVideoChannelAvatar,
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
userLogin
|
userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import {
|
import {
|
||||||
addVideoChannel,
|
addVideoChannel,
|
||||||
deleteVideoChannel,
|
deleteVideoChannel,
|
||||||
|
@ -26,8 +26,8 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
updateVideoChannel
|
updateVideoChannel
|
||||||
} from '../../utils/index'
|
} from '../../../../shared/utils/index'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
|
import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
|
||||||
import { testImage } from '../../utils'
|
import { testImage } from '../../../../shared/utils'
|
||||||
import {
|
import {
|
||||||
dateIsValid,
|
dateIsValid,
|
||||||
flushTests,
|
flushTests,
|
||||||
|
@ -13,14 +13,14 @@ import {
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
updateMyAvatar,
|
updateMyAvatar,
|
||||||
uploadVideo
|
uploadVideo
|
||||||
} from '../../utils/index'
|
} from '../../../../shared/utils/index'
|
||||||
import {
|
import {
|
||||||
addVideoCommentReply,
|
addVideoCommentReply,
|
||||||
addVideoCommentThread,
|
addVideoCommentThread,
|
||||||
deleteVideoComment,
|
deleteVideoComment,
|
||||||
getVideoCommentThreads,
|
getVideoCommentThreads,
|
||||||
getVideoThreadComments
|
getVideoThreadComments
|
||||||
} from '../../utils/videos/video-comments'
|
} from '../../../../shared/utils/videos/video-comments'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,9 @@ import {
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
updateVideo,
|
updateVideo,
|
||||||
uploadVideo
|
uploadVideo
|
||||||
} from '../../utils/index'
|
} from '../../../../shared/utils/index'
|
||||||
import { doubleFollow } from '../../utils/server/follows'
|
import { doubleFollow } from '../../../../shared/utils/server/follows'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ import {
|
||||||
killallServers,
|
killallServers,
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers
|
setAccessTokensToServers
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
import { getMagnetURI, getYoutubeVideoUrl, importVideo, getMyVideoImports } from '../../utils/videos/video-imports'
|
import { getMagnetURI, getYoutubeVideoUrl, importVideo, getMyVideoImports } from '../../../../shared/utils/videos/video-imports'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,17 @@
|
||||||
|
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import { flushTests, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils/index'
|
import {
|
||||||
import { userLogin } from '../../utils/users/login'
|
flushTests,
|
||||||
import { createUser } from '../../utils/users/users'
|
getVideosList,
|
||||||
import { getMyVideos } from '../../utils/videos/videos'
|
killallServers,
|
||||||
|
ServerInfo,
|
||||||
|
setAccessTokensToServers,
|
||||||
|
uploadVideo
|
||||||
|
} from '../../../../shared/utils/index'
|
||||||
|
import { userLogin } from '../../../../shared/utils/users/login'
|
||||||
|
import { createUser } from '../../../../shared/utils/users/users'
|
||||||
|
import { getMyVideos } from '../../../../shared/utils/videos/videos'
|
||||||
import {
|
import {
|
||||||
getAccountVideos,
|
getAccountVideos,
|
||||||
getConfig,
|
getConfig,
|
||||||
|
@ -18,7 +25,7 @@ import {
|
||||||
searchVideoWithToken,
|
searchVideoWithToken,
|
||||||
updateCustomConfig,
|
updateCustomConfig,
|
||||||
updateMyUser
|
updateMyUser
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { ServerConfig } from '../../../../shared/models'
|
import { ServerConfig } from '../../../../shared/models'
|
||||||
import { CustomConfig } from '../../../../shared/models/server/custom-config.model'
|
import { CustomConfig } from '../../../../shared/models/server/custom-config.model'
|
||||||
import { User } from '../../../../shared/models/users'
|
import { User } from '../../../../shared/models/users'
|
||||||
|
|
|
@ -10,12 +10,12 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo
|
uploadVideo
|
||||||
} from '../../utils/index'
|
} from '../../../../shared/utils/index'
|
||||||
import { doubleFollow } from '../../utils/server/follows'
|
import { doubleFollow } from '../../../../shared/utils/server/follows'
|
||||||
import { userLogin } from '../../utils/users/login'
|
import { userLogin } from '../../../../shared/utils/users/login'
|
||||||
import { createUser } from '../../utils/users/users'
|
import { createUser } from '../../../../shared/utils/users/users'
|
||||||
import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../../utils/videos/videos'
|
import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../../../../shared/utils/videos/videos'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ import {
|
||||||
updateVideo,
|
updateVideo,
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
wait
|
wait
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,10 @@ import {
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
webtorrentAdd
|
webtorrentAdd
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { waitJobs } from '../../utils/server/jobs'
|
import { waitJobs } from '../../../../shared/utils/server/jobs'
|
||||||
|
import { pathExists } from 'fs-extra'
|
||||||
import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants'
|
import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo,
|
uploadVideo,
|
||||||
userLogin
|
userLogin
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { Video, VideoPrivacy } from '../../../../shared/models/videos'
|
import { Video, VideoPrivacy } from '../../../../shared/models/videos'
|
||||||
import { UserRole } from '../../../../shared/models/users'
|
import { UserRole } from '../../../../shared/models/users'
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo
|
uploadVideo
|
||||||
} from '../../utils'
|
} from '../../../../shared/utils'
|
||||||
import { Video, VideoDetails } from '../../../../shared/models/videos'
|
import { Video, VideoDetails } from '../../../../shared/models/videos'
|
||||||
import { userWatchVideo } from '../../utils/videos/video-history'
|
import { userWatchVideo } from '../../../../shared/utils/videos/video-history'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import { flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils'
|
import { flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/utils'
|
||||||
import { getVideosOverview } from '../../utils/overviews/overviews'
|
import { getVideosOverview } from '../../../../shared/utils/overviews/overviews'
|
||||||
import { VideosOverview } from '../../../../shared/models/overviews'
|
import { VideosOverview } from '../../../../shared/models/overviews'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -15,8 +15,8 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo
|
uploadVideo
|
||||||
} from '../utils'
|
} from '../../../shared/utils'
|
||||||
import { waitJobs } from '../utils/server/jobs'
|
import { waitJobs } from '../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo, wait
|
uploadVideo, wait
|
||||||
} from '../utils'
|
} from '../../../shared/utils'
|
||||||
import { waitJobs } from '../utils/server/jobs'
|
import { waitJobs } from '../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo, viewVideo, wait
|
uploadVideo, viewVideo, wait
|
||||||
} from '../utils'
|
} from '../../../shared/utils'
|
||||||
import { waitJobs } from '../utils/server/jobs'
|
import { waitJobs } from '../../../shared/utils/server/jobs'
|
||||||
import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../helpers/ffmpeg-utils'
|
import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../helpers/ffmpeg-utils'
|
||||||
import { VIDEO_TRANSCODING_FPS } from '../../initializers'
|
import { VIDEO_TRANSCODING_FPS } from '../../initializers'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
runServer,
|
runServer,
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers
|
setAccessTokensToServers
|
||||||
} from '../utils'
|
} from '../../../shared/utils'
|
||||||
|
|
||||||
describe('Test CLI wrapper', function () {
|
describe('Test CLI wrapper', function () {
|
||||||
let server: ServerInfo
|
let server: ServerInfo
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
runServer,
|
runServer,
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers
|
setAccessTokensToServers
|
||||||
} from '../utils'
|
} from '../../../shared/utils'
|
||||||
|
|
||||||
describe('Test reset password scripts', function () {
|
describe('Test reset password scripts', function () {
|
||||||
let server: ServerInfo
|
let server: ServerInfo
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
import 'mocha'
|
import 'mocha'
|
||||||
import * as chai from 'chai'
|
import * as chai from 'chai'
|
||||||
import { VideoDetails } from '../../../shared/models/videos'
|
import { VideoDetails } from '../../../shared/models/videos'
|
||||||
import { waitJobs } from '../utils/server/jobs'
|
import { waitJobs } from '../../../shared/utils/server/jobs'
|
||||||
import { addVideoCommentThread } from '../utils/videos/video-comments'
|
import { addVideoCommentThread } from '../../../shared/utils/videos/video-comments'
|
||||||
import {
|
import {
|
||||||
addVideoChannel,
|
addVideoChannel,
|
||||||
createUser,
|
createUser,
|
||||||
|
@ -21,8 +21,8 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo
|
uploadVideo
|
||||||
} from '../utils'
|
} from '../../../shared/utils'
|
||||||
import { getAccountsList } from '../utils/users/accounts'
|
import { getAccountsList } from '../../../shared/utils/users/accounts'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
updateCustomConfig,
|
updateCustomConfig,
|
||||||
updateCustomSubConfig,
|
updateCustomSubConfig,
|
||||||
uploadVideo
|
uploadVideo
|
||||||
} from './utils'
|
} from '../../shared/utils'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo, userLogin
|
uploadVideo, userLogin
|
||||||
} from '../utils'
|
} from '../../../shared/utils'
|
||||||
import * as libxmljs from 'libxmljs'
|
import * as libxmljs from 'libxmljs'
|
||||||
import { addVideoCommentThread } from '../utils/videos/video-comments'
|
import { addVideoCommentThread } from '../../../shared/utils/videos/video-comments'
|
||||||
import { waitJobs } from '../utils/server/jobs'
|
import { waitJobs } from '../../../shared/utils/server/jobs'
|
||||||
import { User } from '../../../shared/models/users'
|
import { User } from '../../../shared/models/users'
|
||||||
|
|
||||||
chai.use(require('chai-xml'))
|
chai.use(require('chai-xml'))
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo
|
uploadVideo
|
||||||
} from './utils'
|
} from '../../shared/utils'
|
||||||
import { VideoPrivacy } from '../../shared/models/videos'
|
import { VideoPrivacy } from '../../shared/models/videos'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
uploadVideo
|
uploadVideo
|
||||||
} from '../utils'
|
} from '../../../shared/utils'
|
||||||
import * as Bluebird from 'bluebird'
|
import * as Bluebird from 'bluebird'
|
||||||
|
|
||||||
start()
|
start()
|
||||||
|
|
|
@ -16,8 +16,8 @@ import {
|
||||||
updateVideo,
|
updateVideo,
|
||||||
uploadVideo, viewVideo,
|
uploadVideo, viewVideo,
|
||||||
wait
|
wait
|
||||||
} from '../utils'
|
} from '../../../shared/utils'
|
||||||
import { getJobsListPaginationAndSort } from '../utils/server/jobs'
|
import { getJobsListPaginationAndSort } from '../../../shared/utils/server/jobs'
|
||||||
|
|
||||||
interface ServerInfo extends DefaultServerInfo {
|
interface ServerInfo extends DefaultServerInfo {
|
||||||
requestsNumber: number
|
requestsNumber: number
|
||||||
|
|
|
@ -6,7 +6,7 @@ import {
|
||||||
Server,
|
Server,
|
||||||
Client,
|
Client,
|
||||||
User
|
User
|
||||||
} from '../tests/utils/index'
|
} from '../../shared/utils'
|
||||||
|
|
||||||
program
|
program
|
||||||
.option('-u, --url <url>', 'Server url')
|
.option('-u, --url <url>', 'Server url')
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { join } from 'path'
|
||||||
import { VideoPrivacy } from '../../shared/models/videos'
|
import { VideoPrivacy } from '../../shared/models/videos'
|
||||||
import { doRequestAndSaveToFile } from '../helpers/requests'
|
import { doRequestAndSaveToFile } from '../helpers/requests'
|
||||||
import { CONSTRAINTS_FIELDS } from '../initializers'
|
import { CONSTRAINTS_FIELDS } from '../initializers'
|
||||||
import { getClient, getVideoCategories, login, searchVideoWithSort, uploadVideo } from '../tests/utils'
|
import { getClient, getVideoCategories, login, searchVideoWithSort, uploadVideo } from '../../shared/utils/index'
|
||||||
import { truncate } from 'lodash'
|
import { truncate } from 'lodash'
|
||||||
import * as prompt from 'prompt'
|
import * as prompt from 'prompt'
|
||||||
import { remove } from 'fs-extra'
|
import { remove } from 'fs-extra'
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import * as program from 'commander'
|
import * as program from 'commander'
|
||||||
import { access, constants } from 'fs-extra'
|
import { access, constants } from 'fs-extra'
|
||||||
import { isAbsolute } from 'path'
|
import { isAbsolute } from 'path'
|
||||||
import { getClient, login } from '../tests/utils'
|
import { getClient, login } from '../../shared/utils'
|
||||||
import { uploadVideo } from '../tests/utils/index'
|
import { uploadVideo } from '../../shared/utils/'
|
||||||
import { VideoPrivacy } from '../../shared/models/videos'
|
import { VideoPrivacy } from '../../shared/models/videos'
|
||||||
import { netrc, getSettings } from './cli'
|
import { netrc, getSettings } from './cli'
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,15 @@ export * from './server/activitypub'
|
||||||
export * from './cli/cli'
|
export * from './cli/cli'
|
||||||
export * from './server/clients'
|
export * from './server/clients'
|
||||||
export * from './server/config'
|
export * from './server/config'
|
||||||
|
export * from './server/jobs'
|
||||||
export * from './users/login'
|
export * from './users/login'
|
||||||
export * from './miscs/miscs'
|
export * from './miscs/miscs'
|
||||||
export * from './miscs/stubs'
|
export * from './miscs/stubs'
|
||||||
|
export * from './miscs/sql'
|
||||||
export * from './server/follows'
|
export * from './server/follows'
|
||||||
|
export * from './requests/activitypub'
|
||||||
export * from './requests/requests'
|
export * from './requests/requests'
|
||||||
|
export * from './requests/check-api-params'
|
||||||
export * from './server/servers'
|
export * from './server/servers'
|
||||||
export * from './videos/services'
|
export * from './videos/services'
|
||||||
export * from './users/users'
|
export * from './users/users'
|
|
@ -33,8 +33,8 @@ function webtorrentAdd (torrent: string, refreshWebTorrent = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function root () {
|
function root () {
|
||||||
// We are in server/tests/utils/miscs
|
// We are in /shared/utils/miscs
|
||||||
return join(__dirname, '..', '..', '..', '..')
|
return join(__dirname, '..', '..', '..')
|
||||||
}
|
}
|
||||||
|
|
||||||
async function testImage (url: string, imageName: string, imagePath: string, extension = '.jpg') {
|
async function testImage (url: string, imageName: string, imagePath: string, extension = '.jpg') {
|
||||||
|
@ -44,7 +44,7 @@ async function testImage (url: string, imageName: string, imagePath: string, ext
|
||||||
|
|
||||||
const body = res.body
|
const body = res.body
|
||||||
|
|
||||||
const data = await readFile(join(__dirname, '..', '..', 'fixtures', imageName + extension))
|
const data = await readFile(join(root(), 'server', 'tests', 'fixtures', imageName + extension))
|
||||||
const minLength = body.length - ((20 * body.length) / 100)
|
const minLength = body.length - ((20 * body.length) / 100)
|
||||||
const maxLength = body.length + ((20 * body.length) / 100)
|
const maxLength = body.length + ((20 * body.length) / 100)
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ function buildAbsoluteFixturePath (path: string, customTravisPath = false) {
|
||||||
|
|
||||||
if (customTravisPath && process.env.TRAVIS) return join(process.env.HOME, 'fixtures', path)
|
if (customTravisPath && process.env.TRAVIS) return join(process.env.HOME, 'fixtures', path)
|
||||||
|
|
||||||
return join(__dirname, '..', '..', 'fixtures', path)
|
return join(root(), 'server', 'tests', 'fixtures', path)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateHighBitrateVideo () {
|
async function generateHighBitrateVideo () {
|
|
@ -1,7 +1,7 @@
|
||||||
import { doRequest } from '../../../helpers/requests'
|
import { doRequest } from '../../../server/helpers/requests'
|
||||||
import { HTTP_SIGNATURE } from '../../../initializers'
|
import { HTTP_SIGNATURE } from '../../../server/initializers'
|
||||||
import { buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activitypub-http-utils'
|
import { buildGlobalHeaders } from '../../../server/lib/job-queue/handlers/utils/activitypub-http-utils'
|
||||||
import { activityPubContextify } from '../../../helpers/activitypub'
|
import { activityPubContextify } from '../../../server/helpers/activitypub'
|
||||||
|
|
||||||
function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) {
|
function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) {
|
||||||
const options = {
|
const options = {
|
|
@ -1,5 +1,5 @@
|
||||||
import * as request from 'supertest'
|
import * as request from 'supertest'
|
||||||
import { buildAbsoluteFixturePath } from '../miscs/miscs'
|
import { buildAbsoluteFixturePath, root } from '../miscs/miscs'
|
||||||
import { isAbsolute, join } from 'path'
|
import { isAbsolute, join } from 'path'
|
||||||
|
|
||||||
function makeGetRequest (options: {
|
function makeGetRequest (options: {
|
||||||
|
@ -142,7 +142,7 @@ function updateAvatarRequest (options: {
|
||||||
if (isAbsolute(options.fixture)) {
|
if (isAbsolute(options.fixture)) {
|
||||||
filePath = options.fixture
|
filePath = options.fixture
|
||||||
} else {
|
} else {
|
||||||
filePath = join(__dirname, '..', '..', 'fixtures', options.fixture)
|
filePath = join(root(), 'server', 'tests', 'fixtures', options.fixture)
|
||||||
}
|
}
|
||||||
|
|
||||||
return makeUploadRequest({
|
return makeUploadRequest({
|
|
@ -1,7 +1,7 @@
|
||||||
/* tslint:disable:no-unused-expression */
|
/* tslint:disable:no-unused-expression */
|
||||||
|
|
||||||
import * as request from 'supertest'
|
import * as request from 'supertest'
|
||||||
import { VideosSearchQuery } from '../../../../shared/models/search'
|
import { VideosSearchQuery } from '../../models/search'
|
||||||
import { immutableAssign } from '../miscs/miscs'
|
import { immutableAssign } from '../miscs/miscs'
|
||||||
|
|
||||||
function searchVideo (url: string, search: string) {
|
function searchVideo (url: string, search: string) {
|
|
@ -1,5 +1,5 @@
|
||||||
import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests'
|
import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests'
|
||||||
import { CustomConfig } from '../../../../shared/models/server/custom-config.model'
|
import { CustomConfig } from '../../models/server/custom-config.model'
|
||||||
|
|
||||||
function getConfig (url: string) {
|
function getConfig (url: string) {
|
||||||
const path = '/api/v1/config'
|
const path = '/api/v1/config'
|
|
@ -1,7 +1,7 @@
|
||||||
import * as request from 'supertest'
|
import * as request from 'supertest'
|
||||||
import { Job, JobState } from '../../../../shared/models'
|
import { Job, JobState } from '../../models'
|
||||||
import { ServerInfo } from './servers'
|
|
||||||
import { wait } from '../miscs/miscs'
|
import { wait } from '../miscs/miscs'
|
||||||
|
import { ServerInfo } from './servers'
|
||||||
|
|
||||||
function getJobsList (url: string, accessToken: string, state: JobState) {
|
function getJobsList (url: string, accessToken: string, state: JobState) {
|
||||||
const path = '/api/v1/jobs/' + state
|
const path = '/api/v1/jobs/' + state
|
|
@ -115,7 +115,7 @@ function runServer (serverNumber: number, configOverride?: Object, args = []) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise<ServerInfo>(res => {
|
return new Promise<ServerInfo>(res => {
|
||||||
server.app = fork(join(__dirname, '..', '..', '..', '..', 'dist', 'server.js'), args, options)
|
server.app = fork(join(root(), 'dist', 'server.js'), args, options)
|
||||||
server.app.stdout.on('data', function onStdout (data) {
|
server.app.stdout.on('data', function onStdout (data) {
|
||||||
let dontContinue = false
|
let dontContinue = false
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import { existsSync, readdir } from 'fs-extra'
|
import { existsSync, readdir } from 'fs-extra'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { Account } from '../../../../shared/models/actors'
|
import { Account } from '../../models/actors'
|
||||||
import { root } from '../miscs/miscs'
|
import { root } from '../miscs/miscs'
|
||||||
import { makeGetRequest } from '../requests/requests'
|
import { makeGetRequest } from '../requests/requests'
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue