aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/notifications
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-28 17:30:59 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-06-29 14:56:35 +0200
commitd4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb (patch)
treea4cb07318100031951c3dffc61f4f2cb95d2cbd0 /server/tests/api/notifications
parent62ddc31a9e4b92d7d27898ccfc363f68ab044139 (diff)
downloadPeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.gz
PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.zst
PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.zip
Support short uuid for GET video/playlist
Diffstat (limited to 'server/tests/api/notifications')
-rw-r--r--server/tests/api/notifications/moderation-notifications.ts30
-rw-r--r--server/tests/api/notifications/user-notifications.ts10
2 files changed, 20 insertions, 20 deletions
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts
index 4ce6675b6..3425480ae 100644
--- a/server/tests/api/notifications/moderation-notifications.ts
+++ b/server/tests/api/notifications/moderation-notifications.ts
@@ -1,7 +1,7 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { v4 as uuidv4 } from 'uuid' 4import { buildUUID } from '@server/helpers/uuid'
5import { AbuseState } from '@shared/models' 5import { AbuseState } from '@shared/models'
6import { 6import {
7 addAbuseMessage, 7 addAbuseMessage,
@@ -85,7 +85,7 @@ describe('Test moderation notifications', function () {
85 it('Should send a notification to moderators on local video abuse', async function () { 85 it('Should send a notification to moderators on local video abuse', async function () {
86 this.timeout(20000) 86 this.timeout(20000)
87 87
88 const name = 'video for abuse ' + uuidv4() 88 const name = 'video for abuse ' + buildUUID()
89 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name }) 89 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
90 const video = resVideo.body.video 90 const video = resVideo.body.video
91 91
@@ -98,7 +98,7 @@ describe('Test moderation notifications', function () {
98 it('Should send a notification to moderators on remote video abuse', async function () { 98 it('Should send a notification to moderators on remote video abuse', async function () {
99 this.timeout(20000) 99 this.timeout(20000)
100 100
101 const name = 'video for abuse ' + uuidv4() 101 const name = 'video for abuse ' + buildUUID()
102 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name }) 102 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
103 const video = resVideo.body.video 103 const video = resVideo.body.video
104 104
@@ -114,10 +114,10 @@ describe('Test moderation notifications', function () {
114 it('Should send a notification to moderators on local comment abuse', async function () { 114 it('Should send a notification to moderators on local comment abuse', async function () {
115 this.timeout(20000) 115 this.timeout(20000)
116 116
117 const name = 'video for abuse ' + uuidv4() 117 const name = 'video for abuse ' + buildUUID()
118 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name }) 118 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
119 const video = resVideo.body.video 119 const video = resVideo.body.video
120 const resComment = await addVideoCommentThread(servers[0].url, userAccessToken, video.id, 'comment abuse ' + uuidv4()) 120 const resComment = await addVideoCommentThread(servers[0].url, userAccessToken, video.id, 'comment abuse ' + buildUUID())
121 const comment = resComment.body.comment 121 const comment = resComment.body.comment
122 122
123 await waitJobs(servers) 123 await waitJobs(servers)
@@ -131,10 +131,10 @@ describe('Test moderation notifications', function () {
131 it('Should send a notification to moderators on remote comment abuse', async function () { 131 it('Should send a notification to moderators on remote comment abuse', async function () {
132 this.timeout(20000) 132 this.timeout(20000)
133 133
134 const name = 'video for abuse ' + uuidv4() 134 const name = 'video for abuse ' + buildUUID()
135 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name }) 135 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
136 const video = resVideo.body.video 136 const video = resVideo.body.video
137 await addVideoCommentThread(servers[0].url, userAccessToken, video.id, 'comment abuse ' + uuidv4()) 137 await addVideoCommentThread(servers[0].url, userAccessToken, video.id, 'comment abuse ' + buildUUID())
138 138
139 await waitJobs(servers) 139 await waitJobs(servers)
140 140
@@ -188,7 +188,7 @@ describe('Test moderation notifications', function () {
188 token: userAccessToken 188 token: userAccessToken
189 } 189 }
190 190
191 const name = 'abuse ' + uuidv4() 191 const name = 'abuse ' + buildUUID()
192 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name }) 192 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
193 const video = resVideo.body.video 193 const video = resVideo.body.video
194 194
@@ -236,7 +236,7 @@ describe('Test moderation notifications', function () {
236 token: servers[0].accessToken 236 token: servers[0].accessToken
237 } 237 }
238 238
239 const name = 'abuse ' + uuidv4() 239 const name = 'abuse ' + buildUUID()
240 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name }) 240 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
241 const video = resVideo.body.video 241 const video = resVideo.body.video
242 242
@@ -307,7 +307,7 @@ describe('Test moderation notifications', function () {
307 it('Should send a notification to video owner on blacklist', async function () { 307 it('Should send a notification to video owner on blacklist', async function () {
308 this.timeout(10000) 308 this.timeout(10000)
309 309
310 const name = 'video for abuse ' + uuidv4() 310 const name = 'video for abuse ' + buildUUID()
311 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name }) 311 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
312 const uuid = resVideo.body.video.uuid 312 const uuid = resVideo.body.video.uuid
313 313
@@ -320,7 +320,7 @@ describe('Test moderation notifications', function () {
320 it('Should send a notification to video owner on unblacklist', async function () { 320 it('Should send a notification to video owner on unblacklist', async function () {
321 this.timeout(10000) 321 this.timeout(10000)
322 322
323 const name = 'video for abuse ' + uuidv4() 323 const name = 'video for abuse ' + buildUUID()
324 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name }) 324 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
325 const uuid = resVideo.body.video.uuid 325 const uuid = resVideo.body.video.uuid
326 326
@@ -507,7 +507,7 @@ describe('Test moderation notifications', function () {
507 it('Should send notification to moderators on new video with auto-blacklist', async function () { 507 it('Should send notification to moderators on new video with auto-blacklist', async function () {
508 this.timeout(40000) 508 this.timeout(40000)
509 509
510 videoName = 'video with auto-blacklist ' + uuidv4() 510 videoName = 'video with auto-blacklist ' + buildUUID()
511 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: videoName }) 511 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: videoName })
512 videoUUID = resVideo.body.video.uuid 512 videoUUID = resVideo.body.video.uuid
513 513
@@ -553,7 +553,7 @@ describe('Test moderation notifications', function () {
553 553
554 const updateAt = new Date(new Date().getTime() + 1000000) 554 const updateAt = new Date(new Date().getTime() + 1000000)
555 555
556 const name = 'video with auto-blacklist and future schedule ' + uuidv4() 556 const name = 'video with auto-blacklist and future schedule ' + buildUUID()
557 557
558 const data = { 558 const data = {
559 name, 559 name,
@@ -586,7 +586,7 @@ describe('Test moderation notifications', function () {
586 // In 2 seconds 586 // In 2 seconds
587 const updateAt = new Date(new Date().getTime() + 2000) 587 const updateAt = new Date(new Date().getTime() + 2000)
588 588
589 const name = 'video with schedule done and still auto-blacklisted ' + uuidv4() 589 const name = 'video with schedule done and still auto-blacklisted ' + buildUUID()
590 590
591 const data = { 591 const data = {
592 name, 592 name,
@@ -609,7 +609,7 @@ describe('Test moderation notifications', function () {
609 it('Should not send a notification to moderators on new video without auto-blacklist', async function () { 609 it('Should not send a notification to moderators on new video without auto-blacklist', async function () {
610 this.timeout(60000) 610 this.timeout(60000)
611 611
612 const name = 'video without auto-blacklist ' + uuidv4() 612 const name = 'video without auto-blacklist ' + buildUUID()
613 613
614 // admin with blacklist right will not be auto-blacklisted 614 // admin with blacklist right will not be auto-blacklisted
615 const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name }) 615 const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name })
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index 7e88d979b..e981c1718 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { v4 as uuidv4 } from 'uuid' 5import { buildUUID } from '@server/helpers/uuid'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 updateMyUser, 8 updateMyUser,
@@ -207,7 +207,7 @@ describe('Test user notifications', function () {
207 it('Should send a new video notification after a video import', async function () { 207 it('Should send a new video notification after a video import', async function () {
208 this.timeout(100000) 208 this.timeout(100000)
209 209
210 const name = 'video import ' + uuidv4() 210 const name = 'video import ' + buildUUID()
211 211
212 const attributes = { 212 const attributes = {
213 name, 213 name,
@@ -278,7 +278,7 @@ describe('Test user notifications', function () {
278 it('Should send a notification when an imported video is transcoded', async function () { 278 it('Should send a notification when an imported video is transcoded', async function () {
279 this.timeout(50000) 279 this.timeout(50000)
280 280
281 const name = 'video import ' + uuidv4() 281 const name = 'video import ' + buildUUID()
282 282
283 const attributes = { 283 const attributes = {
284 name, 284 name,
@@ -347,7 +347,7 @@ describe('Test user notifications', function () {
347 it('Should send a notification when the video import failed', async function () { 347 it('Should send a notification when the video import failed', async function () {
348 this.timeout(70000) 348 this.timeout(70000)
349 349
350 const name = 'video import ' + uuidv4() 350 const name = 'video import ' + buildUUID()
351 351
352 const attributes = { 352 const attributes = {
353 name, 353 name,
@@ -365,7 +365,7 @@ describe('Test user notifications', function () {
365 it('Should send a notification when the video import succeeded', async function () { 365 it('Should send a notification when the video import succeeded', async function () {
366 this.timeout(70000) 366 this.timeout(70000)
367 367
368 const name = 'video import ' + uuidv4() 368 const name = 'video import ' + buildUUID()
369 369
370 const attributes = { 370 const attributes = {
371 name, 371 name,