diff options
Diffstat (limited to 'server/tests/api/users')
-rw-r--r-- | server/tests/api/users/user-subscriptions.ts | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts index 2fbda6828..cb7d94b0b 100644 --- a/server/tests/api/users/user-subscriptions.ts +++ b/server/tests/api/users/user-subscriptions.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import 'mocha' | 4 | import 'mocha' |
5 | import { createUser, doubleFollow, flushAndRunMultipleServers, follow, getVideosList, unfollow, userLogin } from '../../utils' | 5 | import { createUser, doubleFollow, flushAndRunMultipleServers, follow, getVideosList, unfollow, updateVideo, userLogin } from '../../utils' |
6 | import { killallServers, ServerInfo, uploadVideo } from '../../utils/index' | 6 | import { killallServers, ServerInfo, uploadVideo } from '../../utils/index' |
7 | import { setAccessTokensToServers } from '../../utils/users/login' | 7 | import { setAccessTokensToServers } from '../../utils/users/login' |
8 | import { Video, VideoChannel } from '../../../../shared/models/videos' | 8 | import { Video, VideoChannel } from '../../../../shared/models/videos' |
@@ -20,6 +20,7 @@ const expect = chai.expect | |||
20 | describe('Test users subscriptions', function () { | 20 | describe('Test users subscriptions', function () { |
21 | let servers: ServerInfo[] = [] | 21 | let servers: ServerInfo[] = [] |
22 | const users: { accessToken: string }[] = [] | 22 | const users: { accessToken: string }[] = [] |
23 | let video3UUID: string | ||
23 | 24 | ||
24 | before(async function () { | 25 | before(async function () { |
25 | this.timeout(120000) | 26 | this.timeout(120000) |
@@ -65,7 +66,8 @@ describe('Test users subscriptions', function () { | |||
65 | 66 | ||
66 | await waitJobs(servers) | 67 | await waitJobs(servers) |
67 | 68 | ||
68 | await uploadVideo(servers[2].url, users[2].accessToken, { name: 'video server 3 added after follow' }) | 69 | const res = await uploadVideo(servers[2].url, users[2].accessToken, { name: 'video server 3 added after follow' }) |
70 | video3UUID = res.body.video.uuid | ||
69 | 71 | ||
70 | await waitJobs(servers) | 72 | await waitJobs(servers) |
71 | }) | 73 | }) |
@@ -247,7 +249,21 @@ describe('Test users subscriptions', function () { | |||
247 | } | 249 | } |
248 | }) | 250 | }) |
249 | 251 | ||
252 | it('Should update a video of server 3 and see the updated video on server 1', async function () { | ||
253 | this.timeout(30000) | ||
254 | |||
255 | await updateVideo(servers[2].url, users[2].accessToken, video3UUID, { name: 'video server 3 added after follow updated' }) | ||
256 | |||
257 | await waitJobs(servers) | ||
258 | |||
259 | const res = await listUserSubscriptionVideos(servers[0].url, users[0].accessToken, 'createdAt') | ||
260 | const videos: Video[] = res.body.data | ||
261 | expect(videos[2].name).to.equal('video server 3 added after follow updated') | ||
262 | }) | ||
263 | |||
250 | it('Should remove user of server 3 subscription', async function () { | 264 | it('Should remove user of server 3 subscription', async function () { |
265 | this.timeout(30000) | ||
266 | |||
251 | await removeUserSubscription(servers[0].url, users[0].accessToken, 'user3_channel@localhost:9003') | 267 | await removeUserSubscription(servers[0].url, users[0].accessToken, 'user3_channel@localhost:9003') |
252 | 268 | ||
253 | await waitJobs(servers) | 269 | await waitJobs(servers) |
@@ -267,6 +283,8 @@ describe('Test users subscriptions', function () { | |||
267 | }) | 283 | }) |
268 | 284 | ||
269 | it('Should remove the root subscription and not display the videos anymore', async function () { | 285 | it('Should remove the root subscription and not display the videos anymore', async function () { |
286 | this.timeout(30000) | ||
287 | |||
270 | await removeUserSubscription(servers[0].url, users[0].accessToken, 'root_channel@localhost:9001') | 288 | await removeUserSubscription(servers[0].url, users[0].accessToken, 'root_channel@localhost:9001') |
271 | 289 | ||
272 | await waitJobs(servers) | 290 | await waitJobs(servers) |
@@ -288,7 +306,7 @@ describe('Test users subscriptions', function () { | |||
288 | for (const video of res.body.data) { | 306 | for (const video of res.body.data) { |
289 | expect(video.name).to.not.contain('1-3') | 307 | expect(video.name).to.not.contain('1-3') |
290 | expect(video.name).to.not.contain('2-3') | 308 | expect(video.name).to.not.contain('2-3') |
291 | expect(video.name).to.not.contain('video server 3 added after follow') | 309 | expect(video.name).to.not.contain('video server 3 added after follow updated') |
292 | } | 310 | } |
293 | }) | 311 | }) |
294 | 312 | ||
@@ -309,7 +327,7 @@ describe('Test users subscriptions', function () { | |||
309 | 327 | ||
310 | expect(videos[0].name).to.equal('video 1-3') | 328 | expect(videos[0].name).to.equal('video 1-3') |
311 | expect(videos[1].name).to.equal('video 2-3') | 329 | expect(videos[1].name).to.equal('video 2-3') |
312 | expect(videos[2].name).to.equal('video server 3 added after follow') | 330 | expect(videos[2].name).to.equal('video server 3 added after follow updated') |
313 | } | 331 | } |
314 | 332 | ||
315 | { | 333 | { |
@@ -319,7 +337,7 @@ describe('Test users subscriptions', function () { | |||
319 | for (const video of res.body.data) { | 337 | for (const video of res.body.data) { |
320 | expect(video.name).to.not.contain('1-3') | 338 | expect(video.name).to.not.contain('1-3') |
321 | expect(video.name).to.not.contain('2-3') | 339 | expect(video.name).to.not.contain('2-3') |
322 | expect(video.name).to.not.contain('video server 3 added after follow') | 340 | expect(video.name).to.not.contain('video server 3 added after follow updated') |
323 | } | 341 | } |
324 | } | 342 | } |
325 | }) | 343 | }) |