mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Move to eslint
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import * as request from 'supertest'
|
||||
import * as urlUtil from 'url'
|
||||
import { URL } from 'url'
|
||||
|
||||
function getClient (url: string) {
|
||||
const path = '/api/v1/oauth-clients/local'
|
||||
|
||||
return request(url)
|
||||
.get(path)
|
||||
.set('Host', urlUtil.parse(url).host)
|
||||
.set('Host', new URL(url).host)
|
||||
.set('Accept', 'application/json')
|
||||
.expect(200)
|
||||
.expect('Content-Type', /json/)
|
||||
|
||||
@@ -2,11 +2,11 @@ import * as request from 'supertest'
|
||||
import { ContactForm } from '../../models/server'
|
||||
|
||||
function sendContactForm (options: {
|
||||
url: string,
|
||||
fromEmail: string,
|
||||
fromName: string,
|
||||
subject: string,
|
||||
body: string,
|
||||
url: string
|
||||
fromEmail: string
|
||||
fromName: string
|
||||
subject: string
|
||||
body: string
|
||||
expectedStatus?: number
|
||||
}) {
|
||||
const path = '/api/v1/server/contact'
|
||||
|
||||
@@ -5,12 +5,12 @@ import { makePostBodyRequest } from '../requests/requests'
|
||||
import { ActivityPubActorType, FollowState } from '@shared/models'
|
||||
|
||||
function getFollowersListPaginationAndSort (options: {
|
||||
url: string,
|
||||
start: number,
|
||||
count: number,
|
||||
sort: string,
|
||||
search?: string,
|
||||
actorType?: ActivityPubActorType,
|
||||
url: string
|
||||
start: number
|
||||
count: number
|
||||
sort: string
|
||||
search?: string
|
||||
actorType?: ActivityPubActorType
|
||||
state?: FollowState
|
||||
}) {
|
||||
const { url, start, count, sort, search, state, actorType } = options
|
||||
@@ -56,12 +56,12 @@ function rejectFollower (url: string, token: string, follower: string, statusCod
|
||||
}
|
||||
|
||||
function getFollowingListPaginationAndSort (options: {
|
||||
url: string,
|
||||
start: number,
|
||||
count: number,
|
||||
sort: string,
|
||||
search?: string,
|
||||
actorType?: ActivityPubActorType,
|
||||
url: string
|
||||
start: number
|
||||
count: number
|
||||
sort: string
|
||||
search?: string
|
||||
actorType?: ActivityPubActorType
|
||||
state?: FollowState
|
||||
}) {
|
||||
const { url, start, count, sort, search, state, actorType } = options
|
||||
@@ -92,7 +92,7 @@ function follow (follower: string, following: string[], accessToken: string, exp
|
||||
.post(path)
|
||||
.set('Accept', 'application/json')
|
||||
.set('Authorization', 'Bearer ' + accessToken)
|
||||
.send({ 'hosts': followingHosts })
|
||||
.send({ hosts: followingHosts })
|
||||
.expect(expectedStatus)
|
||||
}
|
||||
|
||||
|
||||
@@ -8,20 +8,20 @@ function getJobsList (url: string, accessToken: string, state: JobState) {
|
||||
const path = '/api/v1/jobs/' + state
|
||||
|
||||
return request(url)
|
||||
.get(path)
|
||||
.set('Accept', 'application/json')
|
||||
.set('Authorization', 'Bearer ' + accessToken)
|
||||
.expect(200)
|
||||
.expect('Content-Type', /json/)
|
||||
.get(path)
|
||||
.set('Accept', 'application/json')
|
||||
.set('Authorization', 'Bearer ' + accessToken)
|
||||
.expect(200)
|
||||
.expect('Content-Type', /json/)
|
||||
}
|
||||
|
||||
function getJobsListPaginationAndSort (options: {
|
||||
url: string,
|
||||
accessToken: string,
|
||||
state: JobState,
|
||||
start: number,
|
||||
count: number,
|
||||
sort: string,
|
||||
url: string
|
||||
accessToken: string
|
||||
state: JobState
|
||||
start: number
|
||||
count: number
|
||||
sort: string
|
||||
jobType?: JobType
|
||||
}) {
|
||||
const { url, accessToken, state, start, count, sort, jobType } = options
|
||||
|
||||
@@ -7,13 +7,13 @@ import { root } from '../miscs/miscs'
|
||||
import { join } from 'path'
|
||||
|
||||
function listPlugins (parameters: {
|
||||
url: string,
|
||||
accessToken: string,
|
||||
start?: number,
|
||||
count?: number,
|
||||
sort?: string,
|
||||
pluginType?: PluginType,
|
||||
uninstalled?: boolean,
|
||||
url: string
|
||||
accessToken: string
|
||||
start?: number
|
||||
count?: number
|
||||
sort?: string
|
||||
pluginType?: PluginType
|
||||
uninstalled?: boolean
|
||||
expectedStatus?: number
|
||||
}) {
|
||||
const { url, accessToken, start, count, sort, pluginType, uninstalled, expectedStatus = 200 } = parameters
|
||||
@@ -35,13 +35,13 @@ function listPlugins (parameters: {
|
||||
}
|
||||
|
||||
function listAvailablePlugins (parameters: {
|
||||
url: string,
|
||||
accessToken: string,
|
||||
start?: number,
|
||||
count?: number,
|
||||
sort?: string,
|
||||
pluginType?: PluginType,
|
||||
currentPeerTubeEngine?: string,
|
||||
url: string
|
||||
accessToken: string
|
||||
start?: number
|
||||
count?: number
|
||||
sort?: string
|
||||
pluginType?: PluginType
|
||||
currentPeerTubeEngine?: string
|
||||
search?: string
|
||||
expectedStatus?: number
|
||||
}) {
|
||||
@@ -67,9 +67,9 @@ function listAvailablePlugins (parameters: {
|
||||
}
|
||||
|
||||
function getPlugin (parameters: {
|
||||
url: string,
|
||||
accessToken: string,
|
||||
npmName: string,
|
||||
url: string
|
||||
accessToken: string
|
||||
npmName: string
|
||||
expectedStatus?: number
|
||||
}) {
|
||||
const { url, accessToken, npmName, expectedStatus = 200 } = parameters
|
||||
@@ -84,10 +84,10 @@ function getPlugin (parameters: {
|
||||
}
|
||||
|
||||
function updatePluginSettings (parameters: {
|
||||
url: string,
|
||||
accessToken: string,
|
||||
npmName: string,
|
||||
settings: any,
|
||||
url: string
|
||||
accessToken: string
|
||||
npmName: string
|
||||
settings: any
|
||||
expectedStatus?: number
|
||||
}) {
|
||||
const { url, accessToken, npmName, settings, expectedStatus = 204 } = parameters
|
||||
@@ -103,9 +103,9 @@ function updatePluginSettings (parameters: {
|
||||
}
|
||||
|
||||
function getPluginRegisteredSettings (parameters: {
|
||||
url: string,
|
||||
accessToken: string,
|
||||
npmName: string,
|
||||
url: string
|
||||
accessToken: string
|
||||
npmName: string
|
||||
expectedStatus?: number
|
||||
}) {
|
||||
const { url, accessToken, npmName, expectedStatus = 200 } = parameters
|
||||
@@ -120,8 +120,8 @@ function getPluginRegisteredSettings (parameters: {
|
||||
}
|
||||
|
||||
function getPublicSettings (parameters: {
|
||||
url: string,
|
||||
npmName: string,
|
||||
url: string
|
||||
npmName: string
|
||||
expectedStatus?: number
|
||||
}) {
|
||||
const { url, npmName, expectedStatus = 200 } = parameters
|
||||
@@ -135,8 +135,8 @@ function getPublicSettings (parameters: {
|
||||
}
|
||||
|
||||
function getPluginTranslations (parameters: {
|
||||
url: string,
|
||||
locale: string,
|
||||
url: string
|
||||
locale: string
|
||||
expectedStatus?: number
|
||||
}) {
|
||||
const { url, locale, expectedStatus = 200 } = parameters
|
||||
@@ -150,9 +150,9 @@ function getPluginTranslations (parameters: {
|
||||
}
|
||||
|
||||
function installPlugin (parameters: {
|
||||
url: string,
|
||||
accessToken: string,
|
||||
path?: string,
|
||||
url: string
|
||||
accessToken: string
|
||||
path?: string
|
||||
npmName?: string
|
||||
expectedStatus?: number
|
||||
}) {
|
||||
@@ -169,9 +169,9 @@ function installPlugin (parameters: {
|
||||
}
|
||||
|
||||
function updatePlugin (parameters: {
|
||||
url: string,
|
||||
accessToken: string,
|
||||
path?: string,
|
||||
url: string
|
||||
accessToken: string
|
||||
path?: string
|
||||
npmName?: string
|
||||
expectedStatus?: number
|
||||
}) {
|
||||
@@ -188,8 +188,8 @@ function updatePlugin (parameters: {
|
||||
}
|
||||
|
||||
function uninstallPlugin (parameters: {
|
||||
url: string,
|
||||
accessToken: string,
|
||||
url: string
|
||||
accessToken: string
|
||||
npmName: string
|
||||
expectedStatus?: number
|
||||
}) {
|
||||
|
||||
@@ -15,11 +15,11 @@ function updateRedundancy (url: string, accessToken: string, host: string, redun
|
||||
|
||||
function listVideoRedundancies (options: {
|
||||
url: string
|
||||
accessToken: string,
|
||||
target: VideoRedundanciesTarget,
|
||||
start?: number,
|
||||
count?: number,
|
||||
sort?: string,
|
||||
accessToken: string
|
||||
target: VideoRedundanciesTarget
|
||||
start?: number
|
||||
count?: number
|
||||
sort?: string
|
||||
statusCodeExpected?: number
|
||||
}) {
|
||||
const path = '/api/v1/server/redundancy/videos'
|
||||
@@ -41,8 +41,8 @@ function listVideoRedundancies (options: {
|
||||
}
|
||||
|
||||
function addVideoRedundancy (options: {
|
||||
url: string,
|
||||
accessToken: string,
|
||||
url: string
|
||||
accessToken: string
|
||||
videoId: number
|
||||
}) {
|
||||
const path = '/api/v1/server/redundancy/videos'
|
||||
@@ -58,8 +58,8 @@ function addVideoRedundancy (options: {
|
||||
}
|
||||
|
||||
function removeVideoRedundancy (options: {
|
||||
url: string,
|
||||
accessToken: string,
|
||||
url: string
|
||||
accessToken: string
|
||||
redundancyId: number
|
||||
}) {
|
||||
const { url, accessToken, redundancyId } = options
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
/* tslint:disable:no-unused-expression */
|
||||
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */
|
||||
|
||||
import { ChildProcess, exec, fork } from 'child_process'
|
||||
import { join } from 'path'
|
||||
import { root, wait } from '../miscs/miscs'
|
||||
import { copy, pathExists, readdir, readFile, remove } from 'fs-extra'
|
||||
import { existsSync } from 'fs'
|
||||
import { expect } from 'chai'
|
||||
import { VideoChannel } from '../../models/videos'
|
||||
import { randomInt } from '../../core-utils/miscs/miscs'
|
||||
|
||||
interface ServerInfo {
|
||||
app: ChildProcess,
|
||||
app: ChildProcess
|
||||
url: string
|
||||
host: string
|
||||
|
||||
@@ -20,13 +19,13 @@ interface ServerInfo {
|
||||
serverNumber: number
|
||||
|
||||
client: {
|
||||
id: string,
|
||||
id: string
|
||||
secret: string
|
||||
}
|
||||
|
||||
user: {
|
||||
username: string,
|
||||
password: string,
|
||||
username: string
|
||||
password: string
|
||||
email?: string
|
||||
}
|
||||
|
||||
@@ -57,7 +56,7 @@ function parallelTests () {
|
||||
}
|
||||
|
||||
function flushAndRunMultipleServers (totalServers: number, configOverride?: Object) {
|
||||
let apps = []
|
||||
const apps = []
|
||||
let i = 0
|
||||
|
||||
return new Promise<ServerInfo[]>(res => {
|
||||
@@ -203,20 +202,20 @@ async function runServer (server: ServerInfo, configOverrideArg?: any, args = []
|
||||
|
||||
// Capture things if we want to
|
||||
for (const key of Object.keys(regexps)) {
|
||||
const regexp = regexps[ key ]
|
||||
const regexp = regexps[key]
|
||||
const matches = data.toString().match(regexp)
|
||||
if (matches !== null) {
|
||||
if (key === 'client_id') server.client.id = matches[ 1 ]
|
||||
else if (key === 'client_secret') server.client.secret = matches[ 1 ]
|
||||
else if (key === 'user_username') server.user.username = matches[ 1 ]
|
||||
else if (key === 'user_password') server.user.password = matches[ 1 ]
|
||||
if (key === 'client_id') server.client.id = matches[1]
|
||||
else if (key === 'client_secret') server.client.secret = matches[1]
|
||||
else if (key === 'user_username') server.user.username = matches[1]
|
||||
else if (key === 'user_password') server.user.password = matches[1]
|
||||
}
|
||||
}
|
||||
|
||||
// Check if all required sentences are here
|
||||
for (const key of Object.keys(serverRunString)) {
|
||||
if (data.toString().indexOf(key) !== -1) serverRunString[ key ] = true
|
||||
if (serverRunString[ key ] === false) dontContinue = true
|
||||
if (data.toString().indexOf(key) !== -1) serverRunString[key] = true
|
||||
if (serverRunString[key] === false) dontContinue = true
|
||||
}
|
||||
|
||||
// If no, there is maybe one thing not already initialized (client/user credentials generation...)
|
||||
|
||||
Reference in New Issue
Block a user