diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-15 10:02:54 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | d23dd9fbfc4d26026352c10f81d2795ceaf2908a (patch) | |
tree | da82286d423c5e834a1ee2dcd5970076b8263cf1 /server/tests/plugins/action-hooks.ts | |
parent | 7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (diff) | |
download | PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.gz PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.zst PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.zip |
Introduce videos command
Diffstat (limited to 'server/tests/plugins/action-hooks.ts')
-rw-r--r-- | server/tests/plugins/action-hooks.ts | 17 |
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' |
17 | import { ServerHookName, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models' | 14 | import { 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 | ||