diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-28 17:30:59 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-06-29 14:56:35 +0200 |
commit | d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb (patch) | |
tree | a4cb07318100031951c3dffc61f4f2cb95d2cbd0 /server/tests/api/notifications/moderation-notifications.ts | |
parent | 62ddc31a9e4b92d7d27898ccfc363f68ab044139 (diff) | |
download | PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.gz PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.zst PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.zip |
Support short uuid for GET video/playlist
Diffstat (limited to 'server/tests/api/notifications/moderation-notifications.ts')
-rw-r--r-- | server/tests/api/notifications/moderation-notifications.ts | 30 |
1 files changed, 15 insertions, 15 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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { v4 as uuidv4 } from 'uuid' | 4 | import { buildUUID } from '@server/helpers/uuid' |
5 | import { AbuseState } from '@shared/models' | 5 | import { AbuseState } from '@shared/models' |
6 | import { | 6 | import { |
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 }) |