diff options
Diffstat (limited to 'server/tests/plugins')
-rw-r--r-- | server/tests/plugins/action-hooks.ts | 33 | ||||
-rw-r--r-- | server/tests/plugins/filter-hooks.ts | 24 |
2 files changed, 56 insertions, 1 deletions
diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts index 57ede2701..209db95a4 100644 --- a/server/tests/plugins/action-hooks.ts +++ b/server/tests/plugins/action-hooks.ts | |||
@@ -65,6 +65,39 @@ describe('Test plugin action hooks', function () { | |||
65 | 65 | ||
66 | await checkHook('action:api.video.viewed') | 66 | await checkHook('action:api.video.viewed') |
67 | }) | 67 | }) |
68 | |||
69 | it('Should run action:api.video.deleted', async function () { | ||
70 | await servers[0].videos.remove({ id: videoUUID }) | ||
71 | |||
72 | await checkHook('action:api.video.deleted') | ||
73 | }) | ||
74 | |||
75 | after(async function () { | ||
76 | const { uuid } = await servers[0].videos.quickUpload({ name: 'video' }) | ||
77 | videoUUID = uuid | ||
78 | }) | ||
79 | }) | ||
80 | |||
81 | describe('Video channel hooks', function () { | ||
82 | const channelName = 'my_super_channel' | ||
83 | |||
84 | it('Should run action:api.video-channel.created', async function () { | ||
85 | await servers[0].channels.create({ attributes: { name: channelName } }) | ||
86 | |||
87 | await checkHook('action:api.video-channel.created') | ||
88 | }) | ||
89 | |||
90 | it('Should run action:api.video-channel.updated', async function () { | ||
91 | await servers[0].channels.update({ channelName, attributes: { displayName: 'my display name' } }) | ||
92 | |||
93 | await checkHook('action:api.video-channel.updated') | ||
94 | }) | ||
95 | |||
96 | it('Should run action:api.video-channel.deleted', async function () { | ||
97 | await servers[0].channels.delete({ channelName }) | ||
98 | |||
99 | await checkHook('action:api.video-channel.deleted') | ||
100 | }) | ||
68 | }) | 101 | }) |
69 | 102 | ||
70 | describe('Live hooks', function () { | 103 | describe('Live hooks', function () { |
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index 5ed24a58e..015459ead 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts | |||
@@ -295,7 +295,7 @@ describe('Test plugin filter hooks', function () { | |||
295 | await servers[0].servers.waitUntilLog('Run hook filter:api.overviews.videos.list.result', 3) | 295 | await servers[0].servers.waitUntilLog('Run hook filter:api.overviews.videos.list.result', 3) |
296 | }) | 296 | }) |
297 | 297 | ||
298 | describe('Should run filter:video.auto-blacklist.result', function () { | 298 | describe('filter:video.auto-blacklist.result', function () { |
299 | 299 | ||
300 | async function checkIsBlacklisted (id: number | string, value: boolean) { | 300 | async function checkIsBlacklisted (id: number | string, value: boolean) { |
301 | const video = await servers[0].videos.getWithToken({ id }) | 301 | const video = await servers[0].videos.getWithToken({ id }) |
@@ -691,6 +691,28 @@ describe('Test plugin filter hooks', function () { | |||
691 | }) | 691 | }) |
692 | }) | 692 | }) |
693 | 693 | ||
694 | describe('Video channel filters', async function () { | ||
695 | |||
696 | it('Should run filter:api.video-channels.list.params', async function () { | ||
697 | const { data } = await servers[0].channels.list({ start: 0, count: 0 }) | ||
698 | |||
699 | // plugin do +1 to the count parameter | ||
700 | expect(data).to.have.lengthOf(1) | ||
701 | }) | ||
702 | |||
703 | it('Should run filter:api.video-channels.list.result', async function () { | ||
704 | const { total } = await servers[0].channels.list({ start: 0, count: 1 }) | ||
705 | |||
706 | // plugin do +1 to the total parameter | ||
707 | expect(total).to.equal(4) | ||
708 | }) | ||
709 | |||
710 | it('Should run filter:api.video-channel.get.result', async function () { | ||
711 | const channel = await servers[0].channels.get({ channelName: 'root_channel' }) | ||
712 | expect(channel.displayName).to.equal('Main root channel <3') | ||
713 | }) | ||
714 | }) | ||
715 | |||
694 | after(async function () { | 716 | after(async function () { |
695 | await cleanupTests(servers) | 717 | await cleanupTests(servers) |
696 | }) | 718 | }) |