import * as chai from 'chai'
import { Video, VideoPlaylistPrivacy } from '@shared/models'
import {
- addVideoInPlaylist,
- createVideoPlaylist,
- getOEmbed,
getVideosList,
ServerInfo,
setAccessTokensToServers,
}
{
- const res = await createVideoPlaylist({
- url: server.url,
- token: server.accessToken,
- playlistAttrs: {
+ const created = await server.playlistsCommand.create({
+ attributes: {
displayName: 'The Life and Times of Scrooge McDuck',
privacy: VideoPlaylistPrivacy.PUBLIC,
videoChannelId: server.videoChannel.id
}
})
- playlistUUID = res.body.videoPlaylist.uuid
+ playlistUUID = created.uuid
playlistDisplayName = 'The Life and Times of Scrooge McDuck'
- await addVideoInPlaylist({
- url: server.url,
- token: server.accessToken,
- playlistId: res.body.videoPlaylist.id,
- elementAttrs: {
+ await server.playlistsCommand.addElement({
+ playlistId: created.id,
+ attributes: {
videoId: video.id
}
})
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>'