aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/notifications/user-notifications.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/notifications/user-notifications.ts')
-rw-r--r--server/tests/api/notifications/user-notifications.ts197
1 files changed, 99 insertions, 98 deletions
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index e981c1718..e53ab2aa5 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -4,34 +4,26 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { buildUUID } from '@server/helpers/uuid' 5import { buildUUID } from '@server/helpers/uuid'
6import { 6import {
7 cleanupTests,
8 updateMyUser,
9 updateVideo,
10 updateVideoChannel,
11 uploadRandomVideoOnServers,
12 wait
13} from '../../../../shared/extra-utils'
14import { ServerInfo } from '../../../../shared/extra-utils/index'
15import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email'
16import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
17import {
18 CheckerBaseParams, 7 CheckerBaseParams,
19 checkMyVideoImportIsFinished, 8 checkMyVideoImportIsFinished,
20 checkNewActorFollow, 9 checkNewActorFollow,
21 checkNewVideoFromSubscription, 10 checkNewVideoFromSubscription,
22 checkVideoIsPublished, 11 checkVideoIsPublished,
23 getLastNotification, 12 cleanupTests,
24 prepareNotificationsTest 13 FIXTURE_URLS,
25} from '../../../../shared/extra-utils/users/user-notifications' 14 MockSmtpServer,
26import { addUserSubscription, removeUserSubscription } from '../../../../shared/extra-utils/users/user-subscriptions' 15 PeerTubeServer,
27import { getBadVideoUrl, getGoodVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports' 16 prepareNotificationsTest,
28import { UserNotification, UserNotificationType } from '../../../../shared/models/users' 17 uploadRandomVideoOnServers,
29import { VideoPrivacy } from '../../../../shared/models/videos' 18 wait,
19 waitJobs
20} from '@shared/extra-utils'
21import { UserNotification, UserNotificationType, VideoPrivacy } from '@shared/models'
30 22
31const expect = chai.expect 23const expect = chai.expect
32 24
33describe('Test user notifications', function () { 25describe('Test user notifications', function () {
34 let servers: ServerInfo[] = [] 26 let servers: PeerTubeServer[] = []
35 let userAccessToken: string 27 let userAccessToken: string
36 let userNotifications: UserNotification[] = [] 28 let userNotifications: UserNotification[] = []
37 let adminNotifications: UserNotification[] = [] 29 let adminNotifications: UserNotification[] = []
@@ -69,7 +61,7 @@ describe('Test user notifications', function () {
69 61
70 await uploadRandomVideoOnServers(servers, 1) 62 await uploadRandomVideoOnServers(servers, 1)
71 63
72 const notification = await getLastNotification(servers[0].url, userAccessToken) 64 const notification = await servers[0].notifications.getLastest({ token: userAccessToken })
73 expect(notification).to.be.undefined 65 expect(notification).to.be.undefined
74 66
75 expect(emails).to.have.lengthOf(0) 67 expect(emails).to.have.lengthOf(0)
@@ -79,21 +71,21 @@ describe('Test user notifications', function () {
79 it('Should send a new video notification if the user follows the local video publisher', async function () { 71 it('Should send a new video notification if the user follows the local video publisher', async function () {
80 this.timeout(15000) 72 this.timeout(15000)
81 73
82 await addUserSubscription(servers[0].url, userAccessToken, 'root_channel@localhost:' + servers[0].port) 74 await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[0].port })
83 await waitJobs(servers) 75 await waitJobs(servers)
84 76
85 const { name, uuid } = await uploadRandomVideoOnServers(servers, 1) 77 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1)
86 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') 78 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
87 }) 79 })
88 80
89 it('Should send a new video notification from a remote account', async function () { 81 it('Should send a new video notification from a remote account', async function () {
90 this.timeout(150000) // Server 2 has transcoding enabled 82 this.timeout(150000) // Server 2 has transcoding enabled
91 83
92 await addUserSubscription(servers[0].url, userAccessToken, 'root_channel@localhost:' + servers[1].port) 84 await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[1].port })
93 await waitJobs(servers) 85 await waitJobs(servers)
94 86
95 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2) 87 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2)
96 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') 88 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
97 }) 89 })
98 90
99 it('Should send a new video notification on a scheduled publication', async function () { 91 it('Should send a new video notification on a scheduled publication', async function () {
@@ -106,13 +98,13 @@ describe('Test user notifications', function () {
106 privacy: VideoPrivacy.PRIVATE, 98 privacy: VideoPrivacy.PRIVATE,
107 scheduleUpdate: { 99 scheduleUpdate: {
108 updateAt: updateAt.toISOString(), 100 updateAt: updateAt.toISOString(),
109 privacy: VideoPrivacy.PUBLIC 101 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC
110 } 102 }
111 } 103 }
112 const { name, uuid } = await uploadRandomVideoOnServers(servers, 1, data) 104 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1, data)
113 105
114 await wait(6000) 106 await wait(6000)
115 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') 107 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
116 }) 108 })
117 109
118 it('Should send a new video notification on a remote scheduled publication', async function () { 110 it('Should send a new video notification on a remote scheduled publication', async function () {
@@ -125,14 +117,14 @@ describe('Test user notifications', function () {
125 privacy: VideoPrivacy.PRIVATE, 117 privacy: VideoPrivacy.PRIVATE,
126 scheduleUpdate: { 118 scheduleUpdate: {
127 updateAt: updateAt.toISOString(), 119 updateAt: updateAt.toISOString(),
128 privacy: VideoPrivacy.PUBLIC 120 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC
129 } 121 }
130 } 122 }
131 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, data) 123 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2, data)
132 await waitJobs(servers) 124 await waitJobs(servers)
133 125
134 await wait(6000) 126 await wait(6000)
135 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') 127 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
136 }) 128 })
137 129
138 it('Should not send a notification before the video is published', async function () { 130 it('Should not send a notification before the video is published', async function () {
@@ -144,64 +136,64 @@ describe('Test user notifications', function () {
144 privacy: VideoPrivacy.PRIVATE, 136 privacy: VideoPrivacy.PRIVATE,
145 scheduleUpdate: { 137 scheduleUpdate: {
146 updateAt: updateAt.toISOString(), 138 updateAt: updateAt.toISOString(),
147 privacy: VideoPrivacy.PUBLIC 139 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC
148 } 140 }
149 } 141 }
150 const { name, uuid } = await uploadRandomVideoOnServers(servers, 1, data) 142 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1, data)
151 143
152 await wait(6000) 144 await wait(6000)
153 await checkNewVideoFromSubscription(baseParams, name, uuid, 'absence') 145 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'absence' })
154 }) 146 })
155 147
156 it('Should send a new video notification when a video becomes public', async function () { 148 it('Should send a new video notification when a video becomes public', async function () {
157 this.timeout(50000) 149 this.timeout(50000)
158 150
159 const data = { privacy: VideoPrivacy.PRIVATE } 151 const data = { privacy: VideoPrivacy.PRIVATE }
160 const { name, uuid } = await uploadRandomVideoOnServers(servers, 1, data) 152 const { name, uuid, shortUUID } = await uploadRandomVideoOnServers(servers, 1, data)
161 153
162 await checkNewVideoFromSubscription(baseParams, name, uuid, 'absence') 154 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'absence' })
163 155
164 await updateVideo(servers[0].url, servers[0].accessToken, uuid, { privacy: VideoPrivacy.PUBLIC }) 156 await servers[0].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.PUBLIC } })
165 157
166 await waitJobs(servers) 158 await waitJobs(servers)
167 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') 159 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
168 }) 160 })
169 161
170 it('Should send a new video notification when a remote video becomes public', async function () { 162 it('Should send a new video notification when a remote video becomes public', async function () {
171 this.timeout(50000) 163 this.timeout(50000)
172 164
173 const data = { privacy: VideoPrivacy.PRIVATE } 165 const data = { privacy: VideoPrivacy.PRIVATE }
174 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, data) 166 const { name, uuid, shortUUID } = await uploadRandomVideoOnServers(servers, 2, data)
175 167
176 await checkNewVideoFromSubscription(baseParams, name, uuid, 'absence') 168 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'absence' })
177 169
178 await updateVideo(servers[1].url, servers[1].accessToken, uuid, { privacy: VideoPrivacy.PUBLIC }) 170 await servers[1].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.PUBLIC } })
179 171
180 await waitJobs(servers) 172 await waitJobs(servers)
181 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') 173 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
182 }) 174 })
183 175
184 it('Should not send a new video notification when a video becomes unlisted', async function () { 176 it('Should not send a new video notification when a video becomes unlisted', async function () {
185 this.timeout(50000) 177 this.timeout(50000)
186 178
187 const data = { privacy: VideoPrivacy.PRIVATE } 179 const data = { privacy: VideoPrivacy.PRIVATE }
188 const { name, uuid } = await uploadRandomVideoOnServers(servers, 1, data) 180 const { name, uuid, shortUUID } = await uploadRandomVideoOnServers(servers, 1, data)
189 181
190 await updateVideo(servers[0].url, servers[0].accessToken, uuid, { privacy: VideoPrivacy.UNLISTED }) 182 await servers[0].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.UNLISTED } })
191 183
192 await checkNewVideoFromSubscription(baseParams, name, uuid, 'absence') 184 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'absence' })
193 }) 185 })
194 186
195 it('Should not send a new video notification when a remote video becomes unlisted', async function () { 187 it('Should not send a new video notification when a remote video becomes unlisted', async function () {
196 this.timeout(50000) 188 this.timeout(50000)
197 189
198 const data = { privacy: VideoPrivacy.PRIVATE } 190 const data = { privacy: VideoPrivacy.PRIVATE }
199 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, data) 191 const { name, uuid, shortUUID } = await uploadRandomVideoOnServers(servers, 2, data)
200 192
201 await updateVideo(servers[1].url, servers[1].accessToken, uuid, { privacy: VideoPrivacy.UNLISTED }) 193 await servers[1].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.UNLISTED } })
202 194
203 await waitJobs(servers) 195 await waitJobs(servers)
204 await checkNewVideoFromSubscription(baseParams, name, uuid, 'absence') 196 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'absence' })
205 }) 197 })
206 198
207 it('Should send a new video notification after a video import', async function () { 199 it('Should send a new video notification after a video import', async function () {
@@ -213,14 +205,13 @@ describe('Test user notifications', function () {
213 name, 205 name,
214 channelId, 206 channelId,
215 privacy: VideoPrivacy.PUBLIC, 207 privacy: VideoPrivacy.PUBLIC,
216 targetUrl: getGoodVideoUrl() 208 targetUrl: FIXTURE_URLS.goodVideo
217 } 209 }
218 const res = await importVideo(servers[0].url, servers[0].accessToken, attributes) 210 const { video } = await servers[0].imports.importVideo({ attributes })
219 const uuid = res.body.video.uuid
220 211
221 await waitJobs(servers) 212 await waitJobs(servers)
222 213
223 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') 214 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID: video.shortUUID, checkType: 'presence' })
224 }) 215 })
225 }) 216 })
226 217
@@ -239,10 +230,10 @@ describe('Test user notifications', function () {
239 it('Should not send a notification if transcoding is not enabled', async function () { 230 it('Should not send a notification if transcoding is not enabled', async function () {
240 this.timeout(50000) 231 this.timeout(50000)
241 232
242 const { name, uuid } = await uploadRandomVideoOnServers(servers, 1) 233 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1)
243 await waitJobs(servers) 234 await waitJobs(servers)
244 235
245 await checkVideoIsPublished(baseParams, name, uuid, 'absence') 236 await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID, checkType: 'absence' })
246 }) 237 })
247 238
248 it('Should not send a notification if the wait transcoding is false', async function () { 239 it('Should not send a notification if the wait transcoding is false', async function () {
@@ -251,7 +242,7 @@ describe('Test user notifications', function () {
251 await uploadRandomVideoOnServers(servers, 2, { waitTranscoding: false }) 242 await uploadRandomVideoOnServers(servers, 2, { waitTranscoding: false })
252 await waitJobs(servers) 243 await waitJobs(servers)
253 244
254 const notification = await getLastNotification(servers[0].url, userAccessToken) 245 const notification = await servers[0].notifications.getLastest({ token: userAccessToken })
255 if (notification) { 246 if (notification) {
256 expect(notification.type).to.not.equal(UserNotificationType.MY_VIDEO_PUBLISHED) 247 expect(notification.type).to.not.equal(UserNotificationType.MY_VIDEO_PUBLISHED)
257 } 248 }
@@ -260,19 +251,19 @@ describe('Test user notifications', function () {
260 it('Should send a notification even if the video is not transcoded in other resolutions', async function () { 251 it('Should send a notification even if the video is not transcoded in other resolutions', async function () {
261 this.timeout(50000) 252 this.timeout(50000)
262 253
263 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, { waitTranscoding: true, fixture: 'video_short_240p.mp4' }) 254 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2, { waitTranscoding: true, fixture: 'video_short_240p.mp4' })
264 await waitJobs(servers) 255 await waitJobs(servers)
265 256
266 await checkVideoIsPublished(baseParams, name, uuid, 'presence') 257 await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
267 }) 258 })
268 259
269 it('Should send a notification with a transcoded video', async function () { 260 it('Should send a notification with a transcoded video', async function () {
270 this.timeout(50000) 261 this.timeout(50000)
271 262
272 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, { waitTranscoding: true }) 263 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2, { waitTranscoding: true })
273 await waitJobs(servers) 264 await waitJobs(servers)
274 265
275 await checkVideoIsPublished(baseParams, name, uuid, 'presence') 266 await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
276 }) 267 })
277 268
278 it('Should send a notification when an imported video is transcoded', async function () { 269 it('Should send a notification when an imported video is transcoded', async function () {
@@ -284,14 +275,13 @@ describe('Test user notifications', function () {
284 name, 275 name,
285 channelId, 276 channelId,
286 privacy: VideoPrivacy.PUBLIC, 277 privacy: VideoPrivacy.PUBLIC,
287 targetUrl: getGoodVideoUrl(), 278 targetUrl: FIXTURE_URLS.goodVideo,
288 waitTranscoding: true 279 waitTranscoding: true
289 } 280 }
290 const res = await importVideo(servers[1].url, servers[1].accessToken, attributes) 281 const { video } = await servers[1].imports.importVideo({ attributes })
291 const uuid = res.body.video.uuid
292 282
293 await waitJobs(servers) 283 await waitJobs(servers)
294 await checkVideoIsPublished(baseParams, name, uuid, 'presence') 284 await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID: video.shortUUID, checkType: 'presence' })
295 }) 285 })
296 286
297 it('Should send a notification when the scheduled update has been proceeded', async function () { 287 it('Should send a notification when the scheduled update has been proceeded', async function () {
@@ -304,13 +294,13 @@ describe('Test user notifications', function () {
304 privacy: VideoPrivacy.PRIVATE, 294 privacy: VideoPrivacy.PRIVATE,
305 scheduleUpdate: { 295 scheduleUpdate: {
306 updateAt: updateAt.toISOString(), 296 updateAt: updateAt.toISOString(),
307 privacy: VideoPrivacy.PUBLIC 297 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC
308 } 298 }
309 } 299 }
310 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, data) 300 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2, data)
311 301
312 await wait(6000) 302 await wait(6000)
313 await checkVideoIsPublished(baseParams, name, uuid, 'presence') 303 await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
314 }) 304 })
315 305
316 it('Should not send a notification before the video is published', async function () { 306 it('Should not send a notification before the video is published', async function () {
@@ -322,13 +312,13 @@ describe('Test user notifications', function () {
322 privacy: VideoPrivacy.PRIVATE, 312 privacy: VideoPrivacy.PRIVATE,
323 scheduleUpdate: { 313 scheduleUpdate: {
324 updateAt: updateAt.toISOString(), 314 updateAt: updateAt.toISOString(),
325 privacy: VideoPrivacy.PUBLIC 315 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC
326 } 316 }
327 } 317 }
328 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, data) 318 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2, data)
329 319
330 await wait(6000) 320 await wait(6000)
331 await checkVideoIsPublished(baseParams, name, uuid, 'absence') 321 await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID, checkType: 'absence' })
332 }) 322 })
333 }) 323 })
334 324
@@ -353,13 +343,14 @@ describe('Test user notifications', function () {
353 name, 343 name,
354 channelId, 344 channelId,
355 privacy: VideoPrivacy.PRIVATE, 345 privacy: VideoPrivacy.PRIVATE,
356 targetUrl: getBadVideoUrl() 346 targetUrl: FIXTURE_URLS.badVideo
357 } 347 }
358 const res = await importVideo(servers[0].url, servers[0].accessToken, attributes) 348 const { video: { shortUUID } } = await servers[0].imports.importVideo({ attributes })
359 const uuid = res.body.video.uuid
360 349
361 await waitJobs(servers) 350 await waitJobs(servers)
362 await checkMyVideoImportIsFinished(baseParams, name, uuid, getBadVideoUrl(), false, 'presence') 351
352 const url = FIXTURE_URLS.badVideo
353 await checkMyVideoImportIsFinished({ ...baseParams, videoName: name, shortUUID, url, success: false, checkType: 'presence' })
363 }) 354 })
364 355
365 it('Should send a notification when the video import succeeded', async function () { 356 it('Should send a notification when the video import succeeded', async function () {
@@ -371,13 +362,14 @@ describe('Test user notifications', function () {
371 name, 362 name,
372 channelId, 363 channelId,
373 privacy: VideoPrivacy.PRIVATE, 364 privacy: VideoPrivacy.PRIVATE,
374 targetUrl: getGoodVideoUrl() 365 targetUrl: FIXTURE_URLS.goodVideo
375 } 366 }
376 const res = await importVideo(servers[0].url, servers[0].accessToken, attributes) 367 const { video: { shortUUID } } = await servers[0].imports.importVideo({ attributes })
377 const uuid = res.body.video.uuid
378 368
379 await waitJobs(servers) 369 await waitJobs(servers)
380 await checkMyVideoImportIsFinished(baseParams, name, uuid, getGoodVideoUrl(), true, 'presence') 370
371 const url = FIXTURE_URLS.goodVideo
372 await checkMyVideoImportIsFinished({ ...baseParams, videoName: name, shortUUID, url, success: true, checkType: 'presence' })
381 }) 373 })
382 }) 374 })
383 375
@@ -394,47 +386,56 @@ describe('Test user notifications', function () {
394 token: userAccessToken 386 token: userAccessToken
395 } 387 }
396 388
397 await updateMyUser({ 389 await servers[0].users.updateMe({ displayName: 'super root name' })
398 url: servers[0].url,
399 accessToken: servers[0].accessToken,
400 displayName: 'super root name'
401 })
402 390
403 await updateMyUser({ 391 await servers[0].users.updateMe({
404 url: servers[0].url, 392 token: userAccessToken,
405 accessToken: userAccessToken,
406 displayName: myUserName 393 displayName: myUserName
407 }) 394 })
408 395
409 await updateMyUser({ 396 await servers[1].users.updateMe({ displayName: 'super root 2 name' })
410 url: servers[1].url,
411 accessToken: servers[1].accessToken,
412 displayName: 'super root 2 name'
413 })
414 397
415 await updateVideoChannel(servers[0].url, userAccessToken, 'user_1_channel', { displayName: myChannelName }) 398 await servers[0].channels.update({
399 token: userAccessToken,
400 channelName: 'user_1_channel',
401 attributes: { displayName: myChannelName }
402 })
416 }) 403 })
417 404
418 it('Should notify when a local channel is following one of our channel', async function () { 405 it('Should notify when a local channel is following one of our channel', async function () {
419 this.timeout(50000) 406 this.timeout(50000)
420 407
421 await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port) 408 await servers[0].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port })
422 await waitJobs(servers) 409 await waitJobs(servers)
423 410
424 await checkNewActorFollow(baseParams, 'channel', 'root', 'super root name', myChannelName, 'presence') 411 await checkNewActorFollow({
412 ...baseParams,
413 followType: 'channel',
414 followerName: 'root',
415 followerDisplayName: 'super root name',
416 followingDisplayName: myChannelName,
417 checkType: 'presence'
418 })
425 419
426 await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port) 420 await servers[0].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port })
427 }) 421 })
428 422
429 it('Should notify when a remote channel is following one of our channel', async function () { 423 it('Should notify when a remote channel is following one of our channel', async function () {
430 this.timeout(50000) 424 this.timeout(50000)
431 425
432 await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port) 426 await servers[1].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port })
433 await waitJobs(servers) 427 await waitJobs(servers)
434 428
435 await checkNewActorFollow(baseParams, 'channel', 'root', 'super root 2 name', myChannelName, 'presence') 429 await checkNewActorFollow({
430 ...baseParams,
431 followType: 'channel',
432 followerName: 'root',
433 followerDisplayName: 'super root 2 name',
434 followingDisplayName: myChannelName,
435 checkType: 'presence'
436 })
436 437
437 await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port) 438 await servers[1].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port })
438 }) 439 })
439 440
440 // PeerTube does not support accout -> account follows 441 // PeerTube does not support accout -> account follows