mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Add channel server hooks
This commit is contained in:
@@ -65,6 +65,39 @@ describe('Test plugin action hooks', function () {
|
||||
|
||||
await checkHook('action:api.video.viewed')
|
||||
})
|
||||
|
||||
it('Should run action:api.video.deleted', async function () {
|
||||
await servers[0].videos.remove({ id: videoUUID })
|
||||
|
||||
await checkHook('action:api.video.deleted')
|
||||
})
|
||||
|
||||
after(async function () {
|
||||
const { uuid } = await servers[0].videos.quickUpload({ name: 'video' })
|
||||
videoUUID = uuid
|
||||
})
|
||||
})
|
||||
|
||||
describe('Video channel hooks', function () {
|
||||
const channelName = 'my_super_channel'
|
||||
|
||||
it('Should run action:api.video-channel.created', async function () {
|
||||
await servers[0].channels.create({ attributes: { name: channelName } })
|
||||
|
||||
await checkHook('action:api.video-channel.created')
|
||||
})
|
||||
|
||||
it('Should run action:api.video-channel.updated', async function () {
|
||||
await servers[0].channels.update({ channelName, attributes: { displayName: 'my display name' } })
|
||||
|
||||
await checkHook('action:api.video-channel.updated')
|
||||
})
|
||||
|
||||
it('Should run action:api.video-channel.deleted', async function () {
|
||||
await servers[0].channels.delete({ channelName })
|
||||
|
||||
await checkHook('action:api.video-channel.deleted')
|
||||
})
|
||||
})
|
||||
|
||||
describe('Live hooks', function () {
|
||||
|
||||
@@ -295,7 +295,7 @@ describe('Test plugin filter hooks', function () {
|
||||
await servers[0].servers.waitUntilLog('Run hook filter:api.overviews.videos.list.result', 3)
|
||||
})
|
||||
|
||||
describe('Should run filter:video.auto-blacklist.result', function () {
|
||||
describe('filter:video.auto-blacklist.result', function () {
|
||||
|
||||
async function checkIsBlacklisted (id: number | string, value: boolean) {
|
||||
const video = await servers[0].videos.getWithToken({ id })
|
||||
@@ -691,6 +691,28 @@ describe('Test plugin filter hooks', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('Video channel filters', async function () {
|
||||
|
||||
it('Should run filter:api.video-channels.list.params', async function () {
|
||||
const { data } = await servers[0].channels.list({ start: 0, count: 0 })
|
||||
|
||||
// plugin do +1 to the count parameter
|
||||
expect(data).to.have.lengthOf(1)
|
||||
})
|
||||
|
||||
it('Should run filter:api.video-channels.list.result', async function () {
|
||||
const { total } = await servers[0].channels.list({ start: 0, count: 1 })
|
||||
|
||||
// plugin do +1 to the total parameter
|
||||
expect(total).to.equal(4)
|
||||
})
|
||||
|
||||
it('Should run filter:api.video-channel.get.result', async function () {
|
||||
const channel = await servers[0].channels.get({ channelName: 'root_channel' })
|
||||
expect(channel.displayName).to.equal('Main root channel <3')
|
||||
})
|
||||
})
|
||||
|
||||
after(async function () {
|
||||
await cleanupTests(servers)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user