mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Begin live tests
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user