aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins
diff options
context:
space:
mode:
authorlutangar <johan.dufour@gmail.com>2021-06-29 16:02:05 +0200
committerlutangar <johan.dufour@gmail.com>2021-07-16 17:49:40 +0200
commitdc3d902234bb73fbc8cf9787e3036f2012526e6c (patch)
tree58ab2812fa5b38f4e19376f1a7cf3d718f3003fb /server/tests/plugins
parentde15b052c59cbd4b99bca835b124485ca1af399e (diff)
downloadPeerTube-dc3d902234bb73fbc8cf9787e3036f2012526e6c.tar.gz
PeerTube-dc3d902234bb73fbc8cf9787e3036f2012526e6c.tar.zst
PeerTube-dc3d902234bb73fbc8cf9787e3036f2012526e6c.zip
Introduce generic video constant manager for plugins
Allow a plugin developer to get back constants values, and reset constants deletions or additions.
Diffstat (limited to 'server/tests/plugins')
-rw-r--r--server/tests/plugins/video-constants.ts37
1 files changed, 36 insertions, 1 deletions
diff --git a/server/tests/plugins/video-constants.ts b/server/tests/plugins/video-constants.ts
index eb014c596..7b1312f88 100644
--- a/server/tests/plugins/video-constants.ts
+++ b/server/tests/plugins/video-constants.ts
@@ -9,8 +9,11 @@ import {
9 getVideo, 9 getVideo,
10 getVideoCategories, 10 getVideoCategories,
11 getVideoLanguages, 11 getVideoLanguages,
12 getVideoLicences, getVideoPlaylistPrivacies, getVideoPrivacies, 12 getVideoLicences,
13 getVideoPlaylistPrivacies,
14 getVideoPrivacies,
13 installPlugin, 15 installPlugin,
16 makeGetRequest,
14 setAccessTokensToServers, 17 setAccessTokensToServers,
15 uninstallPlugin, 18 uninstallPlugin,
16 uploadVideo 19 uploadVideo
@@ -173,6 +176,38 @@ describe('Test plugin altering video constants', function () {
173 } 176 }
174 }) 177 })
175 178
179 it('Should be able to reset categories', async function () {
180 await installPlugin({
181 url: server.url,
182 accessToken: server.accessToken,
183 path: getPluginTestPath('-video-constants')
184 })
185
186 let { body: categories } = await getVideoCategories(server.url)
187
188 expect(categories[1]).to.not.exist
189 expect(categories[2]).to.not.exist
190
191 expect(categories[42]).to.exist
192 expect(categories[43]).to.exist
193
194 await makeGetRequest({
195 url: server.url,
196 token: server.accessToken,
197 path: '/plugins/test-video-constants/router/reset-categories',
198 statusCodeExpected: HttpStatusCode.NO_CONTENT_204
199 })
200
201 const { body } = await getVideoCategories(server.url)
202 categories = body
203
204 expect(categories[1]).to.exist
205 expect(categories[2]).to.exist
206
207 expect(categories[42]).to.not.exist
208 expect(categories[43]).to.not.exist
209 })
210
176 after(async function () { 211 after(async function () {
177 await cleanupTests([ server ]) 212 await cleanupTests([ server ])
178 }) 213 })