diff options
Diffstat (limited to 'server/tests/plugins/action-hooks.ts')
-rw-r--r-- | server/tests/plugins/action-hooks.ts | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts index 9e12c8aa7..12d5c23c5 100644 --- a/server/tests/plugins/action-hooks.ts +++ b/server/tests/plugins/action-hooks.ts | |||
@@ -19,7 +19,7 @@ describe('Test plugin action hooks', function () { | |||
19 | let threadId: number | 19 | let threadId: number |
20 | 20 | ||
21 | function checkHook (hook: ServerHookName) { | 21 | function checkHook (hook: ServerHookName) { |
22 | return servers[0].serversCommand.waitUntilLog('Run hook ' + hook) | 22 | return servers[0].servers.waitUntilLog('Run hook ' + hook) |
23 | } | 23 | } |
24 | 24 | ||
25 | before(async function () { | 25 | before(async function () { |
@@ -29,7 +29,7 @@ describe('Test plugin action hooks', function () { | |||
29 | await setAccessTokensToServers(servers) | 29 | await setAccessTokensToServers(servers) |
30 | await setDefaultVideoChannel(servers) | 30 | await setDefaultVideoChannel(servers) |
31 | 31 | ||
32 | await servers[0].pluginsCommand.install({ path: PluginsCommand.getPluginTestPath() }) | 32 | await servers[0].plugins.install({ path: PluginsCommand.getPluginTestPath() }) |
33 | 33 | ||
34 | await killallServers([ servers[0] ]) | 34 | await killallServers([ servers[0] ]) |
35 | 35 | ||
@@ -49,20 +49,20 @@ describe('Test plugin action hooks', function () { | |||
49 | describe('Videos hooks', function () { | 49 | describe('Videos hooks', function () { |
50 | 50 | ||
51 | it('Should run action:api.video.uploaded', async function () { | 51 | it('Should run action:api.video.uploaded', async function () { |
52 | const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video' } }) | 52 | const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video' } }) |
53 | videoUUID = uuid | 53 | videoUUID = uuid |
54 | 54 | ||
55 | await checkHook('action:api.video.uploaded') | 55 | await checkHook('action:api.video.uploaded') |
56 | }) | 56 | }) |
57 | 57 | ||
58 | it('Should run action:api.video.updated', async function () { | 58 | it('Should run action:api.video.updated', async function () { |
59 | await servers[0].videosCommand.update({ id: videoUUID, attributes: { name: 'video updated' } }) | 59 | await servers[0].videos.update({ id: videoUUID, attributes: { name: 'video updated' } }) |
60 | 60 | ||
61 | await checkHook('action:api.video.updated') | 61 | await checkHook('action:api.video.updated') |
62 | }) | 62 | }) |
63 | 63 | ||
64 | it('Should run action:api.video.viewed', async function () { | 64 | it('Should run action:api.video.viewed', async function () { |
65 | await servers[0].videosCommand.view({ id: videoUUID }) | 65 | await servers[0].videos.view({ id: videoUUID }) |
66 | 66 | ||
67 | await checkHook('action:api.video.viewed') | 67 | await checkHook('action:api.video.viewed') |
68 | }) | 68 | }) |
@@ -74,10 +74,10 @@ describe('Test plugin action hooks', function () { | |||
74 | const attributes = { | 74 | const attributes = { |
75 | name: 'live', | 75 | name: 'live', |
76 | privacy: VideoPrivacy.PUBLIC, | 76 | privacy: VideoPrivacy.PUBLIC, |
77 | channelId: servers[0].videoChannel.id | 77 | channelId: servers[0].store.channel.id |
78 | } | 78 | } |
79 | 79 | ||
80 | await servers[0].liveCommand.create({ fields: attributes }) | 80 | await servers[0].live.create({ fields: attributes }) |
81 | 81 | ||
82 | await checkHook('action:api.live-video.created') | 82 | await checkHook('action:api.live-video.created') |
83 | }) | 83 | }) |
@@ -85,20 +85,20 @@ describe('Test plugin action hooks', function () { | |||
85 | 85 | ||
86 | describe('Comments hooks', function () { | 86 | describe('Comments hooks', function () { |
87 | it('Should run action:api.video-thread.created', async function () { | 87 | it('Should run action:api.video-thread.created', async function () { |
88 | const created = await servers[0].commentsCommand.createThread({ videoId: videoUUID, text: 'thread' }) | 88 | const created = await servers[0].comments.createThread({ videoId: videoUUID, text: 'thread' }) |
89 | threadId = created.id | 89 | threadId = created.id |
90 | 90 | ||
91 | await checkHook('action:api.video-thread.created') | 91 | await checkHook('action:api.video-thread.created') |
92 | }) | 92 | }) |
93 | 93 | ||
94 | it('Should run action:api.video-comment-reply.created', async function () { | 94 | it('Should run action:api.video-comment-reply.created', async function () { |
95 | await servers[0].commentsCommand.addReply({ videoId: videoUUID, toCommentId: threadId, text: 'reply' }) | 95 | await servers[0].comments.addReply({ videoId: videoUUID, toCommentId: threadId, text: 'reply' }) |
96 | 96 | ||
97 | await checkHook('action:api.video-comment-reply.created') | 97 | await checkHook('action:api.video-comment-reply.created') |
98 | }) | 98 | }) |
99 | 99 | ||
100 | it('Should run action:api.video-comment.deleted', async function () { | 100 | it('Should run action:api.video-comment.deleted', async function () { |
101 | await servers[0].commentsCommand.delete({ videoId: videoUUID, commentId: threadId }) | 101 | await servers[0].comments.delete({ videoId: videoUUID, commentId: threadId }) |
102 | 102 | ||
103 | await checkHook('action:api.video-comment.deleted') | 103 | await checkHook('action:api.video-comment.deleted') |
104 | }) | 104 | }) |
@@ -108,44 +108,44 @@ describe('Test plugin action hooks', function () { | |||
108 | let userId: number | 108 | let userId: number |
109 | 109 | ||
110 | it('Should run action:api.user.registered', async function () { | 110 | it('Should run action:api.user.registered', async function () { |
111 | await servers[0].usersCommand.register({ username: 'registered_user' }) | 111 | await servers[0].users.register({ username: 'registered_user' }) |
112 | 112 | ||
113 | await checkHook('action:api.user.registered') | 113 | await checkHook('action:api.user.registered') |
114 | }) | 114 | }) |
115 | 115 | ||
116 | it('Should run action:api.user.created', async function () { | 116 | it('Should run action:api.user.created', async function () { |
117 | const user = await servers[0].usersCommand.create({ username: 'created_user' }) | 117 | const user = await servers[0].users.create({ username: 'created_user' }) |
118 | userId = user.id | 118 | userId = user.id |
119 | 119 | ||
120 | await checkHook('action:api.user.created') | 120 | await checkHook('action:api.user.created') |
121 | }) | 121 | }) |
122 | 122 | ||
123 | it('Should run action:api.user.oauth2-got-token', async function () { | 123 | it('Should run action:api.user.oauth2-got-token', async function () { |
124 | await servers[0].loginCommand.getAccessToken('created_user', 'super_password') | 124 | await servers[0].login.getAccessToken('created_user', 'super_password') |
125 | 125 | ||
126 | await checkHook('action:api.user.oauth2-got-token') | 126 | await checkHook('action:api.user.oauth2-got-token') |
127 | }) | 127 | }) |
128 | 128 | ||
129 | it('Should run action:api.user.blocked', async function () { | 129 | it('Should run action:api.user.blocked', async function () { |
130 | await servers[0].usersCommand.banUser({ userId }) | 130 | await servers[0].users.banUser({ userId }) |
131 | 131 | ||
132 | await checkHook('action:api.user.blocked') | 132 | await checkHook('action:api.user.blocked') |
133 | }) | 133 | }) |
134 | 134 | ||
135 | it('Should run action:api.user.unblocked', async function () { | 135 | it('Should run action:api.user.unblocked', async function () { |
136 | await servers[0].usersCommand.unbanUser({ userId }) | 136 | await servers[0].users.unbanUser({ userId }) |
137 | 137 | ||
138 | await checkHook('action:api.user.unblocked') | 138 | await checkHook('action:api.user.unblocked') |
139 | }) | 139 | }) |
140 | 140 | ||
141 | it('Should run action:api.user.updated', async function () { | 141 | it('Should run action:api.user.updated', async function () { |
142 | await servers[0].usersCommand.update({ userId, videoQuota: 50 }) | 142 | await servers[0].users.update({ userId, videoQuota: 50 }) |
143 | 143 | ||
144 | await checkHook('action:api.user.updated') | 144 | await checkHook('action:api.user.updated') |
145 | }) | 145 | }) |
146 | 146 | ||
147 | it('Should run action:api.user.deleted', async function () { | 147 | it('Should run action:api.user.deleted', async function () { |
148 | await servers[0].usersCommand.remove({ userId }) | 148 | await servers[0].users.remove({ userId }) |
149 | 149 | ||
150 | await checkHook('action:api.user.deleted') | 150 | await checkHook('action:api.user.deleted') |
151 | }) | 151 | }) |
@@ -157,7 +157,7 @@ describe('Test plugin action hooks', function () { | |||
157 | 157 | ||
158 | before(async function () { | 158 | before(async function () { |
159 | { | 159 | { |
160 | const { id } = await servers[0].playlistsCommand.create({ | 160 | const { id } = await servers[0].playlists.create({ |
161 | attributes: { | 161 | attributes: { |
162 | displayName: 'My playlist', | 162 | displayName: 'My playlist', |
163 | privacy: VideoPlaylistPrivacy.PRIVATE | 163 | privacy: VideoPlaylistPrivacy.PRIVATE |
@@ -167,13 +167,13 @@ describe('Test plugin action hooks', function () { | |||
167 | } | 167 | } |
168 | 168 | ||
169 | { | 169 | { |
170 | const { id } = await servers[0].videosCommand.upload({ attributes: { name: 'my super name' } }) | 170 | const { id } = await servers[0].videos.upload({ attributes: { name: 'my super name' } }) |
171 | videoId = id | 171 | videoId = id |
172 | } | 172 | } |
173 | }) | 173 | }) |
174 | 174 | ||
175 | it('Should run action:api.video-playlist-element.created', async function () { | 175 | it('Should run action:api.video-playlist-element.created', async function () { |
176 | await servers[0].playlistsCommand.addElement({ playlistId, attributes: { videoId } }) | 176 | await servers[0].playlists.addElement({ playlistId, attributes: { videoId } }) |
177 | 177 | ||
178 | await checkHook('action:api.video-playlist-element.created') | 178 | await checkHook('action:api.video-playlist-element.created') |
179 | }) | 179 | }) |