diff options
Diffstat (limited to 'server/tests/plugins/filter-hooks.ts')
-rw-r--r-- | server/tests/plugins/filter-hooks.ts | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index e82aa3bfb..18479dcf5 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts | |||
@@ -32,17 +32,17 @@ describe('Test plugin filter hooks', function () { | |||
32 | await setDefaultVideoChannel(servers) | 32 | await setDefaultVideoChannel(servers) |
33 | await doubleFollow(servers[0], servers[1]) | 33 | await doubleFollow(servers[0], servers[1]) |
34 | 34 | ||
35 | await servers[0].pluginsCommand.install({ path: PluginsCommand.getPluginTestPath() }) | 35 | await servers[0].plugins.install({ path: PluginsCommand.getPluginTestPath() }) |
36 | await servers[0].pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-filter-translations') }) | 36 | await servers[0].plugins.install({ path: PluginsCommand.getPluginTestPath('-filter-translations') }) |
37 | 37 | ||
38 | for (let i = 0; i < 10; i++) { | 38 | for (let i = 0; i < 10; i++) { |
39 | await servers[0].videosCommand.upload({ attributes: { name: 'default video ' + i } }) | 39 | await servers[0].videos.upload({ attributes: { name: 'default video ' + i } }) |
40 | } | 40 | } |
41 | 41 | ||
42 | const { data } = await servers[0].videosCommand.list() | 42 | const { data } = await servers[0].videos.list() |
43 | videoUUID = data[0].uuid | 43 | videoUUID = data[0].uuid |
44 | 44 | ||
45 | await servers[0].configCommand.updateCustomSubConfig({ | 45 | await servers[0].config.updateCustomSubConfig({ |
46 | newConfig: { | 46 | newConfig: { |
47 | live: { enabled: true }, | 47 | live: { enabled: true }, |
48 | signup: { enabled: true }, | 48 | signup: { enabled: true }, |
@@ -57,98 +57,98 @@ describe('Test plugin filter hooks', function () { | |||
57 | }) | 57 | }) |
58 | 58 | ||
59 | it('Should run filter:api.videos.list.params', async function () { | 59 | it('Should run filter:api.videos.list.params', async function () { |
60 | const { data } = await servers[0].videosCommand.list({ start: 0, count: 2 }) | 60 | const { data } = await servers[0].videos.list({ start: 0, count: 2 }) |
61 | 61 | ||
62 | // 2 plugins do +1 to the count parameter | 62 | // 2 plugins do +1 to the count parameter |
63 | expect(data).to.have.lengthOf(4) | 63 | expect(data).to.have.lengthOf(4) |
64 | }) | 64 | }) |
65 | 65 | ||
66 | it('Should run filter:api.videos.list.result', async function () { | 66 | it('Should run filter:api.videos.list.result', async function () { |
67 | const { total } = await servers[0].videosCommand.list({ start: 0, count: 0 }) | 67 | const { total } = await servers[0].videos.list({ start: 0, count: 0 }) |
68 | 68 | ||
69 | // Plugin do +1 to the total result | 69 | // Plugin do +1 to the total result |
70 | expect(total).to.equal(11) | 70 | expect(total).to.equal(11) |
71 | }) | 71 | }) |
72 | 72 | ||
73 | it('Should run filter:api.accounts.videos.list.params', async function () { | 73 | it('Should run filter:api.accounts.videos.list.params', async function () { |
74 | const { data } = await servers[0].videosCommand.listByAccount({ accountName: 'root', start: 0, count: 2 }) | 74 | const { data } = await servers[0].videos.listByAccount({ accountName: 'root', start: 0, count: 2 }) |
75 | 75 | ||
76 | // 1 plugin do +1 to the count parameter | 76 | // 1 plugin do +1 to the count parameter |
77 | expect(data).to.have.lengthOf(3) | 77 | expect(data).to.have.lengthOf(3) |
78 | }) | 78 | }) |
79 | 79 | ||
80 | it('Should run filter:api.accounts.videos.list.result', async function () { | 80 | it('Should run filter:api.accounts.videos.list.result', async function () { |
81 | const { total } = await servers[0].videosCommand.listByAccount({ accountName: 'root', start: 0, count: 2 }) | 81 | const { total } = await servers[0].videos.listByAccount({ accountName: 'root', start: 0, count: 2 }) |
82 | 82 | ||
83 | // Plugin do +2 to the total result | 83 | // Plugin do +2 to the total result |
84 | expect(total).to.equal(12) | 84 | expect(total).to.equal(12) |
85 | }) | 85 | }) |
86 | 86 | ||
87 | it('Should run filter:api.video-channels.videos.list.params', async function () { | 87 | it('Should run filter:api.video-channels.videos.list.params', async function () { |
88 | const { data } = await servers[0].videosCommand.listByChannel({ videoChannelName: 'root_channel', start: 0, count: 2 }) | 88 | const { data } = await servers[0].videos.listByChannel({ videoChannelName: 'root_channel', start: 0, count: 2 }) |
89 | 89 | ||
90 | // 1 plugin do +3 to the count parameter | 90 | // 1 plugin do +3 to the count parameter |
91 | expect(data).to.have.lengthOf(5) | 91 | expect(data).to.have.lengthOf(5) |
92 | }) | 92 | }) |
93 | 93 | ||
94 | it('Should run filter:api.video-channels.videos.list.result', async function () { | 94 | it('Should run filter:api.video-channels.videos.list.result', async function () { |
95 | const { total } = await servers[0].videosCommand.listByChannel({ videoChannelName: 'root_channel', start: 0, count: 2 }) | 95 | const { total } = await servers[0].videos.listByChannel({ videoChannelName: 'root_channel', start: 0, count: 2 }) |
96 | 96 | ||
97 | // Plugin do +3 to the total result | 97 | // Plugin do +3 to the total result |
98 | expect(total).to.equal(13) | 98 | expect(total).to.equal(13) |
99 | }) | 99 | }) |
100 | 100 | ||
101 | it('Should run filter:api.user.me.videos.list.params', async function () { | 101 | it('Should run filter:api.user.me.videos.list.params', async function () { |
102 | const { data } = await servers[0].videosCommand.listMyVideos({ start: 0, count: 2 }) | 102 | const { data } = await servers[0].videos.listMyVideos({ start: 0, count: 2 }) |
103 | 103 | ||
104 | // 1 plugin do +4 to the count parameter | 104 | // 1 plugin do +4 to the count parameter |
105 | expect(data).to.have.lengthOf(6) | 105 | expect(data).to.have.lengthOf(6) |
106 | }) | 106 | }) |
107 | 107 | ||
108 | it('Should run filter:api.user.me.videos.list.result', async function () { | 108 | it('Should run filter:api.user.me.videos.list.result', async function () { |
109 | const { total } = await servers[0].videosCommand.listMyVideos({ start: 0, count: 2 }) | 109 | const { total } = await servers[0].videos.listMyVideos({ start: 0, count: 2 }) |
110 | 110 | ||
111 | // Plugin do +4 to the total result | 111 | // Plugin do +4 to the total result |
112 | expect(total).to.equal(14) | 112 | expect(total).to.equal(14) |
113 | }) | 113 | }) |
114 | 114 | ||
115 | it('Should run filter:api.video.get.result', async function () { | 115 | it('Should run filter:api.video.get.result', async function () { |
116 | const video = await servers[0].videosCommand.get({ id: videoUUID }) | 116 | const video = await servers[0].videos.get({ id: videoUUID }) |
117 | expect(video.name).to.contain('<3') | 117 | expect(video.name).to.contain('<3') |
118 | }) | 118 | }) |
119 | 119 | ||
120 | it('Should run filter:api.video.upload.accept.result', async function () { | 120 | it('Should run filter:api.video.upload.accept.result', async function () { |
121 | await servers[0].videosCommand.upload({ attributes: { name: 'video with bad word' }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | 121 | await servers[0].videos.upload({ attributes: { name: 'video with bad word' }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
122 | }) | 122 | }) |
123 | 123 | ||
124 | it('Should run filter:api.live-video.create.accept.result', async function () { | 124 | it('Should run filter:api.live-video.create.accept.result', async function () { |
125 | const attributes = { | 125 | const attributes = { |
126 | name: 'video with bad word', | 126 | name: 'video with bad word', |
127 | privacy: VideoPrivacy.PUBLIC, | 127 | privacy: VideoPrivacy.PUBLIC, |
128 | channelId: servers[0].videoChannel.id | 128 | channelId: servers[0].store.channel.id |
129 | } | 129 | } |
130 | 130 | ||
131 | await servers[0].liveCommand.create({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | 131 | await servers[0].live.create({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
132 | }) | 132 | }) |
133 | 133 | ||
134 | it('Should run filter:api.video.pre-import-url.accept.result', async function () { | 134 | it('Should run filter:api.video.pre-import-url.accept.result', async function () { |
135 | const attributes = { | 135 | const attributes = { |
136 | name: 'normal title', | 136 | name: 'normal title', |
137 | privacy: VideoPrivacy.PUBLIC, | 137 | privacy: VideoPrivacy.PUBLIC, |
138 | channelId: servers[0].videoChannel.id, | 138 | channelId: servers[0].store.channel.id, |
139 | targetUrl: ImportsCommand.getGoodVideoUrl() + 'bad' | 139 | targetUrl: ImportsCommand.getGoodVideoUrl() + 'bad' |
140 | } | 140 | } |
141 | await servers[0].importsCommand.importVideo({ attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | 141 | await servers[0].imports.importVideo({ attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
142 | }) | 142 | }) |
143 | 143 | ||
144 | it('Should run filter:api.video.pre-import-torrent.accept.result', async function () { | 144 | it('Should run filter:api.video.pre-import-torrent.accept.result', async function () { |
145 | const attributes = { | 145 | const attributes = { |
146 | name: 'bad torrent', | 146 | name: 'bad torrent', |
147 | privacy: VideoPrivacy.PUBLIC, | 147 | privacy: VideoPrivacy.PUBLIC, |
148 | channelId: servers[0].videoChannel.id, | 148 | channelId: servers[0].store.channel.id, |
149 | torrentfile: 'video-720p.torrent' as any | 149 | torrentfile: 'video-720p.torrent' as any |
150 | } | 150 | } |
151 | await servers[0].importsCommand.importVideo({ attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | 151 | await servers[0].imports.importVideo({ attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
152 | }) | 152 | }) |
153 | 153 | ||
154 | it('Should run filter:api.video.post-import-url.accept.result', async function () { | 154 | it('Should run filter:api.video.post-import-url.accept.result', async function () { |
@@ -160,17 +160,17 @@ describe('Test plugin filter hooks', function () { | |||
160 | const attributes = { | 160 | const attributes = { |
161 | name: 'title with bad word', | 161 | name: 'title with bad word', |
162 | privacy: VideoPrivacy.PUBLIC, | 162 | privacy: VideoPrivacy.PUBLIC, |
163 | channelId: servers[0].videoChannel.id, | 163 | channelId: servers[0].store.channel.id, |
164 | targetUrl: ImportsCommand.getGoodVideoUrl() | 164 | targetUrl: ImportsCommand.getGoodVideoUrl() |
165 | } | 165 | } |
166 | const body = await servers[0].importsCommand.importVideo({ attributes }) | 166 | const body = await servers[0].imports.importVideo({ attributes }) |
167 | videoImportId = body.id | 167 | videoImportId = body.id |
168 | } | 168 | } |
169 | 169 | ||
170 | await waitJobs(servers) | 170 | await waitJobs(servers) |
171 | 171 | ||
172 | { | 172 | { |
173 | const body = await servers[0].importsCommand.getMyVideoImports() | 173 | const body = await servers[0].imports.getMyVideoImports() |
174 | const videoImports = body.data | 174 | const videoImports = body.data |
175 | 175 | ||
176 | const videoImport = videoImports.find(i => i.id === videoImportId) | 176 | const videoImport = videoImports.find(i => i.id === videoImportId) |
@@ -189,17 +189,17 @@ describe('Test plugin filter hooks', function () { | |||
189 | const attributes = { | 189 | const attributes = { |
190 | name: 'title with bad word', | 190 | name: 'title with bad word', |
191 | privacy: VideoPrivacy.PUBLIC, | 191 | privacy: VideoPrivacy.PUBLIC, |
192 | channelId: servers[0].videoChannel.id, | 192 | channelId: servers[0].store.channel.id, |
193 | torrentfile: 'video-720p.torrent' as any | 193 | torrentfile: 'video-720p.torrent' as any |
194 | } | 194 | } |
195 | const body = await servers[0].importsCommand.importVideo({ attributes }) | 195 | const body = await servers[0].imports.importVideo({ attributes }) |
196 | videoImportId = body.id | 196 | videoImportId = body.id |
197 | } | 197 | } |
198 | 198 | ||
199 | await waitJobs(servers) | 199 | await waitJobs(servers) |
200 | 200 | ||
201 | { | 201 | { |
202 | const { data: videoImports } = await servers[0].importsCommand.getMyVideoImports() | 202 | const { data: videoImports } = await servers[0].imports.getMyVideoImports() |
203 | 203 | ||
204 | const videoImport = videoImports.find(i => i.id === videoImportId) | 204 | const videoImport = videoImports.find(i => i.id === videoImportId) |
205 | 205 | ||
@@ -209,7 +209,7 @@ describe('Test plugin filter hooks', function () { | |||
209 | }) | 209 | }) |
210 | 210 | ||
211 | it('Should run filter:api.video-thread.create.accept.result', async function () { | 211 | it('Should run filter:api.video-thread.create.accept.result', async function () { |
212 | await servers[0].commentsCommand.createThread({ | 212 | await servers[0].comments.createThread({ |
213 | videoId: videoUUID, | 213 | videoId: videoUUID, |
214 | text: 'comment with bad word', | 214 | text: 'comment with bad word', |
215 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | 215 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
@@ -217,16 +217,16 @@ describe('Test plugin filter hooks', function () { | |||
217 | }) | 217 | }) |
218 | 218 | ||
219 | it('Should run filter:api.video-comment-reply.create.accept.result', async function () { | 219 | it('Should run filter:api.video-comment-reply.create.accept.result', async function () { |
220 | const created = await servers[0].commentsCommand.createThread({ videoId: videoUUID, text: 'thread' }) | 220 | const created = await servers[0].comments.createThread({ videoId: videoUUID, text: 'thread' }) |
221 | threadId = created.id | 221 | threadId = created.id |
222 | 222 | ||
223 | await servers[0].commentsCommand.addReply({ | 223 | await servers[0].comments.addReply({ |
224 | videoId: videoUUID, | 224 | videoId: videoUUID, |
225 | toCommentId: threadId, | 225 | toCommentId: threadId, |
226 | text: 'comment with bad word', | 226 | text: 'comment with bad word', |
227 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | 227 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
228 | }) | 228 | }) |
229 | await servers[0].commentsCommand.addReply({ | 229 | await servers[0].comments.addReply({ |
230 | videoId: videoUUID, | 230 | videoId: videoUUID, |
231 | toCommentId: threadId, | 231 | toCommentId: threadId, |
232 | text: 'comment with good word', | 232 | text: 'comment with good word', |
@@ -235,14 +235,14 @@ describe('Test plugin filter hooks', function () { | |||
235 | }) | 235 | }) |
236 | 236 | ||
237 | it('Should run filter:api.video-threads.list.params', async function () { | 237 | it('Should run filter:api.video-threads.list.params', async function () { |
238 | const { data } = await servers[0].commentsCommand.listThreads({ videoId: videoUUID, start: 0, count: 0 }) | 238 | const { data } = await servers[0].comments.listThreads({ videoId: videoUUID, start: 0, count: 0 }) |
239 | 239 | ||
240 | // our plugin do +1 to the count parameter | 240 | // our plugin do +1 to the count parameter |
241 | expect(data).to.have.lengthOf(1) | 241 | expect(data).to.have.lengthOf(1) |
242 | }) | 242 | }) |
243 | 243 | ||
244 | it('Should run filter:api.video-threads.list.result', async function () { | 244 | it('Should run filter:api.video-threads.list.result', async function () { |
245 | const { total } = await servers[0].commentsCommand.listThreads({ videoId: videoUUID, start: 0, count: 0 }) | 245 | const { total } = await servers[0].comments.listThreads({ videoId: videoUUID, start: 0, count: 0 }) |
246 | 246 | ||
247 | // Plugin do +1 to the total result | 247 | // Plugin do +1 to the total result |
248 | expect(total).to.equal(2) | 248 | expect(total).to.equal(2) |
@@ -251,7 +251,7 @@ describe('Test plugin filter hooks', function () { | |||
251 | it('Should run filter:api.video-thread-comments.list.params') | 251 | it('Should run filter:api.video-thread-comments.list.params') |
252 | 252 | ||
253 | it('Should run filter:api.video-thread-comments.list.result', async function () { | 253 | it('Should run filter:api.video-thread-comments.list.result', async function () { |
254 | const thread = await servers[0].commentsCommand.getThread({ videoId: videoUUID, threadId }) | 254 | const thread = await servers[0].comments.getThread({ videoId: videoUUID, threadId }) |
255 | 255 | ||
256 | expect(thread.comment.text.endsWith(' <3')).to.be.true | 256 | expect(thread.comment.text.endsWith(' <3')).to.be.true |
257 | }) | 257 | }) |
@@ -259,12 +259,12 @@ describe('Test plugin filter hooks', function () { | |||
259 | describe('Should run filter:video.auto-blacklist.result', function () { | 259 | describe('Should run filter:video.auto-blacklist.result', function () { |
260 | 260 | ||
261 | async function checkIsBlacklisted (id: number | string, value: boolean) { | 261 | async function checkIsBlacklisted (id: number | string, value: boolean) { |
262 | const video = await servers[0].videosCommand.getWithToken({ id }) | 262 | const video = await servers[0].videos.getWithToken({ id }) |
263 | expect(video.blacklisted).to.equal(value) | 263 | expect(video.blacklisted).to.equal(value) |
264 | } | 264 | } |
265 | 265 | ||
266 | it('Should blacklist on upload', async function () { | 266 | it('Should blacklist on upload', async function () { |
267 | const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video please blacklist me' } }) | 267 | const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video please blacklist me' } }) |
268 | await checkIsBlacklisted(uuid, true) | 268 | await checkIsBlacklisted(uuid, true) |
269 | }) | 269 | }) |
270 | 270 | ||
@@ -274,24 +274,24 @@ describe('Test plugin filter hooks', function () { | |||
274 | const attributes = { | 274 | const attributes = { |
275 | name: 'video please blacklist me', | 275 | name: 'video please blacklist me', |
276 | targetUrl: ImportsCommand.getGoodVideoUrl(), | 276 | targetUrl: ImportsCommand.getGoodVideoUrl(), |
277 | channelId: servers[0].videoChannel.id | 277 | channelId: servers[0].store.channel.id |
278 | } | 278 | } |
279 | const body = await servers[0].importsCommand.importVideo({ attributes }) | 279 | const body = await servers[0].imports.importVideo({ attributes }) |
280 | await checkIsBlacklisted(body.video.uuid, true) | 280 | await checkIsBlacklisted(body.video.uuid, true) |
281 | }) | 281 | }) |
282 | 282 | ||
283 | it('Should blacklist on update', async function () { | 283 | it('Should blacklist on update', async function () { |
284 | const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video' } }) | 284 | const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video' } }) |
285 | await checkIsBlacklisted(uuid, false) | 285 | await checkIsBlacklisted(uuid, false) |
286 | 286 | ||
287 | await servers[0].videosCommand.update({ id: uuid, attributes: { name: 'please blacklist me' } }) | 287 | await servers[0].videos.update({ id: uuid, attributes: { name: 'please blacklist me' } }) |
288 | await checkIsBlacklisted(uuid, true) | 288 | await checkIsBlacklisted(uuid, true) |
289 | }) | 289 | }) |
290 | 290 | ||
291 | it('Should blacklist on remote upload', async function () { | 291 | it('Should blacklist on remote upload', async function () { |
292 | this.timeout(120000) | 292 | this.timeout(120000) |
293 | 293 | ||
294 | const { uuid } = await servers[1].videosCommand.upload({ attributes: { name: 'remote please blacklist me' } }) | 294 | const { uuid } = await servers[1].videos.upload({ attributes: { name: 'remote please blacklist me' } }) |
295 | await waitJobs(servers) | 295 | await waitJobs(servers) |
296 | 296 | ||
297 | await checkIsBlacklisted(uuid, true) | 297 | await checkIsBlacklisted(uuid, true) |
@@ -300,12 +300,12 @@ describe('Test plugin filter hooks', function () { | |||
300 | it('Should blacklist on remote update', async function () { | 300 | it('Should blacklist on remote update', async function () { |
301 | this.timeout(120000) | 301 | this.timeout(120000) |
302 | 302 | ||
303 | const { uuid } = await servers[1].videosCommand.upload({ attributes: { name: 'video' } }) | 303 | const { uuid } = await servers[1].videos.upload({ attributes: { name: 'video' } }) |
304 | await waitJobs(servers) | 304 | await waitJobs(servers) |
305 | 305 | ||
306 | await checkIsBlacklisted(uuid, false) | 306 | await checkIsBlacklisted(uuid, false) |
307 | 307 | ||
308 | await servers[1].videosCommand.update({ id: uuid, attributes: { name: 'please blacklist me' } }) | 308 | await servers[1].videos.update({ id: uuid, attributes: { name: 'please blacklist me' } }) |
309 | await waitJobs(servers) | 309 | await waitJobs(servers) |
310 | 310 | ||
311 | await checkIsBlacklisted(uuid, true) | 311 | await checkIsBlacklisted(uuid, true) |
@@ -315,16 +315,16 @@ describe('Test plugin filter hooks', function () { | |||
315 | describe('Should run filter:api.user.signup.allowed.result', function () { | 315 | describe('Should run filter:api.user.signup.allowed.result', function () { |
316 | 316 | ||
317 | it('Should run on config endpoint', async function () { | 317 | it('Should run on config endpoint', async function () { |
318 | const body = await servers[0].configCommand.getConfig() | 318 | const body = await servers[0].config.getConfig() |
319 | expect(body.signup.allowed).to.be.true | 319 | expect(body.signup.allowed).to.be.true |
320 | }) | 320 | }) |
321 | 321 | ||
322 | it('Should allow a signup', async function () { | 322 | it('Should allow a signup', async function () { |
323 | await servers[0].usersCommand.register({ username: 'john', password: 'password' }) | 323 | await servers[0].users.register({ username: 'john', password: 'password' }) |
324 | }) | 324 | }) |
325 | 325 | ||
326 | it('Should not allow a signup', async function () { | 326 | it('Should not allow a signup', async function () { |
327 | const res = await servers[0].usersCommand.register({ | 327 | const res = await servers[0].users.register({ |
328 | username: 'jma', | 328 | username: 'jma', |
329 | password: 'password', | 329 | password: 'password', |
330 | expectedStatus: HttpStatusCode.FORBIDDEN_403 | 330 | expectedStatus: HttpStatusCode.FORBIDDEN_403 |
@@ -340,7 +340,7 @@ describe('Test plugin filter hooks', function () { | |||
340 | before(async function () { | 340 | before(async function () { |
341 | this.timeout(120000) | 341 | this.timeout(120000) |
342 | 342 | ||
343 | await servers[0].configCommand.updateCustomSubConfig({ | 343 | await servers[0].config.updateCustomSubConfig({ |
344 | newConfig: { | 344 | newConfig: { |
345 | transcoding: { | 345 | transcoding: { |
346 | webtorrent: { | 346 | webtorrent: { |
@@ -356,14 +356,14 @@ describe('Test plugin filter hooks', function () { | |||
356 | const uuids: string[] = [] | 356 | const uuids: string[] = [] |
357 | 357 | ||
358 | for (const name of [ 'bad torrent', 'bad file', 'bad playlist file' ]) { | 358 | for (const name of [ 'bad torrent', 'bad file', 'bad playlist file' ]) { |
359 | const uuid = (await servers[0].videosCommand.quickUpload({ name: name })).uuid | 359 | const uuid = (await servers[0].videos.quickUpload({ name: name })).uuid |
360 | uuids.push(uuid) | 360 | uuids.push(uuid) |
361 | } | 361 | } |
362 | 362 | ||
363 | await waitJobs(servers) | 363 | await waitJobs(servers) |
364 | 364 | ||
365 | for (const uuid of uuids) { | 365 | for (const uuid of uuids) { |
366 | downloadVideos.push(await servers[0].videosCommand.get({ id: uuid })) | 366 | downloadVideos.push(await servers[0].videos.get({ id: uuid })) |
367 | } | 367 | } |
368 | }) | 368 | }) |
369 | 369 | ||
@@ -403,7 +403,7 @@ describe('Test plugin filter hooks', function () { | |||
403 | before(async function () { | 403 | before(async function () { |
404 | this.timeout(60000) | 404 | this.timeout(60000) |
405 | 405 | ||
406 | await servers[0].configCommand.updateCustomSubConfig({ | 406 | await servers[0].config.updateCustomSubConfig({ |
407 | newConfig: { | 407 | newConfig: { |
408 | transcoding: { | 408 | transcoding: { |
409 | enabled: false | 409 | enabled: false |
@@ -413,15 +413,15 @@ describe('Test plugin filter hooks', function () { | |||
413 | 413 | ||
414 | for (const name of [ 'bad embed', 'good embed' ]) { | 414 | for (const name of [ 'bad embed', 'good embed' ]) { |
415 | { | 415 | { |
416 | const uuid = (await servers[0].videosCommand.quickUpload({ name: name })).uuid | 416 | const uuid = (await servers[0].videos.quickUpload({ name: name })).uuid |
417 | embedVideos.push(await servers[0].videosCommand.get({ id: uuid })) | 417 | embedVideos.push(await servers[0].videos.get({ id: uuid })) |
418 | } | 418 | } |
419 | 419 | ||
420 | { | 420 | { |
421 | const attributes = { displayName: name, videoChannelId: servers[0].videoChannel.id, privacy: VideoPlaylistPrivacy.PUBLIC } | 421 | const attributes = { displayName: name, videoChannelId: servers[0].store.channel.id, privacy: VideoPlaylistPrivacy.PUBLIC } |
422 | const { id } = await servers[0].playlistsCommand.create({ attributes }) | 422 | const { id } = await servers[0].playlists.create({ attributes }) |
423 | 423 | ||
424 | const playlist = await servers[0].playlistsCommand.get({ playlistId: id }) | 424 | const playlist = await servers[0].playlists.get({ playlistId: id }) |
425 | embedPlaylists.push(playlist) | 425 | embedPlaylists.push(playlist) |
426 | } | 426 | } |
427 | } | 427 | } |
@@ -441,7 +441,7 @@ describe('Test plugin filter hooks', function () { | |||
441 | describe('Search filters', function () { | 441 | describe('Search filters', function () { |
442 | 442 | ||
443 | before(async function () { | 443 | before(async function () { |
444 | await servers[0].configCommand.updateCustomSubConfig({ | 444 | await servers[0].config.updateCustomSubConfig({ |
445 | newConfig: { | 445 | newConfig: { |
446 | search: { | 446 | search: { |
447 | searchIndex: { | 447 | searchIndex: { |
@@ -455,78 +455,78 @@ describe('Test plugin filter hooks', function () { | |||
455 | }) | 455 | }) |
456 | 456 | ||
457 | it('Should run filter:api.search.videos.local.list.{params,result}', async function () { | 457 | it('Should run filter:api.search.videos.local.list.{params,result}', async function () { |
458 | await servers[0].searchCommand.advancedVideoSearch({ | 458 | await servers[0].search.advancedVideoSearch({ |
459 | search: { | 459 | search: { |
460 | search: 'Sun Quan' | 460 | search: 'Sun Quan' |
461 | } | 461 | } |
462 | }) | 462 | }) |
463 | 463 | ||
464 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.videos.local.list.params', 1) | 464 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.params', 1) |
465 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.videos.local.list.result', 1) | 465 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.result', 1) |
466 | }) | 466 | }) |
467 | 467 | ||
468 | it('Should run filter:api.search.videos.index.list.{params,result}', async function () { | 468 | it('Should run filter:api.search.videos.index.list.{params,result}', async function () { |
469 | await servers[0].searchCommand.advancedVideoSearch({ | 469 | await servers[0].search.advancedVideoSearch({ |
470 | search: { | 470 | search: { |
471 | search: 'Sun Quan', | 471 | search: 'Sun Quan', |
472 | searchTarget: 'search-index' | 472 | searchTarget: 'search-index' |
473 | } | 473 | } |
474 | }) | 474 | }) |
475 | 475 | ||
476 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.videos.local.list.params', 1) | 476 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.params', 1) |
477 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.videos.local.list.result', 1) | 477 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.result', 1) |
478 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.videos.index.list.params', 1) | 478 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.index.list.params', 1) |
479 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.videos.index.list.result', 1) | 479 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.index.list.result', 1) |
480 | }) | 480 | }) |
481 | 481 | ||
482 | it('Should run filter:api.search.video-channels.local.list.{params,result}', async function () { | 482 | it('Should run filter:api.search.video-channels.local.list.{params,result}', async function () { |
483 | await servers[0].searchCommand.advancedChannelSearch({ | 483 | await servers[0].search.advancedChannelSearch({ |
484 | search: { | 484 | search: { |
485 | search: 'Sun Ce' | 485 | search: 'Sun Ce' |
486 | } | 486 | } |
487 | }) | 487 | }) |
488 | 488 | ||
489 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-channels.local.list.params', 1) | 489 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.params', 1) |
490 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-channels.local.list.result', 1) | 490 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.result', 1) |
491 | }) | 491 | }) |
492 | 492 | ||
493 | it('Should run filter:api.search.video-channels.index.list.{params,result}', async function () { | 493 | it('Should run filter:api.search.video-channels.index.list.{params,result}', async function () { |
494 | await servers[0].searchCommand.advancedChannelSearch({ | 494 | await servers[0].search.advancedChannelSearch({ |
495 | search: { | 495 | search: { |
496 | search: 'Sun Ce', | 496 | search: 'Sun Ce', |
497 | searchTarget: 'search-index' | 497 | searchTarget: 'search-index' |
498 | } | 498 | } |
499 | }) | 499 | }) |
500 | 500 | ||
501 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-channels.local.list.params', 1) | 501 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.params', 1) |
502 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-channels.local.list.result', 1) | 502 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.result', 1) |
503 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-channels.index.list.params', 1) | 503 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.index.list.params', 1) |
504 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-channels.index.list.result', 1) | 504 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.index.list.result', 1) |
505 | }) | 505 | }) |
506 | 506 | ||
507 | it('Should run filter:api.search.video-playlists.local.list.{params,result}', async function () { | 507 | it('Should run filter:api.search.video-playlists.local.list.{params,result}', async function () { |
508 | await servers[0].searchCommand.advancedPlaylistSearch({ | 508 | await servers[0].search.advancedPlaylistSearch({ |
509 | search: { | 509 | search: { |
510 | search: 'Sun Jian' | 510 | search: 'Sun Jian' |
511 | } | 511 | } |
512 | }) | 512 | }) |
513 | 513 | ||
514 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.params', 1) | 514 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.params', 1) |
515 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.result', 1) | 515 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.result', 1) |
516 | }) | 516 | }) |
517 | 517 | ||
518 | it('Should run filter:api.search.video-playlists.index.list.{params,result}', async function () { | 518 | it('Should run filter:api.search.video-playlists.index.list.{params,result}', async function () { |
519 | await servers[0].searchCommand.advancedPlaylistSearch({ | 519 | await servers[0].search.advancedPlaylistSearch({ |
520 | search: { | 520 | search: { |
521 | search: 'Sun Jian', | 521 | search: 'Sun Jian', |
522 | searchTarget: 'search-index' | 522 | searchTarget: 'search-index' |
523 | } | 523 | } |
524 | }) | 524 | }) |
525 | 525 | ||
526 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.params', 1) | 526 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.params', 1) |
527 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.result', 1) | 527 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.result', 1) |
528 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-playlists.index.list.params', 1) | 528 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.index.list.params', 1) |
529 | await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-playlists.index.list.result', 1) | 529 | await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.index.list.result', 1) |
530 | }) | 530 | }) |
531 | }) | 531 | }) |
532 | 532 | ||