]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/video-playlists.ts
Remove unused actor uuid field
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / video-playlists.ts
index d9cb71992822dc4d8406a26648ad20b2eb188bb4..3ebb1df0b588af604d3a733d7704c9a1b74ba99b 100644 (file)
@@ -6,22 +6,23 @@ import {
   addVideoChannel,
   addVideoInPlaylist,
   checkPlaylistFilesWereRemoved,
+  cleanupTests,
   createUser,
   createVideoPlaylist,
   deleteVideoChannel,
   deleteVideoPlaylist,
-  doubleFollow, doVideosExistInMyPlaylist,
+  doubleFollow,
+  doVideosExistInMyPlaylist,
   flushAndRunMultipleServers,
-  flushTests,
   getAccountPlaylistsList,
-  getAccountPlaylistsListWithToken, getMyUserInformation,
+  getAccountPlaylistsListWithToken,
+  getMyUserInformation,
   getPlaylistVideos,
   getVideoChannelPlaylistsList,
   getVideoPlaylist,
   getVideoPlaylistPrivacies,
   getVideoPlaylistsList,
   getVideoPlaylistWithToken,
-  killallServers,
   removeUser,
   removeVideoFromPlaylist,
   reorderVideosPlaylist,
@@ -35,8 +36,9 @@ import {
   uploadVideo,
   uploadVideoAndGetId,
   userLogin,
-  waitJobs
-} from '../../../../shared/utils'
+  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'
 import { Video } from '../../../../shared/models/videos'
@@ -137,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)
 
@@ -357,7 +371,7 @@ describe('Test video playlists', function () {
 
     for (const server of servers) {
       const results = [
-        await getAccountPlaylistsList(server.url, 'root@localhost:9002', 0, 5, '-createdAt'),
+        await getAccountPlaylistsList(server.url, 'root@localhost:' + servers[1].port, 0, 5, '-createdAt'),
         await getVideoPlaylistsList(server.url, 0, 2, '-createdAt')
       ]
 
@@ -756,7 +770,7 @@ describe('Test video playlists', function () {
     this.timeout(30000)
 
     for (const server of servers) {
-      await checkPlaylistFilesWereRemoved(playlistServer1UUID, server.serverNumber)
+      await checkPlaylistFilesWereRemoved(playlistServer1UUID, server.internalServerNumber)
     }
   })
 
@@ -861,11 +875,6 @@ describe('Test video playlists', function () {
   })
 
   after(async function () {
-    killallServers(servers)
-
-    // Keep the logs if the test failed
-    if (this['ok']) {
-      await flushTests()
-    }
+    await cleanupTests(servers)
   })
 })