From 397d78fb3e55aeeedf3591d7be9d7a30849d9e82 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 14 Mar 2019 15:29:23 +0100 Subject: Fix unit tests --- server/tests/api/check-params/videos-filter.ts | 6 ++++-- server/tests/api/videos/video-playlists.ts | 18 +++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'server/tests/api') diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.ts index cc2f35069..d5557cd07 100644 --- a/server/tests/api/check-params/videos-filter.ts +++ b/server/tests/api/check-params/videos-filter.ts @@ -9,7 +9,7 @@ import { makeGetRequest, runServer, ServerInfo, - setAccessTokensToServers, + setAccessTokensToServers, setDefaultVideoChannel, userLogin } from '../../../../shared/utils' import { UserRole } from '../../../../shared/models/users' @@ -53,6 +53,7 @@ describe('Test videos filters', function () { server = await runServer(1) await setAccessTokensToServers([ server ]) + await setDefaultVideoChannel([ server ]) const user = { username: 'user1', password: 'my super password' } await createUser(server.url, server.accessToken, user.username, user.password) @@ -75,7 +76,8 @@ describe('Test videos filters', function () { token: server.accessToken, playlistAttrs: { displayName: 'super playlist', - privacy: VideoPlaylistPrivacy.PUBLIC + privacy: VideoPlaylistPrivacy.PUBLIC, + videoChannelId: server.videoChannel.id } }) playlistUUID = res.body.videoPlaylist.uuid diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index 358a064ff..fc2662808 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts @@ -14,7 +14,7 @@ import { flushAndRunMultipleServers, flushTests, getAccountPlaylistsList, - getAccountPlaylistsListWithToken, + getAccountPlaylistsListWithToken, getMyUserInformation, getPlaylistVideos, getVideoChannelPlaylistsList, getVideoPlaylist, @@ -42,6 +42,7 @@ import { VideoPlaylist } from '../../../../shared/models/videos/playlist/video-p import { Video } from '../../../../shared/models/videos' import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model' import { VideoExistInPlaylist } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model' +import { User } from '../../../../shared/models/users' const expect = chai.expect @@ -195,7 +196,8 @@ describe('Test video playlists', function () { token: servers[1].accessToken, playlistAttrs: { displayName: 'playlist 2', - privacy: VideoPlaylistPrivacy.PUBLIC + privacy: VideoPlaylistPrivacy.PUBLIC, + videoChannelId: servers[1].videoChannel.id } }) playlistServer2Id1 = res.body.videoPlaylist.id @@ -208,7 +210,8 @@ describe('Test video playlists', function () { playlistAttrs: { displayName: 'playlist 3', 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, playlistAttrs: { 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 userAccessToken = await userLogin(servers[0], user) + const resChannel = await getMyUserInformation(servers[0].url, userAccessToken) + const userChannel = (resChannel.body as User).videoChannels[0] + await createVideoPlaylist({ url: servers[0].url, token: userAccessToken, playlistAttrs: { displayName: 'playlist to be deleted', - privacy: VideoPlaylistPrivacy.PUBLIC + privacy: VideoPlaylistPrivacy.PUBLIC, + videoChannelId: userChannel.id } }) -- cgit v1.2.3