1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 11:59:58 +02:00

Introduce generic video constant manager for plugins

Allow a plugin developer to get back constants values,
and reset constants deletions or additions.
This commit is contained in:
lutangar 2021-06-29 16:02:05 +02:00
parent de15b052c5
commit dc3d902234
12 changed files with 470 additions and 232 deletions

View file

@ -9,8 +9,11 @@ import {
getVideo,
getVideoCategories,
getVideoLanguages,
getVideoLicences, getVideoPlaylistPrivacies, getVideoPrivacies,
getVideoLicences,
getVideoPlaylistPrivacies,
getVideoPrivacies,
installPlugin,
makeGetRequest,
setAccessTokensToServers,
uninstallPlugin,
uploadVideo
@ -173,6 +176,38 @@ describe('Test plugin altering video constants', function () {
}
})
it('Should be able to reset categories', async function () {
await installPlugin({
url: server.url,
accessToken: server.accessToken,
path: getPluginTestPath('-video-constants')
})
let { body: categories } = await getVideoCategories(server.url)
expect(categories[1]).to.not.exist
expect(categories[2]).to.not.exist
expect(categories[42]).to.exist
expect(categories[43]).to.exist
await makeGetRequest({
url: server.url,
token: server.accessToken,
path: '/plugins/test-video-constants/router/reset-categories',
statusCodeExpected: HttpStatusCode.NO_CONTENT_204
})
const { body } = await getVideoCategories(server.url)
categories = body
expect(categories[1]).to.exist
expect(categories[2]).to.exist
expect(categories[42]).to.not.exist
expect(categories[43]).to.not.exist
})
after(async function () {
await cleanupTests([ server ])
})