diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-14 15:29:23 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-03-18 11:17:59 +0100 |
commit | 397d78fb3e55aeeedf3591d7be9d7a30849d9e82 (patch) | |
tree | 8ddfd01fa8ab3a1a12ce400d675ab55eb4d8e39e /server | |
parent | 978c9d497b36e52196eb7e755406571e5d57cbc7 (diff) | |
download | PeerTube-397d78fb3e55aeeedf3591d7be9d7a30849d9e82.tar.gz PeerTube-397d78fb3e55aeeedf3591d7be9d7a30849d9e82.tar.zst PeerTube-397d78fb3e55aeeedf3591d7be9d7a30849d9e82.zip |
Fix unit tests
Diffstat (limited to 'server')
-rw-r--r-- | server/tests/api/check-params/videos-filter.ts | 6 | ||||
-rw-r--r-- | server/tests/api/videos/video-playlists.ts | 18 |
2 files changed, 17 insertions, 7 deletions
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 { | |||
9 | makeGetRequest, | 9 | makeGetRequest, |
10 | runServer, | 10 | runServer, |
11 | ServerInfo, | 11 | ServerInfo, |
12 | setAccessTokensToServers, | 12 | setAccessTokensToServers, setDefaultVideoChannel, |
13 | userLogin | 13 | userLogin |
14 | } from '../../../../shared/utils' | 14 | } from '../../../../shared/utils' |
15 | import { UserRole } from '../../../../shared/models/users' | 15 | import { UserRole } from '../../../../shared/models/users' |
@@ -53,6 +53,7 @@ describe('Test videos filters', function () { | |||
53 | server = await runServer(1) | 53 | server = await runServer(1) |
54 | 54 | ||
55 | await setAccessTokensToServers([ server ]) | 55 | await setAccessTokensToServers([ server ]) |
56 | await setDefaultVideoChannel([ server ]) | ||
56 | 57 | ||
57 | const user = { username: 'user1', password: 'my super password' } | 58 | const user = { username: 'user1', password: 'my super password' } |
58 | await createUser(server.url, server.accessToken, user.username, user.password) | 59 | await createUser(server.url, server.accessToken, user.username, user.password) |
@@ -75,7 +76,8 @@ describe('Test videos filters', function () { | |||
75 | token: server.accessToken, | 76 | token: server.accessToken, |
76 | playlistAttrs: { | 77 | playlistAttrs: { |
77 | displayName: 'super playlist', | 78 | displayName: 'super playlist', |
78 | privacy: VideoPlaylistPrivacy.PUBLIC | 79 | privacy: VideoPlaylistPrivacy.PUBLIC, |
80 | videoChannelId: server.videoChannel.id | ||
79 | } | 81 | } |
80 | }) | 82 | }) |
81 | playlistUUID = res.body.videoPlaylist.uuid | 83 | 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 { | |||
14 | flushAndRunMultipleServers, | 14 | flushAndRunMultipleServers, |
15 | flushTests, | 15 | flushTests, |
16 | getAccountPlaylistsList, | 16 | getAccountPlaylistsList, |
17 | getAccountPlaylistsListWithToken, | 17 | getAccountPlaylistsListWithToken, getMyUserInformation, |
18 | getPlaylistVideos, | 18 | getPlaylistVideos, |
19 | getVideoChannelPlaylistsList, | 19 | getVideoChannelPlaylistsList, |
20 | getVideoPlaylist, | 20 | getVideoPlaylist, |
@@ -42,6 +42,7 @@ import { VideoPlaylist } from '../../../../shared/models/videos/playlist/video-p | |||
42 | import { Video } from '../../../../shared/models/videos' | 42 | import { Video } from '../../../../shared/models/videos' |
43 | import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model' | 43 | import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model' |
44 | import { VideoExistInPlaylist } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model' | 44 | import { VideoExistInPlaylist } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model' |
45 | import { User } from '../../../../shared/models/users' | ||
45 | 46 | ||
46 | const expect = chai.expect | 47 | const expect = chai.expect |
47 | 48 | ||
@@ -195,7 +196,8 @@ describe('Test video playlists', function () { | |||
195 | token: servers[1].accessToken, | 196 | token: servers[1].accessToken, |
196 | playlistAttrs: { | 197 | playlistAttrs: { |
197 | displayName: 'playlist 2', | 198 | displayName: 'playlist 2', |
198 | privacy: VideoPlaylistPrivacy.PUBLIC | 199 | privacy: VideoPlaylistPrivacy.PUBLIC, |
200 | videoChannelId: servers[1].videoChannel.id | ||
199 | } | 201 | } |
200 | }) | 202 | }) |
201 | playlistServer2Id1 = res.body.videoPlaylist.id | 203 | playlistServer2Id1 = res.body.videoPlaylist.id |
@@ -208,7 +210,8 @@ describe('Test video playlists', function () { | |||
208 | playlistAttrs: { | 210 | playlistAttrs: { |
209 | displayName: 'playlist 3', | 211 | displayName: 'playlist 3', |
210 | privacy: VideoPlaylistPrivacy.PUBLIC, | 212 | privacy: VideoPlaylistPrivacy.PUBLIC, |
211 | thumbnailfile: 'thumbnail.jpg' | 213 | thumbnailfile: 'thumbnail.jpg', |
214 | videoChannelId: servers[1].videoChannel.id | ||
212 | } | 215 | } |
213 | }) | 216 | }) |
214 | 217 | ||
@@ -422,7 +425,8 @@ describe('Test video playlists', function () { | |||
422 | token: servers[ 0 ].accessToken, | 425 | token: servers[ 0 ].accessToken, |
423 | playlistAttrs: { | 426 | playlistAttrs: { |
424 | displayName: 'playlist 4', | 427 | displayName: 'playlist 4', |
425 | privacy: VideoPlaylistPrivacy.PUBLIC | 428 | privacy: VideoPlaylistPrivacy.PUBLIC, |
429 | videoChannelId: servers[0].videoChannel.id | ||
426 | } | 430 | } |
427 | }) | 431 | }) |
428 | 432 | ||
@@ -816,12 +820,16 @@ describe('Test video playlists', function () { | |||
816 | const userId = res.body.user.id | 820 | const userId = res.body.user.id |
817 | const userAccessToken = await userLogin(servers[0], user) | 821 | const userAccessToken = await userLogin(servers[0], user) |
818 | 822 | ||
823 | const resChannel = await getMyUserInformation(servers[0].url, userAccessToken) | ||
824 | const userChannel = (resChannel.body as User).videoChannels[0] | ||
825 | |||
819 | await createVideoPlaylist({ | 826 | await createVideoPlaylist({ |
820 | url: servers[0].url, | 827 | url: servers[0].url, |
821 | token: userAccessToken, | 828 | token: userAccessToken, |
822 | playlistAttrs: { | 829 | playlistAttrs: { |
823 | displayName: 'playlist to be deleted', | 830 | displayName: 'playlist to be deleted', |
824 | privacy: VideoPlaylistPrivacy.PUBLIC | 831 | privacy: VideoPlaylistPrivacy.PUBLIC, |
832 | videoChannelId: userChannel.id | ||
825 | } | 833 | } |
826 | }) | 834 | }) |
827 | 835 | ||