aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/plugins')
-rw-r--r--server/tests/plugins/filter-hooks.ts24
-rw-r--r--server/tests/plugins/video-constants.ts10
2 files changed, 24 insertions, 10 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
31import { getGoodVideoUrl, getMyVideoImports, importVideo } from '../../../shared/extra-utils/videos/video-imports' 31import { getGoodVideoUrl, getMyVideoImports, importVideo } from '../../../shared/extra-utils/videos/video-imports'
32import { VideoDetails, VideoImport, VideoImportState, VideoPrivacy } from '../../../shared/models/videos' 32import { VideoDetails, VideoImport, VideoImportState, VideoPrivacy } from '../../../shared/models/videos'
33import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model' 33import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model'
34import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
34 35
35const expect = chai.expect 36const 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 })
diff --git a/server/tests/plugins/video-constants.ts b/server/tests/plugins/video-constants.ts
index fec9196e2..5ee41fee1 100644
--- a/server/tests/plugins/video-constants.ts
+++ b/server/tests/plugins/video-constants.ts
@@ -16,6 +16,7 @@ import {
16 uploadVideo 16 uploadVideo
17} from '../../../shared/extra-utils' 17} from '../../../shared/extra-utils'
18import { VideoDetails, VideoPlaylistPrivacy } from '../../../shared/models/videos' 18import { VideoDetails, VideoPlaylistPrivacy } from '../../../shared/models/videos'
19import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
19 20
20const expect = chai.expect 21const expect = chai.expect
21 22
@@ -89,12 +90,17 @@ describe('Test plugin altering video constants', function () {
89 90
90 it('Should not be able to create a video with this privacy', async function () { 91 it('Should not be able to create a video with this privacy', async function () {
91 const attrs = { name: 'video', privacy: 2 } 92 const attrs = { name: 'video', privacy: 2 }
92 await uploadVideo(server.url, server.accessToken, attrs, 400) 93 await uploadVideo(server.url, server.accessToken, attrs, HttpStatusCode.BAD_REQUEST_400)
93 }) 94 })
94 95
95 it('Should not be able to create a video with this privacy', async function () { 96 it('Should not be able to create a video with this privacy', async function () {
96 const attrs = { displayName: 'video playlist', privacy: VideoPlaylistPrivacy.PRIVATE } 97 const attrs = { displayName: 'video playlist', privacy: VideoPlaylistPrivacy.PRIVATE }
97 await createVideoPlaylist({ url: server.url, token: server.accessToken, playlistAttrs: attrs, expectedStatus: 400 }) 98 await createVideoPlaylist({
99 url: server.url,
100 token: server.accessToken,
101 playlistAttrs: attrs,
102 expectedStatus: HttpStatusCode.BAD_REQUEST_400
103 })
98 }) 104 })
99 105
100 it('Should be able to upload a video with these values', async function () { 106 it('Should be able to upload a video with these values', async function () {