ActivityPub-federated video streaming platform using P2P directly in your web browser
Tests directories refractor
Chocobozzzc5d31dba56d6
diff --git a/server/tests/activitypub.ts b/server/tests/activitypub.tsindex 333e02e846..94615c63f0 100644--- a/server/tests/activitypub.ts+++ b/server/tests/activitypub.ts@@ -2,9 +2,7 @@import * as chai from 'chai'import 'mocha'-import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from './utils'-import { runServer } from './utils/servers'-import { makeActivityPubGetRequest } from './utils/activitypub'+import { flushTests, killallServers, makeActivityPubGetRequest, runServer, ServerInfo, setAccessTokensToServers } from './utils'const expect = chai.expectdiff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.tsindex 780254df5c..f82520574e 100644--- a/server/tests/api/check-params/services.ts+++ b/server/tests/api/check-params/services.ts@@ -9,7 +9,7 @@ import {setAccessTokensToServers,killallServers} from '../../utils'-import { getVideosList, uploadVideo } from '../../utils/videos'+import { getVideosList, uploadVideo } from '../../utils/videos/videos'describe('Test services API validators', function () {let serverdiff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.tsindex e8d7ddf382..f3832bd2cb 100644--- a/server/tests/api/check-params/video-comments.ts+++ b/server/tests/api/check-params/video-comments.ts@@ -3,7 +3,7 @@import 'mocha'import * as request from 'supertest'import { flushTests, killallServers, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils'-import { addVideoCommentThread } from '../../utils/video-comments'+import { addVideoCommentThread } from '../../utils/videos/video-comments'describe('Test video comments API validator', function () {let pathThread: stringdiff --git a/server/tests/api/index-fast.ts b/server/tests/api/index-fast.tsindex 35b4143837..e591d0fd24 100644--- a/server/tests/api/index-fast.ts+++ b/server/tests/api/index-fast.ts@@ -1,11 +1,11 @@// Order of the tests we want to execute-import './config'+import './server/config'import './check-params'-import './users'-import './single-server'-import './video-abuse'-import './video-blacklist'-import './video-blacklist-management'-import './video-description'-import './video-privacy'-import './services'+import './users/users'+import './videos/single-server'+import './videos/video-abuse'+import './videos/video-blacklist'+import './videos/video-blacklist-management'+import './videos/video-description'+import './videos/video-privacy'+import './videos/services'diff --git a/server/tests/api/index-slow.ts b/server/tests/api/index-slow.tsindex b525d6f012..23b6526c7d 100644--- a/server/tests/api/index-slow.ts+++ b/server/tests/api/index-slow.ts@@ -1,7 +1,7 @@// Order of the tests we want to execute// import './multiple-servers'-import './video-transcoder'-import './multiple-servers'-import './follows'-import './jobs'-import './video-comments'+import './videos/video-transcoder'+import './videos/multiple-servers'+import './server/follows'+import './server/jobs'+import './videos/video-comments'diff --git a/server/tests/api/config.ts b/server/tests/api/server/config.tssimilarity index 97%rename from server/tests/api/config.tsrename to server/tests/api/server/config.tsindex 61ae579777..e8846c8db7 100644--- a/server/tests/api/config.ts+++ b/server/tests/api/server/config.ts@@ -9,7 +9,7 @@ import {flushTests,runServer,registerUser-} from '../utils'+} from '../../utils/index'describe('Test config', function () {let server = nulldiff --git a/server/tests/api/follows.ts b/server/tests/api/server/follows.tssimilarity index 94%rename from server/tests/api/follows.tsrename to server/tests/api/server/follows.tsindex 2ffa426a06..f77c0c67c1 100644--- a/server/tests/api/follows.ts+++ b/server/tests/api/server/follows.ts@@ -2,18 +2,21 @@import * as chai from 'chai'import 'mocha'-import { VideoComment, VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model'+import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'import {flushAndRunMultipleServers, flushTests, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo,wait-} from '../utils'-import { follow, getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, unfollow } from '../utils/follows'-import { getUserAccessToken } from '../utils/login'-import { dateIsValid, webtorrentAdd } from '../utils/miscs'-import { createUser } from '../utils/users'-import { addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, getVideoThreadComments } from '../utils/video-comments'-import { getVideo, rateVideo, testVideoImage } from '../utils/videos'+} from '../../utils/index'+import { dateIsValid, webtorrentAdd } from '../../utils/miscs/miscs'+import { follow, getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, unfollow } from '../../utils/server/follows'+import { getUserAccessToken } from '../../utils/users/login'+import { createUser } from '../../utils/users/users'+import {+ addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads,+ getVideoThreadComments+} from '../../utils/videos/video-comments'+import { getVideo, rateVideo, testVideoImage } from '../../utils/videos/videos'const expect = chai.expectdiff --git a/server/tests/api/jobs.ts b/server/tests/api/server/jobs.tssimilarity index 82%rename from server/tests/api/jobs.tsrename to server/tests/api/server/jobs.tsindex 4d9b613925..2e17e71a42 100644--- a/server/tests/api/jobs.ts+++ b/server/tests/api/server/jobs.ts@@ -2,12 +2,12 @@import * as chai from 'chai'import 'mocha'-import { flushTests, killallServers, ServerInfo, setAccessTokensToServers, wait } from '../utils'-import { doubleFollow } from '../utils/follows'-import { getJobsList, getJobsListPaginationAndSort } from '../utils/jobs'-import { flushAndRunMultipleServers } from '../utils/servers'-import { uploadVideo } from '../utils/videos'-import { dateIsValid } from '../utils/miscs'+import { flushTests, killallServers, ServerInfo, setAccessTokensToServers, wait } from '../../utils/index'+import { doubleFollow } from '../../utils/server/follows'+import { getJobsList, getJobsListPaginationAndSort } from '../../utils/server/jobs'+import { flushAndRunMultipleServers } from '../../utils/server/servers'+import { uploadVideo } from '../../utils/videos/videos'+import { dateIsValid } from '../../utils/miscs/miscs'const expect = chai.expectdiff --git a/server/tests/api/users.ts b/server/tests/api/users/users.tssimilarity index 98%rename from server/tests/api/users.tsrename to server/tests/api/users/users.tsindex 67e4cc8c6c..2e3a0b94fc 100644--- a/server/tests/api/users.ts+++ b/server/tests/api/users/users.ts@@ -2,7 +2,7 @@import * as chai from 'chai'import 'mocha'-import { UserRole } from '../../../shared'+import { UserRole } from '../../../../shared/index'import {createUser,flushTests,@@ -26,10 +26,10 @@ import {updateMyUser,updateUser,uploadVideo-} from '../utils'-import { follow } from '../utils/follows'-import { getMyVideos } from '../utils/videos'-import { setAccessTokensToServers } from '../utils/login'+} from '../../utils/index'+import { follow } from '../../utils/server/follows'+import { getMyVideos } from '../../utils/videos/videos'+import { setAccessTokensToServers } from '../../utils/users/login'const expect = chai.expectdiff --git a/server/tests/api/multiple-servers.ts b/server/tests/api/videos/multiple-servers.tssimilarity index 98%rename from server/tests/api/multiple-servers.tsrename to server/tests/api/videos/multiple-servers.tsindex 06274d4cc1..84f730a8e9 100644--- a/server/tests/api/multiple-servers.ts+++ b/server/tests/api/videos/multiple-servers.ts@@ -4,16 +4,19 @@ import * as chai from 'chai'import 'mocha'import { join } from 'path'import * as request from 'supertest'-import { VideoComment, VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model'+import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'import {addVideoChannel, dateIsValid, doubleFollow, flushAndRunMultipleServers, flushTests, getUserAccessToken, getVideo,getVideoChannelsList, getVideosList, killallServers, rateVideo, removeVideo, ServerInfo, setAccessTokensToServers, testVideoImage,updateVideo, uploadVideo, wait, webtorrentAdd-} from '../utils'-import { createUser } from '../utils/users'-import { addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, getVideoThreadComments } from '../utils/video-comments'-import { viewVideo } from '../utils/videos'+} from '../../utils/index'+import { createUser } from '../../utils/users/users'+import {+ addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads,+ getVideoThreadComments+} from '../../utils/videos/video-comments'+import { viewVideo } from '../../utils/videos/videos'const expect = chai.expectdiff --git a/server/tests/api/services.ts b/server/tests/api/videos/services.tssimilarity index 97%rename from server/tests/api/services.tsrename to server/tests/api/videos/services.tsindex 4d480c3054..1cda464d92 100644--- a/server/tests/api/services.ts+++ b/server/tests/api/videos/services.ts@@ -12,8 +12,8 @@ import {setAccessTokensToServers,killallServers,getOEmbed-} from '../utils'-import { runServer } from '../utils/servers'+} from '../../utils/index'+import { runServer } from '../../utils/server/servers'describe('Test services', function () {let server: ServerInfo = nulldiff --git a/server/tests/api/single-server.ts b/server/tests/api/videos/single-server.tssimilarity index 99%rename from server/tests/api/single-server.tsrename to server/tests/api/videos/single-server.tsindex 7f4351f5ee..02723654dc 100644--- a/server/tests/api/single-server.ts+++ b/server/tests/api/videos/single-server.ts@@ -30,8 +30,8 @@ import {uploadVideo,wait,webtorrentAdd-} from '../utils'-import { viewVideo } from '../utils/videos'+} from '../../utils/index'+import { viewVideo } from '../../utils/videos/videos'const expect = chai.expectdiff --git a/server/tests/api/video-abuse.ts b/server/tests/api/videos/video-abuse.tssimilarity index 98%rename from server/tests/api/video-abuse.tsrename to server/tests/api/videos/video-abuse.tsindex 4a0b6b5041..3fcf5d8c79 100644--- a/server/tests/api/video-abuse.ts+++ b/server/tests/api/videos/video-abuse.ts@@ -13,8 +13,8 @@ import {setAccessTokensToServers,uploadVideo,wait-} from '../utils'-import { doubleFollow } from '../utils/follows'+} from '../../utils/index'+import { doubleFollow } from '../../utils/server/follows'const expect = chai.expectdiff --git a/server/tests/api/video-blacklist-management.ts b/server/tests/api/videos/video-blacklist-management.tssimilarity index 98%rename from server/tests/api/video-blacklist-management.tsrename to server/tests/api/videos/video-blacklist-management.tsindex 0c636e094e..db79784c27 100644--- a/server/tests/api/video-blacklist-management.ts+++ b/server/tests/api/videos/video-blacklist-management.ts@@ -16,8 +16,8 @@ import {setAccessTokensToServers,uploadVideo,wait-} from '../utils'-import { doubleFollow } from '../utils/follows'+} from '../../utils/index'+import { doubleFollow } from '../../utils/server/follows'const expect = chai.expectconst orderBy = lodash.orderBydiff --git a/server/tests/api/video-blacklist.ts b/server/tests/api/videos/video-blacklist.tssimilarity index 96%rename from server/tests/api/video-blacklist.tsrename to server/tests/api/videos/video-blacklist.tsindex 3afd8c5103..d1cefa5d70 100644--- a/server/tests/api/video-blacklist.ts+++ b/server/tests/api/videos/video-blacklist.ts@@ -13,8 +13,8 @@ import {setAccessTokensToServers,uploadVideo,wait-} from '../utils'-import { doubleFollow } from '../utils/follows'+} from '../../utils/index'+import { doubleFollow } from '../../utils/server/follows'const expect = chai.expectdiff --git a/server/tests/api/video-channels.ts b/server/tests/api/videos/video-channels.tssimilarity index 98%rename from server/tests/api/video-channels.tsrename to server/tests/api/videos/video-channels.tsindex 2d8efb3202..454a96da69 100644--- a/server/tests/api/video-channels.ts+++ b/server/tests/api/videos/video-channels.ts@@ -17,8 +17,8 @@ import {updateVideoChannel,deleteVideoChannel,getVideoChannel-} from '../utils'-import { User } from '../../../shared'+} from '../../utils/index'+import { User } from '../../../../shared/index'describe('Test a video channels', function () {let server: ServerInfodiff --git a/server/tests/api/video-comments.ts b/server/tests/api/videos/video-comments.tssimilarity index 94%rename from server/tests/api/video-comments.tsrename to server/tests/api/videos/video-comments.tsindex f05ca5e817..3b6578f041 100644--- a/server/tests/api/video-comments.ts+++ b/server/tests/api/videos/video-comments.ts@@ -2,9 +2,12 @@import * as chai from 'chai'import 'mocha'-import { VideoComment, VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model'-import { dateIsValid, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../utils'-import { addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, getVideoThreadComments } from '../utils/video-comments'+import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'+import { dateIsValid, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils/index'+import {+ addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads,+ getVideoThreadComments+} from '../../utils/videos/video-comments'const expect = chai.expectdiff --git a/server/tests/api/video-description.ts b/server/tests/api/videos/video-description.tssimilarity index 97%rename from server/tests/api/video-description.tsrename to server/tests/api/videos/video-description.tsindex 7ad1c63ae8..c2985194c5 100644--- a/server/tests/api/video-description.ts+++ b/server/tests/api/videos/video-description.ts@@ -14,8 +14,8 @@ import {updateVideo,uploadVideo,wait-} from '../utils'-import { doubleFollow } from '../utils/follows'+} from '../../utils/index'+import { doubleFollow } from '../../utils/server/follows'const expect = chai.expectdiff --git a/server/tests/api/video-privacy.ts b/server/tests/api/videos/video-privacy.tssimilarity index 93%rename from server/tests/api/video-privacy.tsrename to server/tests/api/videos/video-privacy.tsindex 26847efce5..de709f8f17 100644--- a/server/tests/api/video-privacy.ts+++ b/server/tests/api/videos/video-privacy.ts@@ -2,7 +2,7 @@import * as chai from 'chai'import 'mocha'-import { VideoPrivacy } from '../../../shared/models/videos/video-privacy.enum'+import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum'import {flushAndRunMultipleServers,flushTests,@@ -12,11 +12,11 @@ import {setAccessTokensToServers,uploadVideo,wait-} from '../utils'-import { doubleFollow } from '../utils/follows'-import { getUserAccessToken } from '../utils/login'-import { createUser } from '../utils/users'-import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../utils/videos'+} from '../../utils/index'+import { doubleFollow } from '../../utils/server/follows'+import { getUserAccessToken } from '../../utils/users/login'+import { createUser } from '../../utils/users/users'+import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../../utils/videos/videos'const expect = chai.expectdiff --git a/server/tests/api/video-transcoder.ts b/server/tests/api/videos/video-transcoder.tssimilarity index 98%rename from server/tests/api/video-transcoder.tsrename to server/tests/api/videos/video-transcoder.tsindex 9a6e91b767..27927a5946 100644--- a/server/tests/api/video-transcoder.ts+++ b/server/tests/api/videos/video-transcoder.ts@@ -15,7 +15,7 @@ import {killallServers,webtorrentAdd,getVideo-} from '../utils'+} from '../../utils/index'describe('Test video transcoding', function () {let servers: ServerInfo[] = []diff --git a/server/tests/utils/cli.ts b/server/tests/utils/cli/cli.tssimilarity index 90%rename from server/tests/utils/cli.tsrename to server/tests/utils/cli/cli.tsindex 4098fdf6f7..54d05e9c62 100644--- a/server/tests/utils/cli.ts+++ b/server/tests/utils/cli/cli.ts@@ -1,6 +1,6 @@import { exec } from 'child_process'-import { ServerInfo } from './servers'+import { ServerInfo } from '../server/servers'function getEnvCli (server?: ServerInfo) {return `NODE_ENV=test NODE_APP_INSTANCE=${server.serverNumber}`diff --git a/server/tests/utils/index.ts b/server/tests/utils/index.tsindex b918ee83d2..d7789e5173 100644--- a/server/tests/utils/index.ts+++ b/server/tests/utils/index.ts@@ -1,15 +1,15 @@-export * from './activitypub'-export * from './cli'-export * from './clients'-export * from './config'-export * from './login'-export * from './miscs'-export * from './follows'-export * from './requests'-export * from './servers'-export * from './services'-export * from './users'-export * from './video-abuses'-export * from './video-blacklist'-export * from './video-channels'-export * from './videos'+export * from './server/activitypub'+export * from './cli/cli'+export * from './server/clients'+export * from './server/config'+export * from './users/login'+export * from './miscs/miscs'+export * from './server/follows'+export * from './requests/requests'+export * from './server/servers'+export * from './videos/services'+export * from './users/users'+export * from './videos/video-abuses'+export * from './videos/video-blacklist'+export * from './videos/video-channels'+export * from './videos/videos'diff --git a/server/tests/utils/miscs.ts b/server/tests/utils/miscs/miscs.tssimilarity index 100%rename from server/tests/utils/miscs.tsrename to server/tests/utils/miscs/miscs.tsdiff --git a/server/tests/utils/requests.ts b/server/tests/utils/requests/requests.tssimilarity index 100%rename from server/tests/utils/requests.tsrename to server/tests/utils/requests/requests.tsdiff --git a/server/tests/utils/activitypub.ts b/server/tests/utils/server/activitypub.tssimilarity index 100%rename from server/tests/utils/activitypub.tsrename to server/tests/utils/server/activitypub.tsdiff --git a/server/tests/utils/clients.ts b/server/tests/utils/server/clients.tssimilarity index 100%rename from server/tests/utils/clients.tsrename to server/tests/utils/server/clients.tsdiff --git a/server/tests/utils/config.ts b/server/tests/utils/server/config.tssimilarity index 100%rename from server/tests/utils/config.tsrename to server/tests/utils/server/config.tsdiff --git a/server/tests/utils/follows.ts b/server/tests/utils/server/follows.tssimilarity index 98%rename from server/tests/utils/follows.tsrename to server/tests/utils/server/follows.tsindex a9f798bcbb..82e89175cf 100644--- a/server/tests/utils/follows.ts+++ b/server/tests/utils/server/follows.ts@@ -1,5 +1,5 @@import * as request from 'supertest'-import { wait } from './miscs'+import { wait } from '../miscs/miscs'import { ServerInfo } from './servers'function getFollowersListPaginationAndSort (url: string, start: number, count: number, sort: string) {diff --git a/server/tests/utils/jobs.ts b/server/tests/utils/server/jobs.tssimilarity index 100%rename from server/tests/utils/jobs.tsrename to server/tests/utils/server/jobs.tsdiff --git a/server/tests/utils/servers.ts b/server/tests/utils/server/servers.tssimilarity index 100%rename from server/tests/utils/servers.tsrename to server/tests/utils/server/servers.tsdiff --git a/server/tests/utils/login.ts b/server/tests/utils/users/login.tssimilarity index 96%rename from server/tests/utils/login.tsrename to server/tests/utils/users/login.tsindex 22d37c46f4..855c4828d1 100644--- a/server/tests/utils/login.ts+++ b/server/tests/utils/users/login.ts@@ -1,6 +1,6 @@import * as request from 'supertest'-import { ServerInfo } from './servers'+import { ServerInfo } from '../server/servers'type Client = { id: string, secret: string }type User = { username: string, password: string }diff --git a/server/tests/utils/users.ts b/server/tests/utils/users/users.tssimilarity index 98%rename from server/tests/utils/users.tsrename to server/tests/utils/users/users.tsindex a37d84ab47..bd8d7ab04c 100644--- a/server/tests/utils/users.ts+++ b/server/tests/utils/users/users.ts@@ -1,6 +1,6 @@import * as request from 'supertest'-import { UserRole } from '../../../shared'+import { UserRole } from '../../../../shared/index'function createUser (url: string,diff --git a/server/tests/utils/services.ts b/server/tests/utils/videos/services.tssimilarity index 100%rename from server/tests/utils/services.tsrename to server/tests/utils/videos/services.tsdiff --git a/server/tests/utils/video-abuses.ts b/server/tests/utils/videos/video-abuses.tssimilarity index 100%rename from server/tests/utils/video-abuses.tsrename to server/tests/utils/videos/video-abuses.tsdiff --git a/server/tests/utils/video-blacklist.ts b/server/tests/utils/videos/video-blacklist.tssimilarity index 100%rename from server/tests/utils/video-blacklist.tsrename to server/tests/utils/videos/video-blacklist.tsdiff --git a/server/tests/utils/video-channels.ts b/server/tests/utils/videos/video-channels.tssimilarity index 100%rename from server/tests/utils/video-channels.tsrename to server/tests/utils/videos/video-channels.tsdiff --git a/server/tests/utils/video-comments.ts b/server/tests/utils/videos/video-comments.tssimilarity index 100%rename from server/tests/utils/video-comments.tsrename to server/tests/utils/videos/video-comments.tsdiff --git a/server/tests/utils/videos.ts b/server/tests/utils/videos/videos.tssimilarity index 97%rename from server/tests/utils/videos.tsrename to server/tests/utils/videos/videos.tsindex fb758cf29b..6de1b8c92c 100644--- a/server/tests/utils/videos.ts+++ b/server/tests/utils/videos/videos.ts@@ -1,13 +1,9 @@import { readFile } from 'fs'-import * as request from 'supertest'-import { join, isAbsolute } from 'path'import * as parseTorrent from 'parse-torrent'--import { makeGetRequest } from './requests'-import { readFilePromise } from './miscs'-import { ServerInfo } from './servers'-import { getMyUserInformation } from './users'-import { VideoPrivacy } from '../../../shared'+import { isAbsolute, join } from 'path'+import * as request from 'supertest'+import { getMyUserInformation, makeGetRequest, readFilePromise, ServerInfo } from '../'+import { VideoPrivacy } from '../../../../shared/models/videos'type VideoAttributes = {name?: string