Fix unit tests

pull/1745/head
Chocobozzz 2019-03-14 15:29:23 +01:00 committed by Chocobozzz
parent 978c9d497b
commit 397d78fb3e
2 changed files with 17 additions and 7 deletions

View File

@ -9,7 +9,7 @@ import {
makeGetRequest, makeGetRequest,
runServer, runServer,
ServerInfo, ServerInfo,
setAccessTokensToServers, setAccessTokensToServers, setDefaultVideoChannel,
userLogin userLogin
} from '../../../../shared/utils' } from '../../../../shared/utils'
import { UserRole } from '../../../../shared/models/users' import { UserRole } from '../../../../shared/models/users'
@ -53,6 +53,7 @@ describe('Test videos filters', function () {
server = await runServer(1) server = await runServer(1)
await setAccessTokensToServers([ server ]) await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ])
const user = { username: 'user1', password: 'my super password' } const user = { username: 'user1', password: 'my super password' }
await createUser(server.url, server.accessToken, user.username, user.password) await createUser(server.url, server.accessToken, user.username, user.password)
@ -75,7 +76,8 @@ describe('Test videos filters', function () {
token: server.accessToken, token: server.accessToken,
playlistAttrs: { playlistAttrs: {
displayName: 'super playlist', displayName: 'super playlist',
privacy: VideoPlaylistPrivacy.PUBLIC privacy: VideoPlaylistPrivacy.PUBLIC,
videoChannelId: server.videoChannel.id
} }
}) })
playlistUUID = res.body.videoPlaylist.uuid playlistUUID = res.body.videoPlaylist.uuid

View File

@ -14,7 +14,7 @@ import {
flushAndRunMultipleServers, flushAndRunMultipleServers,
flushTests, flushTests,
getAccountPlaylistsList, getAccountPlaylistsList,
getAccountPlaylistsListWithToken, getAccountPlaylistsListWithToken, getMyUserInformation,
getPlaylistVideos, getPlaylistVideos,
getVideoChannelPlaylistsList, getVideoChannelPlaylistsList,
getVideoPlaylist, getVideoPlaylist,
@ -42,6 +42,7 @@ import { VideoPlaylist } from '../../../../shared/models/videos/playlist/video-p
import { Video } from '../../../../shared/models/videos' import { Video } from '../../../../shared/models/videos'
import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model' import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model'
import { VideoExistInPlaylist } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model' import { VideoExistInPlaylist } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
import { User } from '../../../../shared/models/users'
const expect = chai.expect const expect = chai.expect
@ -195,7 +196,8 @@ describe('Test video playlists', function () {
token: servers[1].accessToken, token: servers[1].accessToken,
playlistAttrs: { playlistAttrs: {
displayName: 'playlist 2', displayName: 'playlist 2',
privacy: VideoPlaylistPrivacy.PUBLIC privacy: VideoPlaylistPrivacy.PUBLIC,
videoChannelId: servers[1].videoChannel.id
} }
}) })
playlistServer2Id1 = res.body.videoPlaylist.id playlistServer2Id1 = res.body.videoPlaylist.id
@ -208,7 +210,8 @@ describe('Test video playlists', function () {
playlistAttrs: { playlistAttrs: {
displayName: 'playlist 3', displayName: 'playlist 3',
privacy: VideoPlaylistPrivacy.PUBLIC, privacy: VideoPlaylistPrivacy.PUBLIC,
thumbnailfile: 'thumbnail.jpg' thumbnailfile: 'thumbnail.jpg',
videoChannelId: servers[1].videoChannel.id
} }
}) })
@ -422,7 +425,8 @@ describe('Test video playlists', function () {
token: servers[ 0 ].accessToken, token: servers[ 0 ].accessToken,
playlistAttrs: { playlistAttrs: {
displayName: 'playlist 4', displayName: 'playlist 4',
privacy: VideoPlaylistPrivacy.PUBLIC privacy: VideoPlaylistPrivacy.PUBLIC,
videoChannelId: servers[0].videoChannel.id
} }
}) })
@ -816,12 +820,16 @@ describe('Test video playlists', function () {
const userId = res.body.user.id const userId = res.body.user.id
const userAccessToken = await userLogin(servers[0], user) const userAccessToken = await userLogin(servers[0], user)
const resChannel = await getMyUserInformation(servers[0].url, userAccessToken)
const userChannel = (resChannel.body as User).videoChannels[0]
await createVideoPlaylist({ await createVideoPlaylist({
url: servers[0].url, url: servers[0].url,
token: userAccessToken, token: userAccessToken,
playlistAttrs: { playlistAttrs: {
displayName: 'playlist to be deleted', displayName: 'playlist to be deleted',
privacy: VideoPlaylistPrivacy.PUBLIC privacy: VideoPlaylistPrivacy.PUBLIC,
videoChannelId: userChannel.id
} }
}) })