1
0
Fork 0

Tests directories refractor

This commit is contained in:
Chocobozzz 2017-12-28 13:59:22 +01:00
parent db799da3d2
commit c5d31dba56
No known key found for this signature in database
GPG key ID: 583A612D890159BE
38 changed files with 98 additions and 95 deletions

View file

@ -2,9 +2,7 @@
import * as chai from 'chai' import * as chai from 'chai'
import 'mocha' import 'mocha'
import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from './utils' import { flushTests, killallServers, makeActivityPubGetRequest, runServer, ServerInfo, setAccessTokensToServers } from './utils'
import { runServer } from './utils/servers'
import { makeActivityPubGetRequest } from './utils/activitypub'
const expect = chai.expect const expect = chai.expect

View file

@ -9,7 +9,7 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
killallServers killallServers
} from '../../utils' } from '../../utils'
import { getVideosList, uploadVideo } from '../../utils/videos' import { getVideosList, uploadVideo } from '../../utils/videos/videos'
describe('Test services API validators', function () { describe('Test services API validators', function () {
let server let server

View file

@ -3,7 +3,7 @@
import 'mocha' import 'mocha'
import * as request from 'supertest' import * as request from 'supertest'
import { flushTests, killallServers, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils' 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 () { describe('Test video comments API validator', function () {
let pathThread: string let pathThread: string

View file

@ -1,11 +1,11 @@
// Order of the tests we want to execute // Order of the tests we want to execute
import './config' import './server/config'
import './check-params' import './check-params'
import './users' import './users/users'
import './single-server' import './videos/single-server'
import './video-abuse' import './videos/video-abuse'
import './video-blacklist' import './videos/video-blacklist'
import './video-blacklist-management' import './videos/video-blacklist-management'
import './video-description' import './videos/video-description'
import './video-privacy' import './videos/video-privacy'
import './services' import './videos/services'

View file

@ -1,7 +1,7 @@
// Order of the tests we want to execute // Order of the tests we want to execute
// import './multiple-servers' // import './multiple-servers'
import './video-transcoder' import './videos/video-transcoder'
import './multiple-servers' import './videos/multiple-servers'
import './follows' import './server/follows'
import './jobs' import './server/jobs'
import './video-comments' import './videos/video-comments'

View file

@ -9,7 +9,7 @@ import {
flushTests, flushTests,
runServer, runServer,
registerUser registerUser
} from '../utils' } from '../../utils/index'
describe('Test config', function () { describe('Test config', function () {
let server = null let server = null

View file

@ -2,18 +2,21 @@
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 { import {
flushAndRunMultipleServers, flushTests, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo, flushAndRunMultipleServers, flushTests, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo,
wait wait
} from '../utils' } from '../../utils/index'
import { follow, getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, unfollow } from '../utils/follows' import { dateIsValid, webtorrentAdd } from '../../utils/miscs/miscs'
import { getUserAccessToken } from '../utils/login' import { follow, getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, unfollow } from '../../utils/server/follows'
import { dateIsValid, webtorrentAdd } from '../utils/miscs' import { getUserAccessToken } from '../../utils/users/login'
import { createUser } from '../utils/users' import { createUser } from '../../utils/users/users'
import { addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, getVideoThreadComments } from '../utils/video-comments' import {
import { getVideo, rateVideo, testVideoImage } from '../utils/videos' addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads,
getVideoThreadComments
} from '../../utils/videos/video-comments'
import { getVideo, rateVideo, testVideoImage } from '../../utils/videos/videos'
const expect = chai.expect const expect = chai.expect

View file

@ -2,12 +2,12 @@
import * as chai from 'chai' import * as chai from 'chai'
import 'mocha' import 'mocha'
import { flushTests, killallServers, ServerInfo, setAccessTokensToServers, wait } from '../utils' import { flushTests, killallServers, ServerInfo, setAccessTokensToServers, wait } from '../../utils/index'
import { doubleFollow } from '../utils/follows' import { doubleFollow } from '../../utils/server/follows'
import { getJobsList, getJobsListPaginationAndSort } from '../utils/jobs' import { getJobsList, getJobsListPaginationAndSort } from '../../utils/server/jobs'
import { flushAndRunMultipleServers } from '../utils/servers' import { flushAndRunMultipleServers } from '../../utils/server/servers'
import { uploadVideo } from '../utils/videos' import { uploadVideo } from '../../utils/videos/videos'
import { dateIsValid } from '../utils/miscs' import { dateIsValid } from '../../utils/miscs/miscs'
const expect = chai.expect const expect = chai.expect

View file

@ -2,7 +2,7 @@
import * as chai from 'chai' import * as chai from 'chai'
import 'mocha' import 'mocha'
import { UserRole } from '../../../shared' import { UserRole } from '../../../../shared/index'
import { import {
createUser, createUser,
flushTests, flushTests,
@ -26,10 +26,10 @@ import {
updateMyUser, updateMyUser,
updateUser, updateUser,
uploadVideo uploadVideo
} from '../utils' } from '../../utils/index'
import { follow } from '../utils/follows' import { follow } from '../../utils/server/follows'
import { getMyVideos } from '../utils/videos' import { getMyVideos } from '../../utils/videos/videos'
import { setAccessTokensToServers } from '../utils/login' import { setAccessTokensToServers } from '../../utils/users/login'
const expect = chai.expect const expect = chai.expect

View file

@ -4,16 +4,19 @@ import * as chai from 'chai'
import 'mocha' import 'mocha'
import { join } from 'path' import { join } from 'path'
import * as request from 'supertest' 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 { import {
addVideoChannel, dateIsValid, doubleFollow, flushAndRunMultipleServers, flushTests, getUserAccessToken, getVideo, addVideoChannel, dateIsValid, doubleFollow, flushAndRunMultipleServers, flushTests, getUserAccessToken, getVideo,
getVideoChannelsList, getVideosList, killallServers, rateVideo, removeVideo, ServerInfo, setAccessTokensToServers, testVideoImage, getVideoChannelsList, getVideosList, killallServers, rateVideo, removeVideo, ServerInfo, setAccessTokensToServers, testVideoImage,
updateVideo, uploadVideo, wait, webtorrentAdd updateVideo, uploadVideo, wait, webtorrentAdd
} from '../utils' } from '../../utils/index'
import { createUser } from '../utils/users' import { createUser } from '../../utils/users/users'
import { addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, getVideoThreadComments } from '../utils/video-comments' import {
import { viewVideo } from '../utils/videos' addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads,
getVideoThreadComments
} from '../../utils/videos/video-comments'
import { viewVideo } from '../../utils/videos/videos'
const expect = chai.expect const expect = chai.expect

View file

@ -12,8 +12,8 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
killallServers, killallServers,
getOEmbed getOEmbed
} from '../utils' } from '../../utils/index'
import { runServer } from '../utils/servers' import { runServer } from '../../utils/server/servers'
describe('Test services', function () { describe('Test services', function () {
let server: ServerInfo = null let server: ServerInfo = null

View file

@ -30,8 +30,8 @@ import {
uploadVideo, uploadVideo,
wait, wait,
webtorrentAdd webtorrentAdd
} from '../utils' } from '../../utils/index'
import { viewVideo } from '../utils/videos' import { viewVideo } from '../../utils/videos/videos'
const expect = chai.expect const expect = chai.expect

View file

@ -13,8 +13,8 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
uploadVideo, uploadVideo,
wait wait
} from '../utils' } from '../../utils/index'
import { doubleFollow } from '../utils/follows' import { doubleFollow } from '../../utils/server/follows'
const expect = chai.expect const expect = chai.expect

View file

@ -16,8 +16,8 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
uploadVideo, uploadVideo,
wait wait
} from '../utils' } from '../../utils/index'
import { doubleFollow } from '../utils/follows' import { doubleFollow } from '../../utils/server/follows'
const expect = chai.expect const expect = chai.expect
const orderBy = lodash.orderBy const orderBy = lodash.orderBy

View file

@ -13,8 +13,8 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
uploadVideo, uploadVideo,
wait wait
} from '../utils' } from '../../utils/index'
import { doubleFollow } from '../utils/follows' import { doubleFollow } from '../../utils/server/follows'
const expect = chai.expect const expect = chai.expect

View file

@ -17,8 +17,8 @@ import {
updateVideoChannel, updateVideoChannel,
deleteVideoChannel, deleteVideoChannel,
getVideoChannel getVideoChannel
} from '../utils' } from '../../utils/index'
import { User } from '../../../shared' import { User } from '../../../../shared/index'
describe('Test a video channels', function () { describe('Test a video channels', function () {
let server: ServerInfo let server: ServerInfo

View file

@ -2,9 +2,12 @@
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 { dateIsValid, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../utils' import { dateIsValid, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils/index'
import { addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, getVideoThreadComments } from '../utils/video-comments' import {
addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads,
getVideoThreadComments
} from '../../utils/videos/video-comments'
const expect = chai.expect const expect = chai.expect

View file

@ -14,8 +14,8 @@ import {
updateVideo, updateVideo,
uploadVideo, uploadVideo,
wait wait
} from '../utils' } from '../../utils/index'
import { doubleFollow } from '../utils/follows' import { doubleFollow } from '../../utils/server/follows'
const expect = chai.expect const expect = chai.expect

View file

@ -2,7 +2,7 @@
import * as chai from 'chai' import * as chai from 'chai'
import 'mocha' import 'mocha'
import { VideoPrivacy } from '../../../shared/models/videos/video-privacy.enum' import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum'
import { import {
flushAndRunMultipleServers, flushAndRunMultipleServers,
flushTests, flushTests,
@ -12,11 +12,11 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
uploadVideo, uploadVideo,
wait wait
} from '../utils' } from '../../utils/index'
import { doubleFollow } from '../utils/follows' import { doubleFollow } from '../../utils/server/follows'
import { getUserAccessToken } from '../utils/login' import { getUserAccessToken } from '../../utils/users/login'
import { createUser } from '../utils/users' import { createUser } from '../../utils/users/users'
import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../utils/videos' import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../../utils/videos/videos'
const expect = chai.expect const expect = chai.expect

View file

@ -15,7 +15,7 @@ import {
killallServers, killallServers,
webtorrentAdd, webtorrentAdd,
getVideo getVideo
} from '../utils' } from '../../utils/index'
describe('Test video transcoding', function () { describe('Test video transcoding', function () {
let servers: ServerInfo[] = [] let servers: ServerInfo[] = []

View file

@ -1,6 +1,6 @@
import { exec } from 'child_process' import { exec } from 'child_process'
import { ServerInfo } from './servers' import { ServerInfo } from '../server/servers'
function getEnvCli (server?: ServerInfo) { function getEnvCli (server?: ServerInfo) {
return `NODE_ENV=test NODE_APP_INSTANCE=${server.serverNumber}` return `NODE_ENV=test NODE_APP_INSTANCE=${server.serverNumber}`

View file

@ -1,15 +1,15 @@
export * from './activitypub' export * from './server/activitypub'
export * from './cli' export * from './cli/cli'
export * from './clients' export * from './server/clients'
export * from './config' export * from './server/config'
export * from './login' export * from './users/login'
export * from './miscs' export * from './miscs/miscs'
export * from './follows' export * from './server/follows'
export * from './requests' export * from './requests/requests'
export * from './servers' export * from './server/servers'
export * from './services' export * from './videos/services'
export * from './users' export * from './users/users'
export * from './video-abuses' export * from './videos/video-abuses'
export * from './video-blacklist' export * from './videos/video-blacklist'
export * from './video-channels' export * from './videos/video-channels'
export * from './videos' export * from './videos/videos'

View file

@ -1,5 +1,5 @@
import * as request from 'supertest' import * as request from 'supertest'
import { wait } from './miscs' import { wait } from '../miscs/miscs'
import { ServerInfo } from './servers' import { ServerInfo } from './servers'
function getFollowersListPaginationAndSort (url: string, start: number, count: number, sort: string) { function getFollowersListPaginationAndSort (url: string, start: number, count: number, sort: string) {

View file

@ -1,6 +1,6 @@
import * as request from 'supertest' import * as request from 'supertest'
import { ServerInfo } from './servers' import { ServerInfo } from '../server/servers'
type Client = { id: string, secret: string } type Client = { id: string, secret: string }
type User = { username: string, password: string } type User = { username: string, password: string }

View file

@ -1,6 +1,6 @@
import * as request from 'supertest' import * as request from 'supertest'
import { UserRole } from '../../../shared' import { UserRole } from '../../../../shared/index'
function createUser ( function createUser (
url: string, url: string,

View file

@ -1,13 +1,9 @@
import { readFile } from 'fs' import { readFile } from 'fs'
import * as request from 'supertest'
import { join, isAbsolute } from 'path'
import * as parseTorrent from 'parse-torrent' import * as parseTorrent from 'parse-torrent'
import { isAbsolute, join } from 'path'
import { makeGetRequest } from './requests' import * as request from 'supertest'
import { readFilePromise } from './miscs' import { getMyUserInformation, makeGetRequest, readFilePromise, ServerInfo } from '../'
import { ServerInfo } from './servers' import { VideoPrivacy } from '../../../../shared/models/videos'
import { getMyUserInformation } from './users'
import { VideoPrivacy } from '../../../shared'
type VideoAttributes = { type VideoAttributes = {
name?: string name?: string