diff options
Diffstat (limited to 'server/tests/plugins/filter-hooks.ts')
-rw-r--r-- | server/tests/plugins/filter-hooks.ts | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index 2441940c3..cdde6cd30 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts | |||
@@ -31,6 +31,7 @@ import { cleanupTests, flushAndRunMultipleServers, ServerInfo } from '../../../s | |||
31 | import { getGoodVideoUrl, getMyVideoImports, importVideo } from '../../../shared/extra-utils/videos/video-imports' | 31 | import { getGoodVideoUrl, getMyVideoImports, importVideo } from '../../../shared/extra-utils/videos/video-imports' |
32 | import { VideoDetails, VideoImport, VideoImportState, VideoPrivacy } from '../../../shared/models/videos' | 32 | import { VideoDetails, VideoImport, VideoImportState, VideoPrivacy } from '../../../shared/models/videos' |
33 | import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model' | 33 | import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model' |
34 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
34 | 35 | ||
35 | const expect = chai.expect | 36 | const expect = chai.expect |
36 | 37 | ||
@@ -127,7 +128,7 @@ describe('Test plugin filter hooks', function () { | |||
127 | }) | 128 | }) |
128 | 129 | ||
129 | it('Should run filter:api.video.upload.accept.result', async function () { | 130 | it('Should run filter:api.video.upload.accept.result', async function () { |
130 | await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video with bad word' }, 403) | 131 | await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video with bad word' }, HttpStatusCode.FORBIDDEN_403) |
131 | }) | 132 | }) |
132 | 133 | ||
133 | it('Should run filter:api.live-video.create.accept.result', async function () { | 134 | it('Should run filter:api.live-video.create.accept.result', async function () { |
@@ -137,7 +138,7 @@ describe('Test plugin filter hooks', function () { | |||
137 | channelId: servers[0].videoChannel.id | 138 | channelId: servers[0].videoChannel.id |
138 | } | 139 | } |
139 | 140 | ||
140 | await createLive(servers[0].url, servers[0].accessToken, attributes, 403) | 141 | await createLive(servers[0].url, servers[0].accessToken, attributes, HttpStatusCode.FORBIDDEN_403) |
141 | }) | 142 | }) |
142 | 143 | ||
143 | it('Should run filter:api.video.pre-import-url.accept.result', async function () { | 144 | it('Should run filter:api.video.pre-import-url.accept.result', async function () { |
@@ -147,7 +148,7 @@ describe('Test plugin filter hooks', function () { | |||
147 | channelId: servers[0].videoChannel.id, | 148 | channelId: servers[0].videoChannel.id, |
148 | targetUrl: getGoodVideoUrl() + 'bad' | 149 | targetUrl: getGoodVideoUrl() + 'bad' |
149 | } | 150 | } |
150 | await importVideo(servers[0].url, servers[0].accessToken, baseAttributes, 403) | 151 | await importVideo(servers[0].url, servers[0].accessToken, baseAttributes, HttpStatusCode.FORBIDDEN_403) |
151 | }) | 152 | }) |
152 | 153 | ||
153 | it('Should run filter:api.video.pre-import-torrent.accept.result', async function () { | 154 | it('Should run filter:api.video.pre-import-torrent.accept.result', async function () { |
@@ -157,7 +158,7 @@ describe('Test plugin filter hooks', function () { | |||
157 | channelId: servers[0].videoChannel.id, | 158 | channelId: servers[0].videoChannel.id, |
158 | torrentfile: 'video-720p.torrent' as any | 159 | torrentfile: 'video-720p.torrent' as any |
159 | } | 160 | } |
160 | await importVideo(servers[0].url, servers[0].accessToken, baseAttributes, 403) | 161 | await importVideo(servers[0].url, servers[0].accessToken, baseAttributes, HttpStatusCode.FORBIDDEN_403) |
161 | }) | 162 | }) |
162 | 163 | ||
163 | it('Should run filter:api.video.post-import-url.accept.result', async function () { | 164 | it('Should run filter:api.video.post-import-url.accept.result', async function () { |
@@ -219,15 +220,22 @@ describe('Test plugin filter hooks', function () { | |||
219 | }) | 220 | }) |
220 | 221 | ||
221 | it('Should run filter:api.video-thread.create.accept.result', async function () { | 222 | it('Should run filter:api.video-thread.create.accept.result', async function () { |
222 | await addVideoCommentThread(servers[0].url, servers[0].accessToken, videoUUID, 'comment with bad word', 403) | 223 | await addVideoCommentThread(servers[0].url, servers[0].accessToken, videoUUID, 'comment with bad word', HttpStatusCode.FORBIDDEN_403) |
223 | }) | 224 | }) |
224 | 225 | ||
225 | it('Should run filter:api.video-comment-reply.create.accept.result', async function () { | 226 | it('Should run filter:api.video-comment-reply.create.accept.result', async function () { |
226 | const res = await addVideoCommentThread(servers[0].url, servers[0].accessToken, videoUUID, 'thread') | 227 | const res = await addVideoCommentThread(servers[0].url, servers[0].accessToken, videoUUID, 'thread') |
227 | threadId = res.body.comment.id | 228 | threadId = res.body.comment.id |
228 | 229 | ||
229 | await addVideoCommentReply(servers[0].url, servers[0].accessToken, videoUUID, threadId, 'comment with bad word', 403) | 230 | await addVideoCommentReply( |
230 | await addVideoCommentReply(servers[0].url, servers[0].accessToken, videoUUID, threadId, 'comment with good word', 200) | 231 | servers[0].url, |
232 | servers[0].accessToken, | ||
233 | videoUUID, | ||
234 | threadId, | ||
235 | 'comment with bad word', | ||
236 | HttpStatusCode.FORBIDDEN_403 | ||
237 | ) | ||
238 | await addVideoCommentReply(servers[0].url, servers[0].accessToken, videoUUID, threadId, 'comment with good word', HttpStatusCode.OK_200) | ||
231 | }) | 239 | }) |
232 | 240 | ||
233 | it('Should run filter:api.video-threads.list.params', async function () { | 241 | it('Should run filter:api.video-threads.list.params', async function () { |
@@ -326,7 +334,7 @@ describe('Test plugin filter hooks', function () { | |||
326 | }) | 334 | }) |
327 | 335 | ||
328 | it('Should not allow a signup', async function () { | 336 | it('Should not allow a signup', async function () { |
329 | const res = await registerUser(servers[0].url, 'jma', 'password', 403) | 337 | const res = await registerUser(servers[0].url, 'jma', 'password', HttpStatusCode.FORBIDDEN_403) |
330 | 338 | ||
331 | expect(res.body.error).to.equal('No jma') | 339 | expect(res.body.error).to.equal('No jma') |
332 | }) | 340 | }) |