aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/search/search-activitypub-videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/search/search-activitypub-videos.ts')
-rw-r--r--server/tests/api/search/search-activitypub-videos.ts32
1 files changed, 14 insertions, 18 deletions
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts
index 403c84010..19b4d5ed8 100644
--- a/server/tests/api/search/search-activitypub-videos.ts
+++ b/server/tests/api/search/search-activitypub-videos.ts
@@ -5,17 +5,13 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunMultipleServers, 7 flushAndRunMultipleServers,
8 getVideosList,
9 removeVideo,
10 SearchCommand, 8 SearchCommand,
11 ServerInfo, 9 ServerInfo,
12 setAccessTokensToServers, 10 setAccessTokensToServers,
13 updateVideo, 11 wait,
14 uploadVideo, 12 waitJobs
15 wait 13} from '@shared/extra-utils'
16} from '../../../../shared/extra-utils' 14import { VideoPrivacy } from '@shared/models'
17import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
18import { VideoPrivacy } from '../../../../shared/models/videos'
19 15
20const expect = chai.expect 16const expect = chai.expect
21 17
@@ -34,13 +30,13 @@ describe('Test ActivityPub videos search', function () {
34 await setAccessTokensToServers(servers) 30 await setAccessTokensToServers(servers)
35 31
36 { 32 {
37 const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video 1 on server 1' }) 33 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video 1 on server 1' } })
38 videoServer1UUID = res.body.video.uuid 34 videoServer1UUID = uuid
39 } 35 }
40 36
41 { 37 {
42 const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 1 on server 2' }) 38 const { uuid } = await servers[1].videosCommand.upload({ attributes: { name: 'video 1 on server 2' } })
43 videoServer2UUID = res.body.video.uuid 39 videoServer2UUID = uuid
44 } 40 }
45 41
46 await waitJobs(servers) 42 await waitJobs(servers)
@@ -109,10 +105,10 @@ describe('Test ActivityPub videos search', function () {
109 }) 105 })
110 106
111 it('Should not list this remote video', async function () { 107 it('Should not list this remote video', async function () {
112 const res = await getVideosList(servers[0].url) 108 const { total, data } = await servers[0].videosCommand.list()
113 expect(res.body.total).to.equal(1) 109 expect(total).to.equal(1)
114 expect(res.body.data).to.have.lengthOf(1) 110 expect(data).to.have.lengthOf(1)
115 expect(res.body.data[0].name).to.equal('video 1 on server 1') 111 expect(data[0].name).to.equal('video 1 on server 1')
116 }) 112 })
117 113
118 it('Should update video of server 2, and refresh it on server 1', async function () { 114 it('Should update video of server 2, and refresh it on server 1', async function () {
@@ -131,7 +127,7 @@ describe('Test ActivityPub videos search', function () {
131 privacy: VideoPrivacy.UNLISTED, 127 privacy: VideoPrivacy.UNLISTED,
132 channelId: videoChannelId 128 channelId: videoChannelId
133 } 129 }
134 await updateVideo(servers[1].url, servers[1].accessToken, videoServer2UUID, attributes) 130 await servers[1].videosCommand.update({ id: videoServer2UUID, attributes })
135 131
136 await waitJobs(servers) 132 await waitJobs(servers)
137 // Expire video 133 // Expire video
@@ -157,7 +153,7 @@ describe('Test ActivityPub videos search', function () {
157 it('Should delete video of server 2, and delete it on server 1', async function () { 153 it('Should delete video of server 2, and delete it on server 1', async function () {
158 this.timeout(120000) 154 this.timeout(120000)
159 155
160 await removeVideo(servers[1].url, servers[1].accessToken, videoServer2UUID) 156 await servers[1].videosCommand.remove({ id: videoServer2UUID })
161 157
162 await waitJobs(servers) 158 await waitJobs(servers)
163 // Expire video 159 // Expire video