import {
addVideoInPlaylist,
createVideoPlaylist,
- getOEmbed,
getVideosList,
ServerInfo,
setAccessTokensToServers,
for (const basePath of [ '/videos/watch/', '/w/' ]) {
const oembedUrl = 'http://localhost:' + server.port + basePath + video.uuid
- const res = await getOEmbed(server.url, oembedUrl)
+ const res = await server.servicesCommand.getOEmbed({ oembedUrl })
const expectedHtml = '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts" ' +
`title="${video.name}" src="http://localhost:${server.port}/videos/embed/${video.uuid}" ` +
'frameborder="0" allowfullscreen></iframe>'
for (const basePath of [ '/videos/watch/playlist/', '/w/p/' ]) {
const oembedUrl = 'http://localhost:' + server.port + basePath + playlistUUID
- const res = await getOEmbed(server.url, oembedUrl)
+ const res = await server.servicesCommand.getOEmbed({ oembedUrl })
const expectedHtml = '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts" ' +
`title="${playlistDisplayName}" src="http://localhost:${server.port}/video-playlists/embed/${playlistUUID}" ` +
'frameborder="0" allowfullscreen></iframe>'
const maxHeight = 50
const maxWidth = 50
- const res = await getOEmbed(server.url, oembedUrl, format, maxHeight, maxWidth)
+ const res = await server.servicesCommand.getOEmbed({ oembedUrl, format, maxHeight, maxWidth })
const expectedHtml = '<iframe width="50" height="50" sandbox="allow-same-origin allow-scripts" ' +
`title="${video.name}" src="http://localhost:${server.port}/videos/embed/${video.uuid}" ` +
'frameborder="0" allowfullscreen></iframe>'
import { SearchCommand } from '../search'
import { SocketIOCommand } from '../socket'
import { AccountsCommand, BlocklistCommand, SubscriptionsCommand } from '../users'
-import { LiveCommand } from '../videos'
+import { LiveCommand, ServicesCommand } from '../videos'
import { ConfigCommand } from './config-command'
import { ContactFormCommand } from './contact-form-command'
import { DebugCommand } from './debug-command'
blocklistCommand?: BlocklistCommand
subscriptionsCommand?: SubscriptionsCommand
liveCommand?: LiveCommand
+ servicesCommand?: ServicesCommand
}
function parallelTests () {
server.blocklistCommand = new BlocklistCommand(server)
server.subscriptionsCommand = new SubscriptionsCommand(server)
server.liveCommand = new LiveCommand(server)
+ server.servicesCommand = new ServicesCommand(server)
res(server)
})
export * from './live-command'
export * from './live'
-export * from './services'
+export * from './services-command'
export * from './video-blacklist'
export * from './video-captions'
export * from './video-change-ownership'
--- /dev/null
+import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
+import { AbstractCommand, OverrideCommandOptions } from '../shared'
+
+export class ServicesCommand extends AbstractCommand {
+
+ getOEmbed (options: OverrideCommandOptions & {
+ oembedUrl: string
+ format?: string
+ maxHeight?: number
+ maxWidth?: number
+ }) {
+ const path = '/services/oembed'
+ const query = {
+ url: options.oembedUrl,
+ format: options.format,
+ maxheight: options.maxHeight,
+ maxwidth: options.maxWidth
+ }
+
+ return this.getRequest({
+ ...options,
+
+ path,
+ query,
+ defaultExpectedStatus: HttpStatusCode.OK_200
+ })
+ }
+}
+++ /dev/null
-import * as request from 'supertest'
-import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
-
-function getOEmbed (url: string, oembedUrl: string, format?: string, maxHeight?: number, maxWidth?: number) {
- const path = '/services/oembed'
- const query = {
- url: oembedUrl,
- format,
- maxheight: maxHeight,
- maxwidth: maxWidth
- }
-
- return request(url)
- .get(path)
- .query(query)
- .set('Accept', 'application/json')
- .expect(HttpStatusCode.OK_200)
-}
-
-// ---------------------------------------------------------------------------
-
-export {
- getOEmbed
-}