Begin live tests

This commit is contained in:
Chocobozzz
2020-11-02 15:43:44 +01:00
committed by Chocobozzz
parent 77e9f859c6
commit af4ae64f6f
21 changed files with 472 additions and 31 deletions

View File

@@ -10,10 +10,12 @@ import { randomInt } from '../../core-utils/miscs/miscs'
interface ServerInfo {
app: ChildProcess
url: string
host: string
hostname: string
port: number
parallel: boolean
internalServerNumber: number
serverNumber: number
@@ -109,6 +111,7 @@ async function flushAndRunServer (serverNumber: number, configOverride?: Object,
serverNumber,
url: `http://localhost:${port}`,
host: `localhost:${port}`,
hostname: 'localhost',
client: {
id: null,
secret: null

View File

@@ -2,8 +2,8 @@ import * as ffmpeg from 'fluent-ffmpeg'
import { LiveVideoCreate, LiveVideoUpdate, VideoDetails, VideoState } from '@shared/models'
import { buildAbsoluteFixturePath, wait } from '../miscs/miscs'
import { makeGetRequest, makePutBodyRequest, makeUploadRequest } from '../requests/requests'
import { ServerInfo } from '../server/servers'
import { getVideo, getVideoWithToken } from './videos'
import { getVideoWithToken } from './videos'
import { omit } from 'lodash'
function getLive (url: string, token: string, videoId: number | string, statusCodeExpected = 200) {
const path = '/api/v1/videos/live'
@@ -31,16 +31,18 @@ function updateLive (url: string, token: string, videoId: number | string, field
function createLive (url: string, token: string, fields: LiveVideoCreate, statusCodeExpected = 200) {
const path = '/api/v1/videos/live'
let attaches: any = {}
if (fields.thumbnailfile) attaches = { thumbnailfile: fields.thumbnailfile }
if (fields.previewfile) attaches = { previewfile: fields.previewfile }
const attaches: any = {}
if (fields.thumbnailfile) attaches.thumbnailfile = fields.thumbnailfile
if (fields.previewfile) attaches.previewfile = fields.previewfile
const updatedFields = omit(fields, 'thumbnailfile', 'previewfile')
return makeUploadRequest({
url,
path,
token,
attaches,
fields,
fields: updatedFields,
statusCodeExpected
})
}