aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/search/search-activitypub-video-playlists.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-08 15:54:39 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commite6346d59e63135cf012ed18c102d3b0179ef565f (patch)
treee65259adb50daa6376c9878abeef051d99191328 /server/tests/api/search/search-activitypub-video-playlists.ts
parent72cbfc5695ec5ebdb9721d3648218f63feeaeac5 (diff)
downloadPeerTube-e6346d59e63135cf012ed18c102d3b0179ef565f.tar.gz
PeerTube-e6346d59e63135cf012ed18c102d3b0179ef565f.tar.zst
PeerTube-e6346d59e63135cf012ed18c102d3b0179ef565f.zip
Introduce playlist command
Diffstat (limited to 'server/tests/api/search/search-activitypub-video-playlists.ts')
-rw-r--r--server/tests/api/search/search-activitypub-video-playlists.ts45
1 files changed, 13 insertions, 32 deletions
diff --git a/server/tests/api/search/search-activitypub-video-playlists.ts b/server/tests/api/search/search-activitypub-video-playlists.ts
index 1df18173a..cb7582d29 100644
--- a/server/tests/api/search/search-activitypub-video-playlists.ts
+++ b/server/tests/api/search/search-activitypub-video-playlists.ts
@@ -3,12 +3,8 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 addVideoInPlaylist,
7 cleanupTests, 6 cleanupTests,
8 createVideoPlaylist,
9 deleteVideoPlaylist,
10 flushAndRunMultipleServers, 7 flushAndRunMultipleServers,
11 getVideoPlaylistsList,
12 SearchCommand, 8 SearchCommand,
13 ServerInfo, 9 ServerInfo,
14 setAccessTokensToServers, 10 setAccessTokensToServers,
@@ -46,16 +42,11 @@ describe('Test ActivityPub playlists search', function () {
46 privacy: VideoPlaylistPrivacy.PUBLIC, 42 privacy: VideoPlaylistPrivacy.PUBLIC,
47 videoChannelId: servers[0].videoChannel.id 43 videoChannelId: servers[0].videoChannel.id
48 } 44 }
49 const res = await createVideoPlaylist({ url: servers[0].url, token: servers[0].accessToken, playlistAttrs: attributes }) 45 const created = await servers[0].playlistsCommand.create({ attributes })
50 playlistServer1UUID = res.body.videoPlaylist.uuid 46 playlistServer1UUID = created.uuid
51 47
52 for (const videoId of [ video1, video2 ]) { 48 for (const videoId of [ video1, video2 ]) {
53 await addVideoInPlaylist({ 49 await servers[0].playlistsCommand.addElement({ playlistId: playlistServer1UUID, attributes: { videoId } })
54 url: servers[0].url,
55 token: servers[0].accessToken,
56 playlistId: playlistServer1UUID,
57 elementAttrs: { videoId }
58 })
59 } 50 }
60 } 51 }
61 52
@@ -68,15 +59,10 @@ describe('Test ActivityPub playlists search', function () {
68 privacy: VideoPlaylistPrivacy.PUBLIC, 59 privacy: VideoPlaylistPrivacy.PUBLIC,
69 videoChannelId: servers[1].videoChannel.id 60 videoChannelId: servers[1].videoChannel.id
70 } 61 }
71 const res = await createVideoPlaylist({ url: servers[1].url, token: servers[1].accessToken, playlistAttrs: attributes }) 62 const created = await servers[1].playlistsCommand.create({ attributes })
72 playlistServer2UUID = res.body.videoPlaylist.uuid 63 playlistServer2UUID = created.uuid
73 64
74 await addVideoInPlaylist({ 65 await servers[1].playlistsCommand.addElement({ playlistId: playlistServer2UUID, attributes: { videoId } })
75 url: servers[1].url,
76 token: servers[1].accessToken,
77 playlistId: playlistServer2UUID,
78 elementAttrs: { videoId }
79 })
80 } 66 }
81 67
82 await waitJobs(servers) 68 await waitJobs(servers)
@@ -154,21 +140,16 @@ describe('Test ActivityPub playlists search', function () {
154 }) 140 })
155 141
156 it('Should not list this remote playlist', async function () { 142 it('Should not list this remote playlist', async function () {
157 const res = await getVideoPlaylistsList(servers[0].url, 0, 10) 143 const body = await servers[0].playlistsCommand.list({ start: 0, count: 10 })
158 expect(res.body.total).to.equal(1) 144 expect(body.total).to.equal(1)
159 expect(res.body.data).to.have.lengthOf(1) 145 expect(body.data).to.have.lengthOf(1)
160 expect(res.body.data[0].displayName).to.equal('playlist 1 on server 1') 146 expect(body.data[0].displayName).to.equal('playlist 1 on server 1')
161 }) 147 })
162 148
163 it('Should update the playlist of server 2, and refresh it on server 1', async function () { 149 it('Should update the playlist of server 2, and refresh it on server 1', async function () {
164 this.timeout(60000) 150 this.timeout(60000)
165 151
166 await addVideoInPlaylist({ 152 await servers[1].playlistsCommand.addElement({ playlistId: playlistServer2UUID, attributes: { videoId: video2Server2 } })
167 url: servers[1].url,
168 token: servers[1].accessToken,
169 playlistId: playlistServer2UUID,
170 elementAttrs: { videoId: video2Server2 }
171 })
172 153
173 await waitJobs(servers) 154 await waitJobs(servers)
174 // Expire playlist 155 // Expire playlist
@@ -192,7 +173,7 @@ describe('Test ActivityPub playlists search', function () {
192 it('Should delete playlist of server 2, and delete it on server 1', async function () { 173 it('Should delete playlist of server 2, and delete it on server 1', async function () {
193 this.timeout(60000) 174 this.timeout(60000)
194 175
195 await deleteVideoPlaylist(servers[1].url, servers[1].accessToken, playlistServer2UUID) 176 await servers[1].playlistsCommand.delete({ playlistId: playlistServer2UUID })
196 177
197 await waitJobs(servers) 178 await waitJobs(servers)
198 // Expiration 179 // Expiration