]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/client.ts
Introduce channels command
[github/Chocobozzz/PeerTube.git] / server / tests / client.ts
index 60df878d7fad0fe3daad72669a56e68d91085ec5..1bdb2eb641e326c37a0d8a2b95597a3160449b60 100644 (file)
@@ -6,9 +6,7 @@ import { omit } from 'lodash'
 import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
 import { Account, HTMLServerConfig, ServerConfig, VideoPlaylistCreateResult, VideoPlaylistPrivacy } from '@shared/models'
 import {
-  addVideoInPlaylist,
   cleanupTests,
-  createVideoPlaylist,
   doubleFollow,
   flushAndRunMultipleServers,
   getVideosList,
@@ -18,7 +16,6 @@ import {
   setAccessTokensToServers,
   setDefaultVideoChannel,
   updateMyUser,
-  updateVideoChannel,
   uploadVideo,
   waitJobs
 } from '../../shared/extra-utils'
@@ -65,7 +62,10 @@ describe('Test a client controllers', function () {
 
     await setDefaultVideoChannel(servers)
 
-    await updateVideoChannel(servers[0].url, servers[0].accessToken, servers[0].videoChannel.name, { description: channelDescription })
+    await servers[0].channelsCommand.update({
+      channelName: servers[0].videoChannel.name,
+      attributes: { description: channelDescription }
+    })
 
     // Video
 
@@ -82,23 +82,17 @@ describe('Test a client controllers', function () {
 
     // Playlist
 
-    const playlistAttrs = {
+    const attributes = {
       displayName: playlistName,
       description: playlistDescription,
       privacy: VideoPlaylistPrivacy.PUBLIC,
       videoChannelId: servers[0].videoChannel.id
     }
 
-    const resVideoPlaylistRequest = await createVideoPlaylist({ url: servers[0].url, token: servers[0].accessToken, playlistAttrs })
-    playlist = resVideoPlaylistRequest.body.videoPlaylist
+    playlist = await servers[0].playlistsCommand.create({ attributes })
     playlistIds = [ playlist.id, playlist.shortUUID, playlist.uuid ]
 
-    await addVideoInPlaylist({
-      url: servers[0].url,
-      token: servers[0].accessToken,
-      playlistId: playlist.shortUUID,
-      elementAttrs: { videoId: video.id }
-    })
+    await servers[0].playlistsCommand.addElement({ playlistId: playlist.shortUUID, attributes: { videoId: video.id } })
 
     // Account