aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/notifications/user-notifications.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-27 09:07:38 +0200
committerChocobozzz <me@florianbigard.com>2021-07-27 17:10:52 +0200
commit29837f8885eb37fa300e4b80c90a6d03ab337084 (patch)
treea7a066c6604c9adec4cb21c1bd1965c5bf253b03 /server/tests/api/notifications/user-notifications.ts
parent5d0095fde19d803bead7cbad0452bd09f3351adc (diff)
downloadPeerTube-29837f8885eb37fa300e4b80c90a6d03ab337084.tar.gz
PeerTube-29837f8885eb37fa300e4b80c90a6d03ab337084.tar.zst
PeerTube-29837f8885eb37fa300e4b80c90a6d03ab337084.zip
Add ability to search by host in server
Diffstat (limited to 'server/tests/api/notifications/user-notifications.ts')
-rw-r--r--server/tests/api/notifications/user-notifications.ts94
1 files changed, 56 insertions, 38 deletions
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index ca592d466..e53ab2aa5 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -74,8 +74,8 @@ describe('Test user notifications', function () {
74 await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[0].port }) 74 await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[0].port })
75 await waitJobs(servers) 75 await waitJobs(servers)
76 76
77 const { name, uuid } = await uploadRandomVideoOnServers(servers, 1) 77 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1)
78 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') 78 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
79 }) 79 })
80 80
81 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 () {
@@ -84,8 +84,8 @@ describe('Test user notifications', function () {
84 await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[1].port }) 84 await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@localhost:' + servers[1].port })
85 await waitJobs(servers) 85 await waitJobs(servers)
86 86
87 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2) 87 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2)
88 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') 88 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
89 }) 89 })
90 90
91 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 () {
@@ -101,10 +101,10 @@ describe('Test user notifications', function () {
101 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC 101 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC
102 } 102 }
103 } 103 }
104 const { name, uuid } = await uploadRandomVideoOnServers(servers, 1, data) 104 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1, data)
105 105
106 await wait(6000) 106 await wait(6000)
107 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') 107 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
108 }) 108 })
109 109
110 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 () {
@@ -120,11 +120,11 @@ describe('Test user notifications', function () {
120 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC 120 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC
121 } 121 }
122 } 122 }
123 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, data) 123 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2, data)
124 await waitJobs(servers) 124 await waitJobs(servers)
125 125
126 await wait(6000) 126 await wait(6000)
127 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') 127 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
128 }) 128 })
129 129
130 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 () {
@@ -139,61 +139,61 @@ describe('Test user notifications', function () {
139 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC 139 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC
140 } 140 }
141 } 141 }
142 const { name, uuid } = await uploadRandomVideoOnServers(servers, 1, data) 142 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1, data)
143 143
144 await wait(6000) 144 await wait(6000)
145 await checkNewVideoFromSubscription(baseParams, name, uuid, 'absence') 145 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'absence' })
146 }) 146 })
147 147
148 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 () {
149 this.timeout(50000) 149 this.timeout(50000)
150 150
151 const data = { privacy: VideoPrivacy.PRIVATE } 151 const data = { privacy: VideoPrivacy.PRIVATE }
152 const { name, uuid } = await uploadRandomVideoOnServers(servers, 1, data) 152 const { name, uuid, shortUUID } = await uploadRandomVideoOnServers(servers, 1, data)
153 153
154 await checkNewVideoFromSubscription(baseParams, name, uuid, 'absence') 154 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'absence' })
155 155
156 await servers[0].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.PUBLIC } }) 156 await servers[0].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.PUBLIC } })
157 157
158 await waitJobs(servers) 158 await waitJobs(servers)
159 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') 159 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
160 }) 160 })
161 161
162 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 () {
163 this.timeout(50000) 163 this.timeout(50000)
164 164
165 const data = { privacy: VideoPrivacy.PRIVATE } 165 const data = { privacy: VideoPrivacy.PRIVATE }
166 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, data) 166 const { name, uuid, shortUUID } = await uploadRandomVideoOnServers(servers, 2, data)
167 167
168 await checkNewVideoFromSubscription(baseParams, name, uuid, 'absence') 168 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'absence' })
169 169
170 await servers[1].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.PUBLIC } }) 170 await servers[1].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.PUBLIC } })
171 171
172 await waitJobs(servers) 172 await waitJobs(servers)
173 await checkNewVideoFromSubscription(baseParams, name, uuid, 'presence') 173 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
174 }) 174 })
175 175
176 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 () {
177 this.timeout(50000) 177 this.timeout(50000)
178 178
179 const data = { privacy: VideoPrivacy.PRIVATE } 179 const data = { privacy: VideoPrivacy.PRIVATE }
180 const { name, uuid } = await uploadRandomVideoOnServers(servers, 1, data) 180 const { name, uuid, shortUUID } = await uploadRandomVideoOnServers(servers, 1, data)
181 181
182 await servers[0].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.UNLISTED } }) 182 await servers[0].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.UNLISTED } })
183 183
184 await checkNewVideoFromSubscription(baseParams, name, uuid, 'absence') 184 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'absence' })
185 }) 185 })
186 186
187 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 () {
188 this.timeout(50000) 188 this.timeout(50000)
189 189
190 const data = { privacy: VideoPrivacy.PRIVATE } 190 const data = { privacy: VideoPrivacy.PRIVATE }
191 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, data) 191 const { name, uuid, shortUUID } = await uploadRandomVideoOnServers(servers, 2, data)
192 192
193 await servers[1].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.UNLISTED } }) 193 await servers[1].videos.update({ id: uuid, attributes: { privacy: VideoPrivacy.UNLISTED } })
194 194
195 await waitJobs(servers) 195 await waitJobs(servers)
196 await checkNewVideoFromSubscription(baseParams, name, uuid, 'absence') 196 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID, checkType: 'absence' })
197 }) 197 })
198 198
199 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 () {
@@ -211,7 +211,7 @@ describe('Test user notifications', function () {
211 211
212 await waitJobs(servers) 212 await waitJobs(servers)
213 213
214 await checkNewVideoFromSubscription(baseParams, name, video.uuid, 'presence') 214 await checkNewVideoFromSubscription({ ...baseParams, videoName: name, shortUUID: video.shortUUID, checkType: 'presence' })
215 }) 215 })
216 }) 216 })
217 217
@@ -230,10 +230,10 @@ describe('Test user notifications', function () {
230 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 () {
231 this.timeout(50000) 231 this.timeout(50000)
232 232
233 const { name, uuid } = await uploadRandomVideoOnServers(servers, 1) 233 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 1)
234 await waitJobs(servers) 234 await waitJobs(servers)
235 235
236 await checkVideoIsPublished(baseParams, name, uuid, 'absence') 236 await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID, checkType: 'absence' })
237 }) 237 })
238 238
239 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,19 +251,19 @@ describe('Test user notifications', function () {
251 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 () {
252 this.timeout(50000) 252 this.timeout(50000)
253 253
254 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' })
255 await waitJobs(servers) 255 await waitJobs(servers)
256 256
257 await checkVideoIsPublished(baseParams, name, uuid, 'presence') 257 await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
258 }) 258 })
259 259
260 it('Should send a notification with a transcoded video', async function () { 260 it('Should send a notification with a transcoded video', async function () {
261 this.timeout(50000) 261 this.timeout(50000)
262 262
263 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, { waitTranscoding: true }) 263 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2, { waitTranscoding: true })
264 await waitJobs(servers) 264 await waitJobs(servers)
265 265
266 await checkVideoIsPublished(baseParams, name, uuid, 'presence') 266 await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
267 }) 267 })
268 268
269 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 () {
@@ -281,7 +281,7 @@ describe('Test user notifications', function () {
281 const { video } = await servers[1].imports.importVideo({ attributes }) 281 const { video } = await servers[1].imports.importVideo({ attributes })
282 282
283 await waitJobs(servers) 283 await waitJobs(servers)
284 await checkVideoIsPublished(baseParams, name, video.uuid, 'presence') 284 await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID: video.shortUUID, checkType: 'presence' })
285 }) 285 })
286 286
287 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 () {
@@ -297,10 +297,10 @@ describe('Test user notifications', function () {
297 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC 297 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC
298 } 298 }
299 } 299 }
300 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, data) 300 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2, data)
301 301
302 await wait(6000) 302 await wait(6000)
303 await checkVideoIsPublished(baseParams, name, uuid, 'presence') 303 await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID, checkType: 'presence' })
304 }) 304 })
305 305
306 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 () {
@@ -315,10 +315,10 @@ describe('Test user notifications', function () {
315 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC 315 privacy: VideoPrivacy.PUBLIC as VideoPrivacy.PUBLIC
316 } 316 }
317 } 317 }
318 const { name, uuid } = await uploadRandomVideoOnServers(servers, 2, data) 318 const { name, shortUUID } = await uploadRandomVideoOnServers(servers, 2, data)
319 319
320 await wait(6000) 320 await wait(6000)
321 await checkVideoIsPublished(baseParams, name, uuid, 'absence') 321 await checkVideoIsPublished({ ...baseParams, videoName: name, shortUUID, checkType: 'absence' })
322 }) 322 })
323 }) 323 })
324 324
@@ -345,10 +345,12 @@ describe('Test user notifications', function () {
345 privacy: VideoPrivacy.PRIVATE, 345 privacy: VideoPrivacy.PRIVATE,
346 targetUrl: FIXTURE_URLS.badVideo 346 targetUrl: FIXTURE_URLS.badVideo
347 } 347 }
348 const { video } = await servers[0].imports.importVideo({ attributes }) 348 const { video: { shortUUID } } = await servers[0].imports.importVideo({ attributes })
349 349
350 await waitJobs(servers) 350 await waitJobs(servers)
351 await checkMyVideoImportIsFinished(baseParams, name, video.uuid, FIXTURE_URLS.badVideo, false, 'presence') 351
352 const url = FIXTURE_URLS.badVideo
353 await checkMyVideoImportIsFinished({ ...baseParams, videoName: name, shortUUID, url, success: false, checkType: 'presence' })
352 }) 354 })
353 355
354 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 () {
@@ -362,10 +364,12 @@ describe('Test user notifications', function () {
362 privacy: VideoPrivacy.PRIVATE, 364 privacy: VideoPrivacy.PRIVATE,
363 targetUrl: FIXTURE_URLS.goodVideo 365 targetUrl: FIXTURE_URLS.goodVideo
364 } 366 }
365 const { video } = await servers[0].imports.importVideo({ attributes }) 367 const { video: { shortUUID } } = await servers[0].imports.importVideo({ attributes })
366 368
367 await waitJobs(servers) 369 await waitJobs(servers)
368 await checkMyVideoImportIsFinished(baseParams, name, video.uuid, FIXTURE_URLS.goodVideo, true, 'presence') 370
371 const url = FIXTURE_URLS.goodVideo
372 await checkMyVideoImportIsFinished({ ...baseParams, videoName: name, shortUUID, url, success: true, checkType: 'presence' })
369 }) 373 })
370 }) 374 })
371 375
@@ -404,7 +408,14 @@ describe('Test user notifications', function () {
404 await servers[0].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port }) 408 await servers[0].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port })
405 await waitJobs(servers) 409 await waitJobs(servers)
406 410
407 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 })
408 419
409 await servers[0].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port }) 420 await servers[0].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port })
410 }) 421 })
@@ -415,7 +426,14 @@ describe('Test user notifications', function () {
415 await servers[1].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port }) 426 await servers[1].subscriptions.add({ targetUri: 'user_1_channel@localhost:' + servers[0].port })
416 await waitJobs(servers) 427 await waitJobs(servers)
417 428
418 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 })
419 437
420 await servers[1].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port }) 438 await servers[1].subscriptions.remove({ uri: 'user_1_channel@localhost:' + servers[0].port })
421 }) 439 })