aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins/action-hooks.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/plugins/action-hooks.ts')
-rw-r--r--server/tests/plugins/action-hooks.ts17
1 files changed, 7 insertions, 10 deletions
diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts
index b156f6b60..9e12c8aa7 100644
--- a/server/tests/plugins/action-hooks.ts
+++ b/server/tests/plugins/action-hooks.ts
@@ -9,10 +9,7 @@ import {
9 reRunServer, 9 reRunServer,
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 setDefaultVideoChannel, 12 setDefaultVideoChannel
13 updateVideo,
14 uploadVideo,
15 viewVideo
16} from '@shared/extra-utils' 13} from '@shared/extra-utils'
17import { ServerHookName, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models' 14import { ServerHookName, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'
18 15
@@ -52,20 +49,20 @@ describe('Test plugin action hooks', function () {
52 describe('Videos hooks', function () { 49 describe('Videos hooks', function () {
53 50
54 it('Should run action:api.video.uploaded', async function () { 51 it('Should run action:api.video.uploaded', async function () {
55 const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video' }) 52 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video' } })
56 videoUUID = res.body.video.uuid 53 videoUUID = uuid
57 54
58 await checkHook('action:api.video.uploaded') 55 await checkHook('action:api.video.uploaded')
59 }) 56 })
60 57
61 it('Should run action:api.video.updated', async function () { 58 it('Should run action:api.video.updated', async function () {
62 await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, { name: 'video updated' }) 59 await servers[0].videosCommand.update({ id: videoUUID, attributes: { name: 'video updated' } })
63 60
64 await checkHook('action:api.video.updated') 61 await checkHook('action:api.video.updated')
65 }) 62 })
66 63
67 it('Should run action:api.video.viewed', async function () { 64 it('Should run action:api.video.viewed', async function () {
68 await viewVideo(servers[0].url, videoUUID) 65 await servers[0].videosCommand.view({ id: videoUUID })
69 66
70 await checkHook('action:api.video.viewed') 67 await checkHook('action:api.video.viewed')
71 }) 68 })
@@ -170,8 +167,8 @@ describe('Test plugin action hooks', function () {
170 } 167 }
171 168
172 { 169 {
173 const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'my super name' }) 170 const { id } = await servers[0].videosCommand.upload({ attributes: { name: 'my super name' } })
174 videoId = res.body.video.id 171 videoId = id
175 } 172 }
176 }) 173 })
177 174