diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-24 15:36:50 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-27 09:41:54 +0200 |
commit | 687d638c2bee0d223f206168173b1b95adbad983 (patch) | |
tree | 957741b0ba704562a233181510bb8fda0102c8a5 /server/tests/api | |
parent | f5b0af50c85e2f8b6b2b054ac1f47123cacbe08d (diff) | |
download | PeerTube-687d638c2bee0d223f206168173b1b95adbad983.tar.gz PeerTube-687d638c2bee0d223f206168173b1b95adbad983.tar.zst PeerTube-687d638c2bee0d223f206168173b1b95adbad983.zip |
Fetch outbox when searching an actor
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/search/search-activitypub-video-channels.ts | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts index 512cb32fd..a287c5bdf 100644 --- a/server/tests/api/search/search-activitypub-video-channels.ts +++ b/server/tests/api/search/search-activitypub-video-channels.ts | |||
@@ -8,11 +8,11 @@ import { | |||
8 | deleteVideoChannel, | 8 | deleteVideoChannel, |
9 | flushAndRunMultipleServers, | 9 | flushAndRunMultipleServers, |
10 | flushTests, | 10 | flushTests, |
11 | getVideoChannelsList, | 11 | getVideoChannelsList, getVideoChannelVideos, |
12 | killallServers, | 12 | killallServers, |
13 | ServerInfo, | 13 | ServerInfo, |
14 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
15 | updateMyUser, | 15 | updateMyUser, updateVideo, |
16 | updateVideoChannel, | 16 | updateVideoChannel, |
17 | uploadVideo, | 17 | uploadVideo, |
18 | userLogin, | 18 | userLogin, |
@@ -27,6 +27,8 @@ const expect = chai.expect | |||
27 | describe('Test a ActivityPub video channels search', function () { | 27 | describe('Test a ActivityPub video channels search', function () { |
28 | let servers: ServerInfo[] | 28 | let servers: ServerInfo[] |
29 | let userServer2Token: string | 29 | let userServer2Token: string |
30 | let videoServer2UUID: string | ||
31 | let channelIdServer2: number | ||
30 | 32 | ||
31 | before(async function () { | 33 | before(async function () { |
32 | this.timeout(120000) | 34 | this.timeout(120000) |
@@ -56,10 +58,10 @@ describe('Test a ActivityPub video channels search', function () { | |||
56 | displayName: 'Channel 1 server 2' | 58 | displayName: 'Channel 1 server 2' |
57 | } | 59 | } |
58 | const resChannel = await addVideoChannel(servers[1].url, userServer2Token, channel) | 60 | const resChannel = await addVideoChannel(servers[1].url, userServer2Token, channel) |
59 | const channelId = resChannel.body.videoChannel.id | 61 | channelIdServer2 = resChannel.body.videoChannel.id |
60 | 62 | ||
61 | await uploadVideo(servers[1].url, userServer2Token, { name: 'video 1 server 2', channelId }) | 63 | const res = await uploadVideo(servers[1].url, userServer2Token, { name: 'video 1 server 2', channelId: channelIdServer2 }) |
62 | await uploadVideo(servers[1].url, userServer2Token, { name: 'video 2 server 2', channelId }) | 64 | videoServer2UUID = res.body.video.uuid |
63 | } | 65 | } |
64 | 66 | ||
65 | await waitJobs(servers) | 67 | await waitJobs(servers) |
@@ -129,6 +131,23 @@ describe('Test a ActivityPub video channels search', function () { | |||
129 | expect(res.body.data[2].name).to.equal('root_channel') | 131 | expect(res.body.data[2].name).to.equal('root_channel') |
130 | }) | 132 | }) |
131 | 133 | ||
134 | it('Should list video channel videos of server 2 without token', async function () { | ||
135 | this.timeout(30000) | ||
136 | |||
137 | await waitJobs(servers) | ||
138 | |||
139 | const res = await getVideoChannelVideos(servers[0].url, null, 'channel1_server2@localhost:9002', 0, 5) | ||
140 | expect(res.body.total).to.equal(0) | ||
141 | expect(res.body.data).to.have.lengthOf(0) | ||
142 | }) | ||
143 | |||
144 | it('Should list video channel videos of server 2 with token', async function () { | ||
145 | const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'channel1_server2@localhost:9002', 0, 5) | ||
146 | |||
147 | expect(res.body.total).to.equal(1) | ||
148 | expect(res.body.data[0].name).to.equal('video 1 server 2') | ||
149 | }) | ||
150 | |||
132 | it('Should update video channel of server 2, and refresh it on server 1', async function () { | 151 | it('Should update video channel of server 2, and refresh it on server 1', async function () { |
133 | this.timeout(60000) | 152 | this.timeout(60000) |
134 | 153 | ||
@@ -151,6 +170,29 @@ describe('Test a ActivityPub video channels search', function () { | |||
151 | // expect(videoChannel.ownerAccount.displayName).to.equal('user updated') | 170 | // expect(videoChannel.ownerAccount.displayName).to.equal('user updated') |
152 | }) | 171 | }) |
153 | 172 | ||
173 | it('Should update and add a video on server 2, and update it on server 1 after a search', async function () { | ||
174 | this.timeout(60000) | ||
175 | |||
176 | await updateVideo(servers[1].url, userServer2Token, videoServer2UUID, { name: 'video 1 updated' }) | ||
177 | await uploadVideo(servers[1].url, userServer2Token, { name: 'video 2 server 2', channelId: channelIdServer2 }) | ||
178 | |||
179 | await waitJobs(servers) | ||
180 | |||
181 | // Expire video channel | ||
182 | await wait(10000) | ||
183 | |||
184 | const search = 'http://localhost:9002/video-channels/channel1_server2' | ||
185 | await searchVideoChannel(servers[0].url, search, servers[0].accessToken) | ||
186 | |||
187 | await waitJobs(servers) | ||
188 | |||
189 | const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'channel1_server2@localhost:9002', 0, 5, '-createdAt') | ||
190 | |||
191 | expect(res.body.total).to.equal(2) | ||
192 | expect(res.body.data[0].name).to.equal('video 2 server 2') | ||
193 | expect(res.body.data[1].name).to.equal('video 1 updated') | ||
194 | }) | ||
195 | |||
154 | it('Should delete video channel of server 2, and delete it on server 1', async function () { | 196 | it('Should delete video channel of server 2, and delete it on server 1', async function () { |
155 | this.timeout(60000) | 197 | this.timeout(60000) |
156 | 198 | ||