]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Tests directories refractor
authorChocobozzz <me@florianbigard.com>
Thu, 28 Dec 2017 12:59:22 +0000 (13:59 +0100)
committerChocobozzz <me@florianbigard.com>
Thu, 28 Dec 2017 12:59:22 +0000 (13:59 +0100)
38 files changed:
server/tests/activitypub.ts
server/tests/api/check-params/services.ts
server/tests/api/check-params/video-comments.ts
server/tests/api/index-fast.ts
server/tests/api/index-slow.ts
server/tests/api/server/config.ts [moved from server/tests/api/config.ts with 97% similarity]
server/tests/api/server/follows.ts [moved from server/tests/api/follows.ts with 94% similarity]
server/tests/api/server/jobs.ts [moved from server/tests/api/jobs.ts with 82% similarity]
server/tests/api/users/users.ts [moved from server/tests/api/users.ts with 98% similarity]
server/tests/api/videos/multiple-servers.ts [moved from server/tests/api/multiple-servers.ts with 98% similarity]
server/tests/api/videos/services.ts [moved from server/tests/api/services.ts with 97% similarity]
server/tests/api/videos/single-server.ts [moved from server/tests/api/single-server.ts with 99% similarity]
server/tests/api/videos/video-abuse.ts [moved from server/tests/api/video-abuse.ts with 98% similarity]
server/tests/api/videos/video-blacklist-management.ts [moved from server/tests/api/video-blacklist-management.ts with 98% similarity]
server/tests/api/videos/video-blacklist.ts [moved from server/tests/api/video-blacklist.ts with 96% similarity]
server/tests/api/videos/video-channels.ts [moved from server/tests/api/video-channels.ts with 98% similarity]
server/tests/api/videos/video-comments.ts [moved from server/tests/api/video-comments.ts with 94% similarity]
server/tests/api/videos/video-description.ts [moved from server/tests/api/video-description.ts with 97% similarity]
server/tests/api/videos/video-privacy.ts [moved from server/tests/api/video-privacy.ts with 93% similarity]
server/tests/api/videos/video-transcoder.ts [moved from server/tests/api/video-transcoder.ts with 98% similarity]
server/tests/utils/cli/cli.ts [moved from server/tests/utils/cli.ts with 90% similarity]
server/tests/utils/index.ts
server/tests/utils/miscs/miscs.ts [moved from server/tests/utils/miscs.ts with 100% similarity]
server/tests/utils/requests/requests.ts [moved from server/tests/utils/requests.ts with 100% similarity]
server/tests/utils/server/activitypub.ts [moved from server/tests/utils/activitypub.ts with 100% similarity]
server/tests/utils/server/clients.ts [moved from server/tests/utils/clients.ts with 100% similarity]
server/tests/utils/server/config.ts [moved from server/tests/utils/config.ts with 100% similarity]
server/tests/utils/server/follows.ts [moved from server/tests/utils/follows.ts with 98% similarity]
server/tests/utils/server/jobs.ts [moved from server/tests/utils/jobs.ts with 100% similarity]
server/tests/utils/server/servers.ts [moved from server/tests/utils/servers.ts with 100% similarity]
server/tests/utils/users/login.ts [moved from server/tests/utils/login.ts with 96% similarity]
server/tests/utils/users/users.ts [moved from server/tests/utils/users.ts with 98% similarity]
server/tests/utils/videos/services.ts [moved from server/tests/utils/services.ts with 100% similarity]
server/tests/utils/videos/video-abuses.ts [moved from server/tests/utils/video-abuses.ts with 100% similarity]
server/tests/utils/videos/video-blacklist.ts [moved from server/tests/utils/video-blacklist.ts with 100% similarity]
server/tests/utils/videos/video-channels.ts [moved from server/tests/utils/video-channels.ts with 100% similarity]
server/tests/utils/videos/video-comments.ts [moved from server/tests/utils/video-comments.ts with 100% similarity]
server/tests/utils/videos/videos.ts [moved from server/tests/utils/videos.ts with 97% similarity]

index 333e02e8468d9cfa1c060f6f0282f57033256e74..94615c63f0895784f5e57e7e878bc1f0438978e1 100644 (file)
@@ -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.expect
 
index 780254df5ccc1f4d41b2f2849ca52da660f990a9..f82520574e588f9448c16ded2887cdf32712dcb1 100644 (file)
@@ -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 server
index e8d7ddf382362df6a384b1acd72fb4230c851f9d..f3832bd2cb4ece197903d4a80eb8623d062ea60c 100644 (file)
@@ -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: string
index 35b414383739c5c435c8cd1b9e7303542fd2e7d3..e591d0fd24081d9003e7bd2984c7f1a64a3fa678 100644 (file)
@@ -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'
index b525d6f01277878ef8285075761ef3a61ac58e63..23b6526c7de43fa130e11542161123b47a3b2f12 100644 (file)
@@ -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'
similarity index 97%
rename from server/tests/api/config.ts
rename to server/tests/api/server/config.ts
index 61ae579777e19b185db2636700462952678724de..e8846c8db70636c4d8e39a8d498e36d5c37bec64 100644 (file)
@@ -9,7 +9,7 @@ import {
   flushTests,
   runServer,
   registerUser
-} from '../utils'
+} from '../../utils/index'
 
 describe('Test config', function () {
   let server = null
similarity index 94%
rename from server/tests/api/follows.ts
rename to server/tests/api/server/follows.ts
index 2ffa426a0658955084c9a4d79fa30bf0e6fbf388..f77c0c67c14d3853add86930594a05b9358646b4 100644 (file)
@@ -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.expect
 
similarity index 82%
rename from server/tests/api/jobs.ts
rename to server/tests/api/server/jobs.ts
index 4d9b6139250e918e34f0c5289e5d3458d16338e1..2e17e71a423af89191e1439c66e3b1a82e2a2c5b 100644 (file)
@@ -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.expect
 
similarity index 98%
rename from server/tests/api/users.ts
rename to server/tests/api/users/users.ts
index 67e4cc8c6ce7bb223d62b3d7d1652b33f3d6c3da..2e3a0b94fc29c727dee2a04d541af129690c7a32 100644 (file)
@@ -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.expect
 
similarity index 98%
rename from server/tests/api/multiple-servers.ts
rename to server/tests/api/videos/multiple-servers.ts
index 06274d4cc11dba5530979003f0675400377a130a..84f730a8e9f6dd5a935c981364cd1dfb23ea185f 100644 (file)
@@ -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.expect
 
similarity index 97%
rename from server/tests/api/services.ts
rename to server/tests/api/videos/services.ts
index 4d480c305485534cd74a2f7ef87af92165034a73..1cda464d926fe89096e94e93b190c3f702644ccd 100644 (file)
@@ -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 = null
similarity index 99%
rename from server/tests/api/single-server.ts
rename to server/tests/api/videos/single-server.ts
index 7f4351f5eea621b63032efe8b824a820ecd9b464..02723654dc8af35298bf6dc57fc66c26aed79d3c 100644 (file)
@@ -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.expect
 
similarity index 98%
rename from server/tests/api/video-abuse.ts
rename to server/tests/api/videos/video-abuse.ts
index 4a0b6b5041eb6798d0e21051f72566b11116a901..3fcf5d8c7990b9cb2309d27f5822aa3426aa06cf 100644 (file)
@@ -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.expect
 
similarity index 98%
rename from server/tests/api/video-blacklist-management.ts
rename to server/tests/api/videos/video-blacklist-management.ts
index 0c636e094e3beadd2139eeeca10a0b6a0feeee40..db79784c2774e4b28dd78e7ac01c2b2d2520f115 100644 (file)
@@ -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.expect
 const orderBy = lodash.orderBy
similarity index 96%
rename from server/tests/api/video-blacklist.ts
rename to server/tests/api/videos/video-blacklist.ts
index 3afd8c5103a61e2b6f9946f8facbb3780628cda1..d1cefa5d701a0a08d59f9f1557c3ffeeb6f6418d 100644 (file)
@@ -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.expect
 
similarity index 98%
rename from server/tests/api/video-channels.ts
rename to server/tests/api/videos/video-channels.ts
index 2d8efb3202ba49d3c2804507384f0583cb619918..454a96da6973b29149fa32c68d358250fbcc0a04 100644 (file)
@@ -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: ServerInfo
similarity index 94%
rename from server/tests/api/video-comments.ts
rename to server/tests/api/videos/video-comments.ts
index f05ca5e817a24c3c4a26cb2977ffacbe57622df9..3b6578f04137c0988f1570292540aa08d2796e04 100644 (file)
@@ -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.expect
 
similarity index 97%
rename from server/tests/api/video-description.ts
rename to server/tests/api/videos/video-description.ts
index 7ad1c63ae85a2daf1e803032e7b9567b8c3f64ce..c2985194c5c026b9ddde917bf81fe25fe3b768d0 100644 (file)
@@ -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.expect
 
similarity index 93%
rename from server/tests/api/video-privacy.ts
rename to server/tests/api/videos/video-privacy.ts
index 26847efce537ca6f8eec45b595a63b7a43f8fd43..de709f8f17235c4a98f1bf8f1bcf27220288b095 100644 (file)
@@ -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.expect
 
similarity index 98%
rename from server/tests/api/video-transcoder.ts
rename to server/tests/api/videos/video-transcoder.ts
index 9a6e91b76702cc66883eebf8627d89e96731120a..27927a594678e2591c1363b5589dfeeec79910d4 100644 (file)
@@ -15,7 +15,7 @@ import {
   killallServers,
   webtorrentAdd,
   getVideo
-} from '../utils'
+} from '../../utils/index'
 
 describe('Test video transcoding', function () {
   let servers: ServerInfo[] = []
similarity index 90%
rename from server/tests/utils/cli.ts
rename to server/tests/utils/cli/cli.ts
index 4098fdf6f7e0ed1d696abfd6b5616264bd723350..54d05e9c621459c03603bed2f9a177402d839fdf 100644 (file)
@@ -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}`
index b918ee83d21ed09d8a9bdc2ce69e99f5c81efc7b..d7789e517334ffed21d3bb645683fbc13015271b 100644 (file)
@@ -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'
similarity index 98%
rename from server/tests/utils/follows.ts
rename to server/tests/utils/server/follows.ts
index a9f798bcbbd826b35312274b73f4d122e1d04721..82e89175cf13f12692463ee6785650784a842404 100644 (file)
@@ -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) {
similarity index 96%
rename from server/tests/utils/login.ts
rename to server/tests/utils/users/login.ts
index 22d37c46f43879ccd553bda011f9bfcf910e8031..855c4828d1d66e6fe3d675a0591ff3b5f874da25 100644 (file)
@@ -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 }
similarity index 98%
rename from server/tests/utils/users.ts
rename to server/tests/utils/users/users.ts
index a37d84ab479e8defb837e808648c77e962621b80..bd8d7ab04cbefa26b42b7894f8f87a4dff8ddcb2 100644 (file)
@@ -1,6 +1,6 @@
 import * as request from 'supertest'
 
-import { UserRole } from '../../../shared'
+import { UserRole } from '../../../../shared/index'
 
 function createUser (
   url: string,
similarity index 97%
rename from server/tests/utils/videos.ts
rename to server/tests/utils/videos/videos.ts
index fb758cf29bf42081998b10603626602b5a16b447..6de1b8c92c9d1d00b59a1333f7a02837c5f475aa 100644 (file)
@@ -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