Fix unit tests
authorChocobozzz <me@florianbigard.com>
Thu, 14 Mar 2019 14:29:23 +0000 (15:29 +0100)
committerChocobozzz <chocobozzz@cpy.re>
Mon, 18 Mar 2019 10:17:59 +0000 (11:17 +0100)
server/tests/api/check-params/videos-filter.ts
server/tests/api/videos/video-playlists.ts

index cc2f350690cec02db866a76680cacced5b4b5433..d5557cd072b0c2327487e63501484f285a7ff7e0 100644 (file)
@@ -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
index 358a064ff37d4b4b8cc8d2b921f7782cc3e286bf..fc266280865f6562ca1d927e39adfb6b855251a0 100644 (file)
@@ -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
       }
     })