aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-playlists.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos/video-playlists.ts')
-rw-r--r--server/tests/api/videos/video-playlists.ts71
1 files changed, 53 insertions, 18 deletions
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts
index 9dad58c8c..da8de054b 100644
--- a/server/tests/api/videos/video-playlists.ts
+++ b/server/tests/api/videos/video-playlists.ts
@@ -56,7 +56,7 @@ import {
56 removeServerFromServerBlocklist 56 removeServerFromServerBlocklist
57} from '../../../../shared/extra-utils/users/blocklist' 57} from '../../../../shared/extra-utils/users/blocklist'
58import { User } from '../../../../shared/models/users' 58import { User } from '../../../../shared/models/users'
59import { VideoPrivacy } from '../../../../shared/models/videos' 59import { VideoPlaylistCreateResult, VideoPrivacy } from '../../../../shared/models/videos'
60import { VideoExistInPlaylist } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model' 60import { VideoExistInPlaylist } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
61import { VideoPlaylistElement, VideoPlaylistElementType } from '../../../../shared/models/videos/playlist/video-playlist-element.model' 61import { VideoPlaylistElement, VideoPlaylistElementType } from '../../../../shared/models/videos/playlist/video-playlist-element.model'
62import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model' 62import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model'
@@ -427,31 +427,45 @@ describe('Test video playlists', function () {
427 expect(data).to.have.lengthOf(0) 427 expect(data).to.have.lengthOf(0)
428 } 428 }
429 }) 429 })
430 })
430 431
431 it('Should not list unlisted or private playlists', async function () { 432 describe('Playlist rights', function () {
433 let unlistedPlaylist: VideoPlaylistCreateResult
434 let privatePlaylist: VideoPlaylistCreateResult
435
436 before(async function () {
432 this.timeout(30000) 437 this.timeout(30000)
433 438
434 await createVideoPlaylist({ 439 {
435 url: servers[1].url, 440 const res = await createVideoPlaylist({
436 token: servers[1].accessToken, 441 url: servers[1].url,
437 playlistAttrs: { 442 token: servers[1].accessToken,
438 displayName: 'playlist unlisted', 443 playlistAttrs: {
439 privacy: VideoPlaylistPrivacy.UNLISTED 444 displayName: 'playlist unlisted',
440 } 445 privacy: VideoPlaylistPrivacy.UNLISTED,
441 }) 446 videoChannelId: servers[1].videoChannel.id
447 }
448 })
449 unlistedPlaylist = res.body.videoPlaylist
450 }
442 451
443 await createVideoPlaylist({ 452 {
444 url: servers[1].url, 453 const res = await createVideoPlaylist({
445 token: servers[1].accessToken, 454 url: servers[1].url,
446 playlistAttrs: { 455 token: servers[1].accessToken,
447 displayName: 'playlist private', 456 playlistAttrs: {
448 privacy: VideoPlaylistPrivacy.PRIVATE 457 displayName: 'playlist private',
449 } 458 privacy: VideoPlaylistPrivacy.PRIVATE
450 }) 459 }
460 })
461 privatePlaylist = res.body.videoPlaylist
462 }
451 463
452 await waitJobs(servers) 464 await waitJobs(servers)
453 await wait(3000) 465 await wait(3000)
466 })
454 467
468 it('Should not list unlisted or private playlists', async function () {
455 for (const server of servers) { 469 for (const server of servers) {
456 const results = [ 470 const results = [
457 await getAccountPlaylistsList(server.url, 'root@localhost:' + servers[1].port, 0, 5, '-createdAt'), 471 await getAccountPlaylistsList(server.url, 'root@localhost:' + servers[1].port, 0, 5, '-createdAt'),
@@ -469,6 +483,27 @@ describe('Test video playlists', function () {
469 } 483 }
470 } 484 }
471 }) 485 })
486
487 it('Should not get unlisted playlist using only the id', async function () {
488 await getVideoPlaylist(servers[1].url, unlistedPlaylist.id, 404)
489 })
490
491 it('Should get unlisted plyaylist using uuid or shortUUID', async function () {
492 await getVideoPlaylist(servers[1].url, unlistedPlaylist.uuid)
493 await getVideoPlaylist(servers[1].url, unlistedPlaylist.shortUUID)
494 })
495
496 it('Should not get private playlist without token', async function () {
497 for (const id of [ privatePlaylist.id, privatePlaylist.uuid, privatePlaylist.shortUUID ]) {
498 await getVideoPlaylist(servers[1].url, id, 401)
499 }
500 })
501
502 it('Should get private playlist with a token', async function () {
503 for (const id of [ privatePlaylist.id, privatePlaylist.uuid, privatePlaylist.shortUUID ]) {
504 await getVideoPlaylistWithToken(servers[1].url, servers[1].accessToken, id)
505 }
506 })
472 }) 507 })
473 508
474 describe('Update playlists', function () { 509 describe('Update playlists', function () {