aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/search/search-activitypub-video-channels.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/search/search-activitypub-video-channels.ts')
-rw-r--r--server/tests/api/search/search-activitypub-video-channels.ts37
1 files changed, 20 insertions, 17 deletions
diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts
index bcc21381c..75794402d 100644
--- a/server/tests/api/search/search-activitypub-video-channels.ts
+++ b/server/tests/api/search/search-activitypub-video-channels.ts
@@ -5,12 +5,9 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunMultipleServers, 7 flushAndRunMultipleServers,
8 getVideoChannelVideos,
9 SearchCommand, 8 SearchCommand,
10 ServerInfo, 9 ServerInfo,
11 setAccessTokensToServers, 10 setAccessTokensToServers,
12 updateVideo,
13 uploadVideo,
14 wait, 11 wait,
15 waitJobs 12 waitJobs
16} from '@shared/extra-utils' 13} from '@shared/extra-utils'
@@ -53,8 +50,9 @@ describe('Test ActivityPub video channels search', function () {
53 const created = await servers[1].channelsCommand.create({ token: userServer2Token, attributes: channel }) 50 const created = await servers[1].channelsCommand.create({ token: userServer2Token, attributes: channel })
54 channelIdServer2 = created.id 51 channelIdServer2 = created.id
55 52
56 const res = await uploadVideo(servers[1].url, userServer2Token, { name: 'video 1 server 2', channelId: channelIdServer2 }) 53 const attributes = { name: 'video 1 server 2', channelId: channelIdServer2 }
57 videoServer2UUID = res.body.video.uuid 54 const { uuid } = await servers[1].videosCommand.upload({ token: userServer2Token, attributes })
55 videoServer2UUID = uuid
58 } 56 }
59 57
60 await waitJobs(servers) 58 await waitJobs(servers)
@@ -149,16 +147,21 @@ describe('Test ActivityPub video channels search', function () {
149 147
150 await waitJobs(servers) 148 await waitJobs(servers)
151 149
152 const res = await getVideoChannelVideos(servers[0].url, null, 'channel1_server2@localhost:' + servers[1].port, 0, 5) 150 const { total, data } = await servers[0].videosCommand.listByChannel({
153 expect(res.body.total).to.equal(0) 151 token: null,
154 expect(res.body.data).to.have.lengthOf(0) 152 videoChannelName: 'channel1_server2@localhost:' + servers[1].port
153 })
154 expect(total).to.equal(0)
155 expect(data).to.have.lengthOf(0)
155 }) 156 })
156 157
157 it('Should list video channel videos of server 2 with token', async function () { 158 it('Should list video channel videos of server 2 with token', async function () {
158 const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'channel1_server2@localhost:' + servers[1].port, 0, 5) 159 const { total, data } = await servers[0].videosCommand.listByChannel({
160 videoChannelName: 'channel1_server2@localhost:' + servers[1].port
161 })
159 162
160 expect(res.body.total).to.equal(1) 163 expect(total).to.equal(1)
161 expect(res.body.data[0].name).to.equal('video 1 server 2') 164 expect(data[0].name).to.equal('video 1 server 2')
162 }) 165 })
163 166
164 it('Should update video channel of server 2, and refresh it on server 1', async function () { 167 it('Should update video channel of server 2, and refresh it on server 1', async function () {
@@ -190,8 +193,8 @@ describe('Test ActivityPub video channels search', function () {
190 it('Should update and add a video on server 2, and update it on server 1 after a search', async function () { 193 it('Should update and add a video on server 2, and update it on server 1 after a search', async function () {
191 this.timeout(60000) 194 this.timeout(60000)
192 195
193 await updateVideo(servers[1].url, userServer2Token, videoServer2UUID, { name: 'video 1 updated' }) 196 await servers[1].videosCommand.update({ token: userServer2Token, id: videoServer2UUID, attributes: { name: 'video 1 updated' } })
194 await uploadVideo(servers[1].url, userServer2Token, { name: 'video 2 server 2', channelId: channelIdServer2 }) 197 await servers[1].videosCommand.upload({ token: userServer2Token, attributes: { name: 'video 2 server 2', channelId: channelIdServer2 } })
195 198
196 await waitJobs(servers) 199 await waitJobs(servers)
197 200
@@ -204,11 +207,11 @@ describe('Test ActivityPub video channels search', function () {
204 await waitJobs(servers) 207 await waitJobs(servers)
205 208
206 const videoChannelName = 'channel1_server2@localhost:' + servers[1].port 209 const videoChannelName = 'channel1_server2@localhost:' + servers[1].port
207 const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, videoChannelName, 0, 5, '-createdAt') 210 const { total, data } = await servers[0].videosCommand.listByChannel({ videoChannelName, sort: '-createdAt' })
208 211
209 expect(res.body.total).to.equal(2) 212 expect(total).to.equal(2)
210 expect(res.body.data[0].name).to.equal('video 2 server 2') 213 expect(data[0].name).to.equal('video 2 server 2')
211 expect(res.body.data[1].name).to.equal('video 1 updated') 214 expect(data[1].name).to.equal('video 1 updated')
212 }) 215 })
213 216
214 it('Should delete video channel of server 2, and delete it on server 1', async function () { 217 it('Should delete video channel of server 2, and delete it on server 1', async function () {