X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fvideo-playlists.ts;h=f82c8cbce0937f4b19390c9292f702acd4251c6d;hb=1f20622f2b087eaf8738d60fae00a44b9c558ca3;hp=83a2f3d4d81550a3e926e6af7896477abe41a62b;hpb=79ad1706f3cf009e04db9cd9e6a721801d93e64e;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index 83a2f3d4d..f82c8cbce 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts @@ -36,7 +36,8 @@ import { uploadVideo, uploadVideoAndGetId, userLogin, - waitJobs + waitJobs, + generateUserAccessToken } from '../../../../shared/extra-utils' import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model' import { VideoPlaylist } from '../../../../shared/models/videos/playlist/video-playlist.model' @@ -138,6 +139,18 @@ describe('Test video playlists', function () { } }) + it('Should get private playlist for a classic user', async function () { + const token = await generateUserAccessToken(servers[0], 'toto') + + const res = await getAccountPlaylistsListWithToken(servers[0].url, token, 'toto', 0, 5) + + expect(res.body.total).to.equal(1) + expect(res.body.data).to.have.lengthOf(1) + + const playlistId = res.body.data[0].id + await getPlaylistVideos(servers[0].url, token, playlistId, 0, 5) + }) + it('Should create a playlist on server 1 and have the playlist on server 2 and 3', async function () { this.timeout(30000) @@ -741,6 +754,39 @@ describe('Test video playlists', function () { } }) + it('Should be able to create a public playlist, and set it to private', async function () { + this.timeout(30000) + + const res = await createVideoPlaylist({ + url: servers[0].url, + token: servers[0].accessToken, + playlistAttrs: { + displayName: 'my super public playlist', + privacy: VideoPlaylistPrivacy.PUBLIC, + videoChannelId: servers[0].videoChannel.id + } + }) + const videoPlaylistIds = res.body.videoPlaylist + + await waitJobs(servers) + + for (const server of servers) { + await getVideoPlaylist(server.url, videoPlaylistIds.uuid, 200) + } + + const playlistAttrs = { privacy: VideoPlaylistPrivacy.PRIVATE } + await updateVideoPlaylist({ url: servers[0].url, token: servers[0].accessToken, playlistId: videoPlaylistIds.id, playlistAttrs }) + + await waitJobs(servers) + + for (const server of [ servers[1], servers[2] ]) { + await getVideoPlaylist(server.url, videoPlaylistIds.uuid, 404) + } + await getVideoPlaylist(servers[0].url, videoPlaylistIds.uuid, 401) + + await getVideoPlaylistWithToken(servers[0].url, servers[0].accessToken, videoPlaylistIds.uuid, 200) + }) + it('Should delete the playlist on server 1 and delete on server 2 and 3', async function () { this.timeout(30000)