aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 09:04:35 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit89d241a79c262b9775c233b73cff080043ebb5e6 (patch)
treecb3b6cb431d25d891ef4e02f66c61d252d17048f /server/tests/plugins
parentd23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff)
downloadPeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip
Shorter server command names
Diffstat (limited to 'server/tests/plugins')
-rw-r--r--server/tests/plugins/action-hooks.ts40
-rw-r--r--server/tests/plugins/external-auth.ts66
-rw-r--r--server/tests/plugins/filter-hooks.ts160
-rw-r--r--server/tests/plugins/html-injection.ts2
-rw-r--r--server/tests/plugins/id-and-pass-auth.ts64
-rw-r--r--server/tests/plugins/plugin-helpers.ts42
-rw-r--r--server/tests/plugins/plugin-router.ts4
-rw-r--r--server/tests/plugins/plugin-storage.ts12
-rw-r--r--server/tests/plugins/plugin-transcoding.ts52
-rw-r--r--server/tests/plugins/plugin-unloading.ts6
-rw-r--r--server/tests/plugins/translations.ts2
-rw-r--r--server/tests/plugins/video-constants.ts32
12 files changed, 241 insertions, 241 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 })
diff --git a/server/tests/plugins/external-auth.ts b/server/tests/plugins/external-auth.ts
index 3e8305611..48f942f7f 100644
--- a/server/tests/plugins/external-auth.ts
+++ b/server/tests/plugins/external-auth.ts
@@ -23,7 +23,7 @@ async function loginExternal (options: {
23 statusCodeExpected?: HttpStatusCode 23 statusCodeExpected?: HttpStatusCode
24 statusCodeExpectedStep2?: HttpStatusCode 24 statusCodeExpectedStep2?: HttpStatusCode
25}) { 25}) {
26 const res = await options.server.pluginsCommand.getExternalAuth({ 26 const res = await options.server.plugins.getExternalAuth({
27 npmName: options.npmName, 27 npmName: options.npmName,
28 npmVersion: '0.0.1', 28 npmVersion: '0.0.1',
29 authName: options.authName, 29 authName: options.authName,
@@ -36,7 +36,7 @@ async function loginExternal (options: {
36 const location = res.header.location 36 const location = res.header.location
37 const { externalAuthToken } = decodeQueryString(location) 37 const { externalAuthToken } = decodeQueryString(location)
38 38
39 const resLogin = await options.server.loginCommand.loginUsingExternalToken({ 39 const resLogin = await options.server.login.loginUsingExternalToken({
40 username: options.username, 40 username: options.username,
41 externalAuthToken: externalAuthToken as string, 41 externalAuthToken: externalAuthToken as string,
42 expectedStatus: options.statusCodeExpectedStep2 42 expectedStatus: options.statusCodeExpectedStep2
@@ -63,12 +63,12 @@ describe('Test external auth plugins', function () {
63 await setAccessTokensToServers([ server ]) 63 await setAccessTokensToServers([ server ])
64 64
65 for (const suffix of [ 'one', 'two', 'three' ]) { 65 for (const suffix of [ 'one', 'two', 'three' ]) {
66 await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-external-auth-' + suffix) }) 66 await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-external-auth-' + suffix) })
67 } 67 }
68 }) 68 })
69 69
70 it('Should display the correct configuration', async function () { 70 it('Should display the correct configuration', async function () {
71 const config = await server.configCommand.getConfig() 71 const config = await server.config.getConfig()
72 72
73 const auths = config.plugin.registeredExternalAuths 73 const auths = config.plugin.registeredExternalAuths
74 expect(auths).to.have.lengthOf(8) 74 expect(auths).to.have.lengthOf(8)
@@ -80,7 +80,7 @@ describe('Test external auth plugins', function () {
80 }) 80 })
81 81
82 it('Should redirect for a Cyan login', async function () { 82 it('Should redirect for a Cyan login', async function () {
83 const res = await server.pluginsCommand.getExternalAuth({ 83 const res = await server.plugins.getExternalAuth({
84 npmName: 'test-external-auth-one', 84 npmName: 'test-external-auth-one',
85 npmVersion: '0.0.1', 85 npmVersion: '0.0.1',
86 authName: 'external-auth-1', 86 authName: 'external-auth-1',
@@ -102,14 +102,14 @@ describe('Test external auth plugins', function () {
102 }) 102 })
103 103
104 it('Should reject auto external login with a missing or invalid token', async function () { 104 it('Should reject auto external login with a missing or invalid token', async function () {
105 const command = server.loginCommand 105 const command = server.login
106 106
107 await command.loginUsingExternalToken({ username: 'cyan', externalAuthToken: '', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 107 await command.loginUsingExternalToken({ username: 'cyan', externalAuthToken: '', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
108 await command.loginUsingExternalToken({ username: 'cyan', externalAuthToken: 'blabla', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 108 await command.loginUsingExternalToken({ username: 'cyan', externalAuthToken: 'blabla', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
109 }) 109 })
110 110
111 it('Should reject auto external login with a missing or invalid username', async function () { 111 it('Should reject auto external login with a missing or invalid username', async function () {
112 const command = server.loginCommand 112 const command = server.login
113 113
114 await command.loginUsingExternalToken({ username: '', externalAuthToken, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 114 await command.loginUsingExternalToken({ username: '', externalAuthToken, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
115 await command.loginUsingExternalToken({ username: '', externalAuthToken, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 115 await command.loginUsingExternalToken({ username: '', externalAuthToken, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
@@ -120,13 +120,13 @@ describe('Test external auth plugins', function () {
120 120
121 await wait(5000) 121 await wait(5000)
122 122
123 await server.loginCommand.loginUsingExternalToken({ 123 await server.login.loginUsingExternalToken({
124 username: 'cyan', 124 username: 'cyan',
125 externalAuthToken, 125 externalAuthToken,
126 expectedStatus: HttpStatusCode.BAD_REQUEST_400 126 expectedStatus: HttpStatusCode.BAD_REQUEST_400
127 }) 127 })
128 128
129 await server.serversCommand.waitUntilLog('expired external auth token', 2) 129 await server.servers.waitUntilLog('expired external auth token', 2)
130 }) 130 })
131 131
132 it('Should auto login Cyan, create the user and use the token', async function () { 132 it('Should auto login Cyan, create the user and use the token', async function () {
@@ -146,7 +146,7 @@ describe('Test external auth plugins', function () {
146 } 146 }
147 147
148 { 148 {
149 const body = await server.usersCommand.getMyInfo({ token: cyanAccessToken }) 149 const body = await server.users.getMyInfo({ token: cyanAccessToken })
150 expect(body.username).to.equal('cyan') 150 expect(body.username).to.equal('cyan')
151 expect(body.account.displayName).to.equal('cyan') 151 expect(body.account.displayName).to.equal('cyan')
152 expect(body.email).to.equal('cyan@example.com') 152 expect(body.email).to.equal('cyan@example.com')
@@ -168,7 +168,7 @@ describe('Test external auth plugins', function () {
168 } 168 }
169 169
170 { 170 {
171 const body = await server.usersCommand.getMyInfo({ token: kefkaAccessToken }) 171 const body = await server.users.getMyInfo({ token: kefkaAccessToken })
172 expect(body.username).to.equal('kefka') 172 expect(body.username).to.equal('kefka')
173 expect(body.account.displayName).to.equal('Kefka Palazzo') 173 expect(body.account.displayName).to.equal('Kefka Palazzo')
174 expect(body.email).to.equal('kefka@example.com') 174 expect(body.email).to.equal('kefka@example.com')
@@ -178,39 +178,39 @@ describe('Test external auth plugins', function () {
178 178
179 it('Should refresh Cyan token, but not Kefka token', async function () { 179 it('Should refresh Cyan token, but not Kefka token', async function () {
180 { 180 {
181 const resRefresh = await server.loginCommand.refreshToken({ refreshToken: cyanRefreshToken }) 181 const resRefresh = await server.login.refreshToken({ refreshToken: cyanRefreshToken })
182 cyanAccessToken = resRefresh.body.access_token 182 cyanAccessToken = resRefresh.body.access_token
183 cyanRefreshToken = resRefresh.body.refresh_token 183 cyanRefreshToken = resRefresh.body.refresh_token
184 184
185 const body = await server.usersCommand.getMyInfo({ token: cyanAccessToken }) 185 const body = await server.users.getMyInfo({ token: cyanAccessToken })
186 expect(body.username).to.equal('cyan') 186 expect(body.username).to.equal('cyan')
187 } 187 }
188 188
189 { 189 {
190 await server.loginCommand.refreshToken({ refreshToken: kefkaRefreshToken, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 190 await server.login.refreshToken({ refreshToken: kefkaRefreshToken, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
191 } 191 }
192 }) 192 })
193 193
194 it('Should update Cyan profile', async function () { 194 it('Should update Cyan profile', async function () {
195 await server.usersCommand.updateMe({ 195 await server.users.updateMe({
196 token: cyanAccessToken, 196 token: cyanAccessToken,
197 displayName: 'Cyan Garamonde', 197 displayName: 'Cyan Garamonde',
198 description: 'Retainer to the king of Doma' 198 description: 'Retainer to the king of Doma'
199 }) 199 })
200 200
201 const body = await server.usersCommand.getMyInfo({ token: cyanAccessToken }) 201 const body = await server.users.getMyInfo({ token: cyanAccessToken })
202 expect(body.account.displayName).to.equal('Cyan Garamonde') 202 expect(body.account.displayName).to.equal('Cyan Garamonde')
203 expect(body.account.description).to.equal('Retainer to the king of Doma') 203 expect(body.account.description).to.equal('Retainer to the king of Doma')
204 }) 204 })
205 205
206 it('Should logout Cyan', async function () { 206 it('Should logout Cyan', async function () {
207 await server.loginCommand.logout({ token: cyanAccessToken }) 207 await server.login.logout({ token: cyanAccessToken })
208 }) 208 })
209 209
210 it('Should have logged out Cyan', async function () { 210 it('Should have logged out Cyan', async function () {
211 await server.serversCommand.waitUntilLog('On logout cyan') 211 await server.servers.waitUntilLog('On logout cyan')
212 212
213 await server.usersCommand.getMyInfo({ token: cyanAccessToken, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 213 await server.users.getMyInfo({ token: cyanAccessToken, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
214 }) 214 })
215 215
216 it('Should login Cyan and keep the old existing profile', async function () { 216 it('Should login Cyan and keep the old existing profile', async function () {
@@ -228,7 +228,7 @@ describe('Test external auth plugins', function () {
228 cyanAccessToken = res.access_token 228 cyanAccessToken = res.access_token
229 } 229 }
230 230
231 const body = await server.usersCommand.getMyInfo({ token: cyanAccessToken }) 231 const body = await server.users.getMyInfo({ token: cyanAccessToken })
232 expect(body.username).to.equal('cyan') 232 expect(body.username).to.equal('cyan')
233 expect(body.account.displayName).to.equal('Cyan Garamonde') 233 expect(body.account.displayName).to.equal('Cyan Garamonde')
234 expect(body.account.description).to.equal('Retainer to the king of Doma') 234 expect(body.account.description).to.equal('Retainer to the king of Doma')
@@ -236,7 +236,7 @@ describe('Test external auth plugins', function () {
236 }) 236 })
237 237
238 it('Should not update an external auth email', async function () { 238 it('Should not update an external auth email', async function () {
239 await server.usersCommand.updateMe({ 239 await server.users.updateMe({
240 token: cyanAccessToken, 240 token: cyanAccessToken,
241 email: 'toto@example.com', 241 email: 'toto@example.com',
242 currentPassword: 'toto', 242 currentPassword: 'toto',
@@ -249,16 +249,16 @@ describe('Test external auth plugins', function () {
249 249
250 await wait(5000) 250 await wait(5000)
251 251
252 await server.usersCommand.getMyInfo({ token: kefkaAccessToken, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 252 await server.users.getMyInfo({ token: kefkaAccessToken, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
253 }) 253 })
254 254
255 it('Should unregister external-auth-2 and do not login existing Kefka', async function () { 255 it('Should unregister external-auth-2 and do not login existing Kefka', async function () {
256 await server.pluginsCommand.updateSettings({ 256 await server.plugins.updateSettings({
257 npmName: 'peertube-plugin-test-external-auth-one', 257 npmName: 'peertube-plugin-test-external-auth-one',
258 settings: { disableKefka: true } 258 settings: { disableKefka: true }
259 }) 259 })
260 260
261 await server.loginCommand.login({ user: { username: 'kefka', password: 'fake' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 261 await server.login.login({ user: { username: 'kefka', password: 'fake' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
262 262
263 await loginExternal({ 263 await loginExternal({
264 server, 264 server,
@@ -273,7 +273,7 @@ describe('Test external auth plugins', function () {
273 }) 273 })
274 274
275 it('Should have disabled this auth', async function () { 275 it('Should have disabled this auth', async function () {
276 const config = await server.configCommand.getConfig() 276 const config = await server.config.getConfig()
277 277
278 const auths = config.plugin.registeredExternalAuths 278 const auths = config.plugin.registeredExternalAuths
279 expect(auths).to.have.lengthOf(7) 279 expect(auths).to.have.lengthOf(7)
@@ -283,7 +283,7 @@ describe('Test external auth plugins', function () {
283 }) 283 })
284 284
285 it('Should uninstall the plugin one and do not login Cyan', async function () { 285 it('Should uninstall the plugin one and do not login Cyan', async function () {
286 await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-external-auth-one' }) 286 await server.plugins.uninstall({ npmName: 'peertube-plugin-test-external-auth-one' })
287 287
288 await loginExternal({ 288 await loginExternal({
289 server, 289 server,
@@ -296,9 +296,9 @@ describe('Test external auth plugins', function () {
296 statusCodeExpected: HttpStatusCode.NOT_FOUND_404 296 statusCodeExpected: HttpStatusCode.NOT_FOUND_404
297 }) 297 })
298 298
299 await server.loginCommand.login({ user: { username: 'cyan', password: null }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 299 await server.login.login({ user: { username: 'cyan', password: null }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
300 await server.loginCommand.login({ user: { username: 'cyan', password: '' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 300 await server.login.login({ user: { username: 'cyan', password: '' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
301 await server.loginCommand.login({ user: { username: 'cyan', password: 'fake' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 301 await server.login.login({ user: { username: 'cyan', password: 'fake' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
302 }) 302 })
303 303
304 it('Should not login kefka with another plugin', async function () { 304 it('Should not login kefka with another plugin', async function () {
@@ -320,7 +320,7 @@ describe('Test external auth plugins', function () {
320 }) 320 })
321 321
322 it('Should not login an existing user', async function () { 322 it('Should not login an existing user', async function () {
323 await server.usersCommand.create({ username: 'existing_user', password: 'super_password' }) 323 await server.users.create({ username: 'existing_user', password: 'super_password' })
324 324
325 await loginExternal({ 325 await loginExternal({
326 server, 326 server,
@@ -332,7 +332,7 @@ describe('Test external auth plugins', function () {
332 }) 332 })
333 333
334 it('Should display the correct configuration', async function () { 334 it('Should display the correct configuration', async function () {
335 const config = await server.configCommand.getConfig() 335 const config = await server.config.getConfig()
336 336
337 const auths = config.plugin.registeredExternalAuths 337 const auths = config.plugin.registeredExternalAuths
338 expect(auths).to.have.lengthOf(6) 338 expect(auths).to.have.lengthOf(6)
@@ -353,7 +353,7 @@ describe('Test external auth plugins', function () {
353 username: 'cid' 353 username: 'cid'
354 }) 354 })
355 355
356 const { redirectUrl } = await server.loginCommand.logout({ token: resLogin.access_token }) 356 const { redirectUrl } = await server.login.logout({ token: resLogin.access_token })
357 expect(redirectUrl).to.equal('https://example.com/redirectUrl') 357 expect(redirectUrl).to.equal('https://example.com/redirectUrl')
358 }) 358 })
359 359
@@ -365,7 +365,7 @@ describe('Test external auth plugins', function () {
365 username: 'cid' 365 username: 'cid'
366 }) 366 })
367 367
368 const { redirectUrl } = await server.loginCommand.logout({ token: resLogin.access_token }) 368 const { redirectUrl } = await server.login.logout({ token: resLogin.access_token })
369 expect(redirectUrl).to.equal('https://example.com/redirectUrl?access_token=' + resLogin.access_token) 369 expect(redirectUrl).to.equal('https://example.com/redirectUrl?access_token=' + resLogin.access_token)
370 }) 370 })
371}) 371})
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts
index e82aa3bfb..18479dcf5 100644
--- a/server/tests/plugins/filter-hooks.ts
+++ b/server/tests/plugins/filter-hooks.ts
@@ -32,17 +32,17 @@ describe('Test plugin filter hooks', function () {
32 await setDefaultVideoChannel(servers) 32 await setDefaultVideoChannel(servers)
33 await doubleFollow(servers[0], servers[1]) 33 await doubleFollow(servers[0], servers[1])
34 34
35 await servers[0].pluginsCommand.install({ path: PluginsCommand.getPluginTestPath() }) 35 await servers[0].plugins.install({ path: PluginsCommand.getPluginTestPath() })
36 await servers[0].pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-filter-translations') }) 36 await servers[0].plugins.install({ path: PluginsCommand.getPluginTestPath('-filter-translations') })
37 37
38 for (let i = 0; i < 10; i++) { 38 for (let i = 0; i < 10; i++) {
39 await servers[0].videosCommand.upload({ attributes: { name: 'default video ' + i } }) 39 await servers[0].videos.upload({ attributes: { name: 'default video ' + i } })
40 } 40 }
41 41
42 const { data } = await servers[0].videosCommand.list() 42 const { data } = await servers[0].videos.list()
43 videoUUID = data[0].uuid 43 videoUUID = data[0].uuid
44 44
45 await servers[0].configCommand.updateCustomSubConfig({ 45 await servers[0].config.updateCustomSubConfig({
46 newConfig: { 46 newConfig: {
47 live: { enabled: true }, 47 live: { enabled: true },
48 signup: { enabled: true }, 48 signup: { enabled: true },
@@ -57,98 +57,98 @@ describe('Test plugin filter hooks', function () {
57 }) 57 })
58 58
59 it('Should run filter:api.videos.list.params', async function () { 59 it('Should run filter:api.videos.list.params', async function () {
60 const { data } = await servers[0].videosCommand.list({ start: 0, count: 2 }) 60 const { data } = await servers[0].videos.list({ start: 0, count: 2 })
61 61
62 // 2 plugins do +1 to the count parameter 62 // 2 plugins do +1 to the count parameter
63 expect(data).to.have.lengthOf(4) 63 expect(data).to.have.lengthOf(4)
64 }) 64 })
65 65
66 it('Should run filter:api.videos.list.result', async function () { 66 it('Should run filter:api.videos.list.result', async function () {
67 const { total } = await servers[0].videosCommand.list({ start: 0, count: 0 }) 67 const { total } = await servers[0].videos.list({ start: 0, count: 0 })
68 68
69 // Plugin do +1 to the total result 69 // Plugin do +1 to the total result
70 expect(total).to.equal(11) 70 expect(total).to.equal(11)
71 }) 71 })
72 72
73 it('Should run filter:api.accounts.videos.list.params', async function () { 73 it('Should run filter:api.accounts.videos.list.params', async function () {
74 const { data } = await servers[0].videosCommand.listByAccount({ accountName: 'root', start: 0, count: 2 }) 74 const { data } = await servers[0].videos.listByAccount({ accountName: 'root', start: 0, count: 2 })
75 75
76 // 1 plugin do +1 to the count parameter 76 // 1 plugin do +1 to the count parameter
77 expect(data).to.have.lengthOf(3) 77 expect(data).to.have.lengthOf(3)
78 }) 78 })
79 79
80 it('Should run filter:api.accounts.videos.list.result', async function () { 80 it('Should run filter:api.accounts.videos.list.result', async function () {
81 const { total } = await servers[0].videosCommand.listByAccount({ accountName: 'root', start: 0, count: 2 }) 81 const { total } = await servers[0].videos.listByAccount({ accountName: 'root', start: 0, count: 2 })
82 82
83 // Plugin do +2 to the total result 83 // Plugin do +2 to the total result
84 expect(total).to.equal(12) 84 expect(total).to.equal(12)
85 }) 85 })
86 86
87 it('Should run filter:api.video-channels.videos.list.params', async function () { 87 it('Should run filter:api.video-channels.videos.list.params', async function () {
88 const { data } = await servers[0].videosCommand.listByChannel({ videoChannelName: 'root_channel', start: 0, count: 2 }) 88 const { data } = await servers[0].videos.listByChannel({ videoChannelName: 'root_channel', start: 0, count: 2 })
89 89
90 // 1 plugin do +3 to the count parameter 90 // 1 plugin do +3 to the count parameter
91 expect(data).to.have.lengthOf(5) 91 expect(data).to.have.lengthOf(5)
92 }) 92 })
93 93
94 it('Should run filter:api.video-channels.videos.list.result', async function () { 94 it('Should run filter:api.video-channels.videos.list.result', async function () {
95 const { total } = await servers[0].videosCommand.listByChannel({ videoChannelName: 'root_channel', start: 0, count: 2 }) 95 const { total } = await servers[0].videos.listByChannel({ videoChannelName: 'root_channel', start: 0, count: 2 })
96 96
97 // Plugin do +3 to the total result 97 // Plugin do +3 to the total result
98 expect(total).to.equal(13) 98 expect(total).to.equal(13)
99 }) 99 })
100 100
101 it('Should run filter:api.user.me.videos.list.params', async function () { 101 it('Should run filter:api.user.me.videos.list.params', async function () {
102 const { data } = await servers[0].videosCommand.listMyVideos({ start: 0, count: 2 }) 102 const { data } = await servers[0].videos.listMyVideos({ start: 0, count: 2 })
103 103
104 // 1 plugin do +4 to the count parameter 104 // 1 plugin do +4 to the count parameter
105 expect(data).to.have.lengthOf(6) 105 expect(data).to.have.lengthOf(6)
106 }) 106 })
107 107
108 it('Should run filter:api.user.me.videos.list.result', async function () { 108 it('Should run filter:api.user.me.videos.list.result', async function () {
109 const { total } = await servers[0].videosCommand.listMyVideos({ start: 0, count: 2 }) 109 const { total } = await servers[0].videos.listMyVideos({ start: 0, count: 2 })
110 110
111 // Plugin do +4 to the total result 111 // Plugin do +4 to the total result
112 expect(total).to.equal(14) 112 expect(total).to.equal(14)
113 }) 113 })
114 114
115 it('Should run filter:api.video.get.result', async function () { 115 it('Should run filter:api.video.get.result', async function () {
116 const video = await servers[0].videosCommand.get({ id: videoUUID }) 116 const video = await servers[0].videos.get({ id: videoUUID })
117 expect(video.name).to.contain('<3') 117 expect(video.name).to.contain('<3')
118 }) 118 })
119 119
120 it('Should run filter:api.video.upload.accept.result', async function () { 120 it('Should run filter:api.video.upload.accept.result', async function () {
121 await servers[0].videosCommand.upload({ attributes: { name: 'video with bad word' }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) 121 await servers[0].videos.upload({ attributes: { name: 'video with bad word' }, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
122 }) 122 })
123 123
124 it('Should run filter:api.live-video.create.accept.result', async function () { 124 it('Should run filter:api.live-video.create.accept.result', async function () {
125 const attributes = { 125 const attributes = {
126 name: 'video with bad word', 126 name: 'video with bad word',
127 privacy: VideoPrivacy.PUBLIC, 127 privacy: VideoPrivacy.PUBLIC,
128 channelId: servers[0].videoChannel.id 128 channelId: servers[0].store.channel.id
129 } 129 }
130 130
131 await servers[0].liveCommand.create({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) 131 await servers[0].live.create({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
132 }) 132 })
133 133
134 it('Should run filter:api.video.pre-import-url.accept.result', async function () { 134 it('Should run filter:api.video.pre-import-url.accept.result', async function () {
135 const attributes = { 135 const attributes = {
136 name: 'normal title', 136 name: 'normal title',
137 privacy: VideoPrivacy.PUBLIC, 137 privacy: VideoPrivacy.PUBLIC,
138 channelId: servers[0].videoChannel.id, 138 channelId: servers[0].store.channel.id,
139 targetUrl: ImportsCommand.getGoodVideoUrl() + 'bad' 139 targetUrl: ImportsCommand.getGoodVideoUrl() + 'bad'
140 } 140 }
141 await servers[0].importsCommand.importVideo({ attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) 141 await servers[0].imports.importVideo({ attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
142 }) 142 })
143 143
144 it('Should run filter:api.video.pre-import-torrent.accept.result', async function () { 144 it('Should run filter:api.video.pre-import-torrent.accept.result', async function () {
145 const attributes = { 145 const attributes = {
146 name: 'bad torrent', 146 name: 'bad torrent',
147 privacy: VideoPrivacy.PUBLIC, 147 privacy: VideoPrivacy.PUBLIC,
148 channelId: servers[0].videoChannel.id, 148 channelId: servers[0].store.channel.id,
149 torrentfile: 'video-720p.torrent' as any 149 torrentfile: 'video-720p.torrent' as any
150 } 150 }
151 await servers[0].importsCommand.importVideo({ attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) 151 await servers[0].imports.importVideo({ attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
152 }) 152 })
153 153
154 it('Should run filter:api.video.post-import-url.accept.result', async function () { 154 it('Should run filter:api.video.post-import-url.accept.result', async function () {
@@ -160,17 +160,17 @@ describe('Test plugin filter hooks', function () {
160 const attributes = { 160 const attributes = {
161 name: 'title with bad word', 161 name: 'title with bad word',
162 privacy: VideoPrivacy.PUBLIC, 162 privacy: VideoPrivacy.PUBLIC,
163 channelId: servers[0].videoChannel.id, 163 channelId: servers[0].store.channel.id,
164 targetUrl: ImportsCommand.getGoodVideoUrl() 164 targetUrl: ImportsCommand.getGoodVideoUrl()
165 } 165 }
166 const body = await servers[0].importsCommand.importVideo({ attributes }) 166 const body = await servers[0].imports.importVideo({ attributes })
167 videoImportId = body.id 167 videoImportId = body.id
168 } 168 }
169 169
170 await waitJobs(servers) 170 await waitJobs(servers)
171 171
172 { 172 {
173 const body = await servers[0].importsCommand.getMyVideoImports() 173 const body = await servers[0].imports.getMyVideoImports()
174 const videoImports = body.data 174 const videoImports = body.data
175 175
176 const videoImport = videoImports.find(i => i.id === videoImportId) 176 const videoImport = videoImports.find(i => i.id === videoImportId)
@@ -189,17 +189,17 @@ describe('Test plugin filter hooks', function () {
189 const attributes = { 189 const attributes = {
190 name: 'title with bad word', 190 name: 'title with bad word',
191 privacy: VideoPrivacy.PUBLIC, 191 privacy: VideoPrivacy.PUBLIC,
192 channelId: servers[0].videoChannel.id, 192 channelId: servers[0].store.channel.id,
193 torrentfile: 'video-720p.torrent' as any 193 torrentfile: 'video-720p.torrent' as any
194 } 194 }
195 const body = await servers[0].importsCommand.importVideo({ attributes }) 195 const body = await servers[0].imports.importVideo({ attributes })
196 videoImportId = body.id 196 videoImportId = body.id
197 } 197 }
198 198
199 await waitJobs(servers) 199 await waitJobs(servers)
200 200
201 { 201 {
202 const { data: videoImports } = await servers[0].importsCommand.getMyVideoImports() 202 const { data: videoImports } = await servers[0].imports.getMyVideoImports()
203 203
204 const videoImport = videoImports.find(i => i.id === videoImportId) 204 const videoImport = videoImports.find(i => i.id === videoImportId)
205 205
@@ -209,7 +209,7 @@ describe('Test plugin filter hooks', function () {
209 }) 209 })
210 210
211 it('Should run filter:api.video-thread.create.accept.result', async function () { 211 it('Should run filter:api.video-thread.create.accept.result', async function () {
212 await servers[0].commentsCommand.createThread({ 212 await servers[0].comments.createThread({
213 videoId: videoUUID, 213 videoId: videoUUID,
214 text: 'comment with bad word', 214 text: 'comment with bad word',
215 expectedStatus: HttpStatusCode.FORBIDDEN_403 215 expectedStatus: HttpStatusCode.FORBIDDEN_403
@@ -217,16 +217,16 @@ describe('Test plugin filter hooks', function () {
217 }) 217 })
218 218
219 it('Should run filter:api.video-comment-reply.create.accept.result', async function () { 219 it('Should run filter:api.video-comment-reply.create.accept.result', async function () {
220 const created = await servers[0].commentsCommand.createThread({ videoId: videoUUID, text: 'thread' }) 220 const created = await servers[0].comments.createThread({ videoId: videoUUID, text: 'thread' })
221 threadId = created.id 221 threadId = created.id
222 222
223 await servers[0].commentsCommand.addReply({ 223 await servers[0].comments.addReply({
224 videoId: videoUUID, 224 videoId: videoUUID,
225 toCommentId: threadId, 225 toCommentId: threadId,
226 text: 'comment with bad word', 226 text: 'comment with bad word',
227 expectedStatus: HttpStatusCode.FORBIDDEN_403 227 expectedStatus: HttpStatusCode.FORBIDDEN_403
228 }) 228 })
229 await servers[0].commentsCommand.addReply({ 229 await servers[0].comments.addReply({
230 videoId: videoUUID, 230 videoId: videoUUID,
231 toCommentId: threadId, 231 toCommentId: threadId,
232 text: 'comment with good word', 232 text: 'comment with good word',
@@ -235,14 +235,14 @@ describe('Test plugin filter hooks', function () {
235 }) 235 })
236 236
237 it('Should run filter:api.video-threads.list.params', async function () { 237 it('Should run filter:api.video-threads.list.params', async function () {
238 const { data } = await servers[0].commentsCommand.listThreads({ videoId: videoUUID, start: 0, count: 0 }) 238 const { data } = await servers[0].comments.listThreads({ videoId: videoUUID, start: 0, count: 0 })
239 239
240 // our plugin do +1 to the count parameter 240 // our plugin do +1 to the count parameter
241 expect(data).to.have.lengthOf(1) 241 expect(data).to.have.lengthOf(1)
242 }) 242 })
243 243
244 it('Should run filter:api.video-threads.list.result', async function () { 244 it('Should run filter:api.video-threads.list.result', async function () {
245 const { total } = await servers[0].commentsCommand.listThreads({ videoId: videoUUID, start: 0, count: 0 }) 245 const { total } = await servers[0].comments.listThreads({ videoId: videoUUID, start: 0, count: 0 })
246 246
247 // Plugin do +1 to the total result 247 // Plugin do +1 to the total result
248 expect(total).to.equal(2) 248 expect(total).to.equal(2)
@@ -251,7 +251,7 @@ describe('Test plugin filter hooks', function () {
251 it('Should run filter:api.video-thread-comments.list.params') 251 it('Should run filter:api.video-thread-comments.list.params')
252 252
253 it('Should run filter:api.video-thread-comments.list.result', async function () { 253 it('Should run filter:api.video-thread-comments.list.result', async function () {
254 const thread = await servers[0].commentsCommand.getThread({ videoId: videoUUID, threadId }) 254 const thread = await servers[0].comments.getThread({ videoId: videoUUID, threadId })
255 255
256 expect(thread.comment.text.endsWith(' <3')).to.be.true 256 expect(thread.comment.text.endsWith(' <3')).to.be.true
257 }) 257 })
@@ -259,12 +259,12 @@ describe('Test plugin filter hooks', function () {
259 describe('Should run filter:video.auto-blacklist.result', function () { 259 describe('Should run filter:video.auto-blacklist.result', function () {
260 260
261 async function checkIsBlacklisted (id: number | string, value: boolean) { 261 async function checkIsBlacklisted (id: number | string, value: boolean) {
262 const video = await servers[0].videosCommand.getWithToken({ id }) 262 const video = await servers[0].videos.getWithToken({ id })
263 expect(video.blacklisted).to.equal(value) 263 expect(video.blacklisted).to.equal(value)
264 } 264 }
265 265
266 it('Should blacklist on upload', async function () { 266 it('Should blacklist on upload', async function () {
267 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video please blacklist me' } }) 267 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video please blacklist me' } })
268 await checkIsBlacklisted(uuid, true) 268 await checkIsBlacklisted(uuid, true)
269 }) 269 })
270 270
@@ -274,24 +274,24 @@ describe('Test plugin filter hooks', function () {
274 const attributes = { 274 const attributes = {
275 name: 'video please blacklist me', 275 name: 'video please blacklist me',
276 targetUrl: ImportsCommand.getGoodVideoUrl(), 276 targetUrl: ImportsCommand.getGoodVideoUrl(),
277 channelId: servers[0].videoChannel.id 277 channelId: servers[0].store.channel.id
278 } 278 }
279 const body = await servers[0].importsCommand.importVideo({ attributes }) 279 const body = await servers[0].imports.importVideo({ attributes })
280 await checkIsBlacklisted(body.video.uuid, true) 280 await checkIsBlacklisted(body.video.uuid, true)
281 }) 281 })
282 282
283 it('Should blacklist on update', async function () { 283 it('Should blacklist on update', async function () {
284 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video' } }) 284 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video' } })
285 await checkIsBlacklisted(uuid, false) 285 await checkIsBlacklisted(uuid, false)
286 286
287 await servers[0].videosCommand.update({ id: uuid, attributes: { name: 'please blacklist me' } }) 287 await servers[0].videos.update({ id: uuid, attributes: { name: 'please blacklist me' } })
288 await checkIsBlacklisted(uuid, true) 288 await checkIsBlacklisted(uuid, true)
289 }) 289 })
290 290
291 it('Should blacklist on remote upload', async function () { 291 it('Should blacklist on remote upload', async function () {
292 this.timeout(120000) 292 this.timeout(120000)
293 293
294 const { uuid } = await servers[1].videosCommand.upload({ attributes: { name: 'remote please blacklist me' } }) 294 const { uuid } = await servers[1].videos.upload({ attributes: { name: 'remote please blacklist me' } })
295 await waitJobs(servers) 295 await waitJobs(servers)
296 296
297 await checkIsBlacklisted(uuid, true) 297 await checkIsBlacklisted(uuid, true)
@@ -300,12 +300,12 @@ describe('Test plugin filter hooks', function () {
300 it('Should blacklist on remote update', async function () { 300 it('Should blacklist on remote update', async function () {
301 this.timeout(120000) 301 this.timeout(120000)
302 302
303 const { uuid } = await servers[1].videosCommand.upload({ attributes: { name: 'video' } }) 303 const { uuid } = await servers[1].videos.upload({ attributes: { name: 'video' } })
304 await waitJobs(servers) 304 await waitJobs(servers)
305 305
306 await checkIsBlacklisted(uuid, false) 306 await checkIsBlacklisted(uuid, false)
307 307
308 await servers[1].videosCommand.update({ id: uuid, attributes: { name: 'please blacklist me' } }) 308 await servers[1].videos.update({ id: uuid, attributes: { name: 'please blacklist me' } })
309 await waitJobs(servers) 309 await waitJobs(servers)
310 310
311 await checkIsBlacklisted(uuid, true) 311 await checkIsBlacklisted(uuid, true)
@@ -315,16 +315,16 @@ describe('Test plugin filter hooks', function () {
315 describe('Should run filter:api.user.signup.allowed.result', function () { 315 describe('Should run filter:api.user.signup.allowed.result', function () {
316 316
317 it('Should run on config endpoint', async function () { 317 it('Should run on config endpoint', async function () {
318 const body = await servers[0].configCommand.getConfig() 318 const body = await servers[0].config.getConfig()
319 expect(body.signup.allowed).to.be.true 319 expect(body.signup.allowed).to.be.true
320 }) 320 })
321 321
322 it('Should allow a signup', async function () { 322 it('Should allow a signup', async function () {
323 await servers[0].usersCommand.register({ username: 'john', password: 'password' }) 323 await servers[0].users.register({ username: 'john', password: 'password' })
324 }) 324 })
325 325
326 it('Should not allow a signup', async function () { 326 it('Should not allow a signup', async function () {
327 const res = await servers[0].usersCommand.register({ 327 const res = await servers[0].users.register({
328 username: 'jma', 328 username: 'jma',
329 password: 'password', 329 password: 'password',
330 expectedStatus: HttpStatusCode.FORBIDDEN_403 330 expectedStatus: HttpStatusCode.FORBIDDEN_403
@@ -340,7 +340,7 @@ describe('Test plugin filter hooks', function () {
340 before(async function () { 340 before(async function () {
341 this.timeout(120000) 341 this.timeout(120000)
342 342
343 await servers[0].configCommand.updateCustomSubConfig({ 343 await servers[0].config.updateCustomSubConfig({
344 newConfig: { 344 newConfig: {
345 transcoding: { 345 transcoding: {
346 webtorrent: { 346 webtorrent: {
@@ -356,14 +356,14 @@ describe('Test plugin filter hooks', function () {
356 const uuids: string[] = [] 356 const uuids: string[] = []
357 357
358 for (const name of [ 'bad torrent', 'bad file', 'bad playlist file' ]) { 358 for (const name of [ 'bad torrent', 'bad file', 'bad playlist file' ]) {
359 const uuid = (await servers[0].videosCommand.quickUpload({ name: name })).uuid 359 const uuid = (await servers[0].videos.quickUpload({ name: name })).uuid
360 uuids.push(uuid) 360 uuids.push(uuid)
361 } 361 }
362 362
363 await waitJobs(servers) 363 await waitJobs(servers)
364 364
365 for (const uuid of uuids) { 365 for (const uuid of uuids) {
366 downloadVideos.push(await servers[0].videosCommand.get({ id: uuid })) 366 downloadVideos.push(await servers[0].videos.get({ id: uuid }))
367 } 367 }
368 }) 368 })
369 369
@@ -403,7 +403,7 @@ describe('Test plugin filter hooks', function () {
403 before(async function () { 403 before(async function () {
404 this.timeout(60000) 404 this.timeout(60000)
405 405
406 await servers[0].configCommand.updateCustomSubConfig({ 406 await servers[0].config.updateCustomSubConfig({
407 newConfig: { 407 newConfig: {
408 transcoding: { 408 transcoding: {
409 enabled: false 409 enabled: false
@@ -413,15 +413,15 @@ describe('Test plugin filter hooks', function () {
413 413
414 for (const name of [ 'bad embed', 'good embed' ]) { 414 for (const name of [ 'bad embed', 'good embed' ]) {
415 { 415 {
416 const uuid = (await servers[0].videosCommand.quickUpload({ name: name })).uuid 416 const uuid = (await servers[0].videos.quickUpload({ name: name })).uuid
417 embedVideos.push(await servers[0].videosCommand.get({ id: uuid })) 417 embedVideos.push(await servers[0].videos.get({ id: uuid }))
418 } 418 }
419 419
420 { 420 {
421 const attributes = { displayName: name, videoChannelId: servers[0].videoChannel.id, privacy: VideoPlaylistPrivacy.PUBLIC } 421 const attributes = { displayName: name, videoChannelId: servers[0].store.channel.id, privacy: VideoPlaylistPrivacy.PUBLIC }
422 const { id } = await servers[0].playlistsCommand.create({ attributes }) 422 const { id } = await servers[0].playlists.create({ attributes })
423 423
424 const playlist = await servers[0].playlistsCommand.get({ playlistId: id }) 424 const playlist = await servers[0].playlists.get({ playlistId: id })
425 embedPlaylists.push(playlist) 425 embedPlaylists.push(playlist)
426 } 426 }
427 } 427 }
@@ -441,7 +441,7 @@ describe('Test plugin filter hooks', function () {
441 describe('Search filters', function () { 441 describe('Search filters', function () {
442 442
443 before(async function () { 443 before(async function () {
444 await servers[0].configCommand.updateCustomSubConfig({ 444 await servers[0].config.updateCustomSubConfig({
445 newConfig: { 445 newConfig: {
446 search: { 446 search: {
447 searchIndex: { 447 searchIndex: {
@@ -455,78 +455,78 @@ describe('Test plugin filter hooks', function () {
455 }) 455 })
456 456
457 it('Should run filter:api.search.videos.local.list.{params,result}', async function () { 457 it('Should run filter:api.search.videos.local.list.{params,result}', async function () {
458 await servers[0].searchCommand.advancedVideoSearch({ 458 await servers[0].search.advancedVideoSearch({
459 search: { 459 search: {
460 search: 'Sun Quan' 460 search: 'Sun Quan'
461 } 461 }
462 }) 462 })
463 463
464 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.videos.local.list.params', 1) 464 await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.params', 1)
465 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.videos.local.list.result', 1) 465 await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.result', 1)
466 }) 466 })
467 467
468 it('Should run filter:api.search.videos.index.list.{params,result}', async function () { 468 it('Should run filter:api.search.videos.index.list.{params,result}', async function () {
469 await servers[0].searchCommand.advancedVideoSearch({ 469 await servers[0].search.advancedVideoSearch({
470 search: { 470 search: {
471 search: 'Sun Quan', 471 search: 'Sun Quan',
472 searchTarget: 'search-index' 472 searchTarget: 'search-index'
473 } 473 }
474 }) 474 })
475 475
476 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.videos.local.list.params', 1) 476 await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.params', 1)
477 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.videos.local.list.result', 1) 477 await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.result', 1)
478 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.videos.index.list.params', 1) 478 await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.index.list.params', 1)
479 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.videos.index.list.result', 1) 479 await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.index.list.result', 1)
480 }) 480 })
481 481
482 it('Should run filter:api.search.video-channels.local.list.{params,result}', async function () { 482 it('Should run filter:api.search.video-channels.local.list.{params,result}', async function () {
483 await servers[0].searchCommand.advancedChannelSearch({ 483 await servers[0].search.advancedChannelSearch({
484 search: { 484 search: {
485 search: 'Sun Ce' 485 search: 'Sun Ce'
486 } 486 }
487 }) 487 })
488 488
489 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-channels.local.list.params', 1) 489 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.params', 1)
490 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-channels.local.list.result', 1) 490 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.result', 1)
491 }) 491 })
492 492
493 it('Should run filter:api.search.video-channels.index.list.{params,result}', async function () { 493 it('Should run filter:api.search.video-channels.index.list.{params,result}', async function () {
494 await servers[0].searchCommand.advancedChannelSearch({ 494 await servers[0].search.advancedChannelSearch({
495 search: { 495 search: {
496 search: 'Sun Ce', 496 search: 'Sun Ce',
497 searchTarget: 'search-index' 497 searchTarget: 'search-index'
498 } 498 }
499 }) 499 })
500 500
501 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-channels.local.list.params', 1) 501 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.params', 1)
502 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-channels.local.list.result', 1) 502 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.result', 1)
503 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-channels.index.list.params', 1) 503 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.index.list.params', 1)
504 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-channels.index.list.result', 1) 504 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.index.list.result', 1)
505 }) 505 })
506 506
507 it('Should run filter:api.search.video-playlists.local.list.{params,result}', async function () { 507 it('Should run filter:api.search.video-playlists.local.list.{params,result}', async function () {
508 await servers[0].searchCommand.advancedPlaylistSearch({ 508 await servers[0].search.advancedPlaylistSearch({
509 search: { 509 search: {
510 search: 'Sun Jian' 510 search: 'Sun Jian'
511 } 511 }
512 }) 512 })
513 513
514 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.params', 1) 514 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.params', 1)
515 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.result', 1) 515 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.result', 1)
516 }) 516 })
517 517
518 it('Should run filter:api.search.video-playlists.index.list.{params,result}', async function () { 518 it('Should run filter:api.search.video-playlists.index.list.{params,result}', async function () {
519 await servers[0].searchCommand.advancedPlaylistSearch({ 519 await servers[0].search.advancedPlaylistSearch({
520 search: { 520 search: {
521 search: 'Sun Jian', 521 search: 'Sun Jian',
522 searchTarget: 'search-index' 522 searchTarget: 'search-index'
523 } 523 }
524 }) 524 })
525 525
526 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.params', 1) 526 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.params', 1)
527 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.result', 1) 527 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.result', 1)
528 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-playlists.index.list.params', 1) 528 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.index.list.params', 1)
529 await servers[0].serversCommand.waitUntilLog('Run hook filter:api.search.video-playlists.index.list.result', 1) 529 await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.index.list.result', 1)
530 }) 530 })
531 }) 531 })
532 532
diff --git a/server/tests/plugins/html-injection.ts b/server/tests/plugins/html-injection.ts
index 80d67ae0e..0cb89f511 100644
--- a/server/tests/plugins/html-injection.ts
+++ b/server/tests/plugins/html-injection.ts
@@ -23,7 +23,7 @@ describe('Test plugins HTML injection', function () {
23 server = await flushAndRunServer(1) 23 server = await flushAndRunServer(1)
24 await setAccessTokensToServers([ server ]) 24 await setAccessTokensToServers([ server ])
25 25
26 command = server.pluginsCommand 26 command = server.plugins
27 }) 27 })
28 28
29 it('Should not inject global css file in HTML', async function () { 29 it('Should not inject global css file in HTML', async function () {
diff --git a/server/tests/plugins/id-and-pass-auth.ts b/server/tests/plugins/id-and-pass-auth.ts
index 787080e7c..203996af8 100644
--- a/server/tests/plugins/id-and-pass-auth.ts
+++ b/server/tests/plugins/id-and-pass-auth.ts
@@ -22,12 +22,12 @@ describe('Test id and pass auth plugins', function () {
22 await setAccessTokensToServers([ server ]) 22 await setAccessTokensToServers([ server ])
23 23
24 for (const suffix of [ 'one', 'two', 'three' ]) { 24 for (const suffix of [ 'one', 'two', 'three' ]) {
25 await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-id-pass-auth-' + suffix) }) 25 await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-id-pass-auth-' + suffix) })
26 } 26 }
27 }) 27 })
28 28
29 it('Should display the correct configuration', async function () { 29 it('Should display the correct configuration', async function () {
30 const config = await server.configCommand.getConfig() 30 const config = await server.config.getConfig()
31 31
32 const auths = config.plugin.registeredIdAndPassAuths 32 const auths = config.plugin.registeredIdAndPassAuths
33 expect(auths).to.have.lengthOf(8) 33 expect(auths).to.have.lengthOf(8)
@@ -39,13 +39,13 @@ describe('Test id and pass auth plugins', function () {
39 }) 39 })
40 40
41 it('Should not login', async function () { 41 it('Should not login', async function () {
42 await server.loginCommand.login({ user: { username: 'toto', password: 'password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 42 await server.login.login({ user: { username: 'toto', password: 'password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
43 }) 43 })
44 44
45 it('Should login Spyro, create the user and use the token', async function () { 45 it('Should login Spyro, create the user and use the token', async function () {
46 const accessToken = await server.loginCommand.getAccessToken({ username: 'spyro', password: 'spyro password' }) 46 const accessToken = await server.login.getAccessToken({ username: 'spyro', password: 'spyro password' })
47 47
48 const body = await server.usersCommand.getMyInfo({ token: accessToken }) 48 const body = await server.users.getMyInfo({ token: accessToken })
49 49
50 expect(body.username).to.equal('spyro') 50 expect(body.username).to.equal('spyro')
51 expect(body.account.displayName).to.equal('Spyro the Dragon') 51 expect(body.account.displayName).to.equal('Spyro the Dragon')
@@ -54,13 +54,13 @@ describe('Test id and pass auth plugins', function () {
54 54
55 it('Should login Crash, create the user and use the token', async function () { 55 it('Should login Crash, create the user and use the token', async function () {
56 { 56 {
57 const body = await server.loginCommand.login({ user: { username: 'crash', password: 'crash password' } }) 57 const body = await server.login.login({ user: { username: 'crash', password: 'crash password' } })
58 crashAccessToken = body.access_token 58 crashAccessToken = body.access_token
59 crashRefreshToken = body.refresh_token 59 crashRefreshToken = body.refresh_token
60 } 60 }
61 61
62 { 62 {
63 const body = await server.usersCommand.getMyInfo({ token: crashAccessToken }) 63 const body = await server.users.getMyInfo({ token: crashAccessToken })
64 64
65 expect(body.username).to.equal('crash') 65 expect(body.username).to.equal('crash')
66 expect(body.account.displayName).to.equal('Crash Bandicoot') 66 expect(body.account.displayName).to.equal('Crash Bandicoot')
@@ -70,13 +70,13 @@ describe('Test id and pass auth plugins', function () {
70 70
71 it('Should login the first Laguna, create the user and use the token', async function () { 71 it('Should login the first Laguna, create the user and use the token', async function () {
72 { 72 {
73 const body = await server.loginCommand.login({ user: { username: 'laguna', password: 'laguna password' } }) 73 const body = await server.login.login({ user: { username: 'laguna', password: 'laguna password' } })
74 lagunaAccessToken = body.access_token 74 lagunaAccessToken = body.access_token
75 lagunaRefreshToken = body.refresh_token 75 lagunaRefreshToken = body.refresh_token
76 } 76 }
77 77
78 { 78 {
79 const body = await server.usersCommand.getMyInfo({ token: lagunaAccessToken }) 79 const body = await server.users.getMyInfo({ token: lagunaAccessToken })
80 80
81 expect(body.username).to.equal('laguna') 81 expect(body.username).to.equal('laguna')
82 expect(body.account.displayName).to.equal('laguna') 82 expect(body.account.displayName).to.equal('laguna')
@@ -86,46 +86,46 @@ describe('Test id and pass auth plugins', function () {
86 86
87 it('Should refresh crash token, but not laguna token', async function () { 87 it('Should refresh crash token, but not laguna token', async function () {
88 { 88 {
89 const resRefresh = await server.loginCommand.refreshToken({ refreshToken: crashRefreshToken }) 89 const resRefresh = await server.login.refreshToken({ refreshToken: crashRefreshToken })
90 crashAccessToken = resRefresh.body.access_token 90 crashAccessToken = resRefresh.body.access_token
91 crashRefreshToken = resRefresh.body.refresh_token 91 crashRefreshToken = resRefresh.body.refresh_token
92 92
93 const body = await server.usersCommand.getMyInfo({ token: crashAccessToken }) 93 const body = await server.users.getMyInfo({ token: crashAccessToken })
94 expect(body.username).to.equal('crash') 94 expect(body.username).to.equal('crash')
95 } 95 }
96 96
97 { 97 {
98 await server.loginCommand.refreshToken({ refreshToken: lagunaRefreshToken, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 98 await server.login.refreshToken({ refreshToken: lagunaRefreshToken, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
99 } 99 }
100 }) 100 })
101 101
102 it('Should update Crash profile', async function () { 102 it('Should update Crash profile', async function () {
103 await server.usersCommand.updateMe({ 103 await server.users.updateMe({
104 token: crashAccessToken, 104 token: crashAccessToken,
105 displayName: 'Beautiful Crash', 105 displayName: 'Beautiful Crash',
106 description: 'Mutant eastern barred bandicoot' 106 description: 'Mutant eastern barred bandicoot'
107 }) 107 })
108 108
109 const body = await server.usersCommand.getMyInfo({ token: crashAccessToken }) 109 const body = await server.users.getMyInfo({ token: crashAccessToken })
110 110
111 expect(body.account.displayName).to.equal('Beautiful Crash') 111 expect(body.account.displayName).to.equal('Beautiful Crash')
112 expect(body.account.description).to.equal('Mutant eastern barred bandicoot') 112 expect(body.account.description).to.equal('Mutant eastern barred bandicoot')
113 }) 113 })
114 114
115 it('Should logout Crash', async function () { 115 it('Should logout Crash', async function () {
116 await server.loginCommand.logout({ token: crashAccessToken }) 116 await server.login.logout({ token: crashAccessToken })
117 }) 117 })
118 118
119 it('Should have logged out Crash', async function () { 119 it('Should have logged out Crash', async function () {
120 await server.serversCommand.waitUntilLog('On logout for auth 1 - 2') 120 await server.servers.waitUntilLog('On logout for auth 1 - 2')
121 121
122 await server.usersCommand.getMyInfo({ token: crashAccessToken, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 122 await server.users.getMyInfo({ token: crashAccessToken, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
123 }) 123 })
124 124
125 it('Should login Crash and keep the old existing profile', async function () { 125 it('Should login Crash and keep the old existing profile', async function () {
126 crashAccessToken = await server.loginCommand.getAccessToken({ username: 'crash', password: 'crash password' }) 126 crashAccessToken = await server.login.getAccessToken({ username: 'crash', password: 'crash password' })
127 127
128 const body = await server.usersCommand.getMyInfo({ token: crashAccessToken }) 128 const body = await server.users.getMyInfo({ token: crashAccessToken })
129 129
130 expect(body.username).to.equal('crash') 130 expect(body.username).to.equal('crash')
131 expect(body.account.displayName).to.equal('Beautiful Crash') 131 expect(body.account.displayName).to.equal('Beautiful Crash')
@@ -138,38 +138,38 @@ describe('Test id and pass auth plugins', function () {
138 138
139 await wait(5000) 139 await wait(5000)
140 140
141 await server.usersCommand.getMyInfo({ token: lagunaAccessToken, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 141 await server.users.getMyInfo({ token: lagunaAccessToken, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
142 }) 142 })
143 143
144 it('Should reject an invalid username, email, role or display name', async function () { 144 it('Should reject an invalid username, email, role or display name', async function () {
145 const command = server.loginCommand 145 const command = server.login
146 146
147 await command.login({ user: { username: 'ward', password: 'ward password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 147 await command.login({ user: { username: 'ward', password: 'ward password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
148 await server.serversCommand.waitUntilLog('valid username') 148 await server.servers.waitUntilLog('valid username')
149 149
150 await command.login({ user: { username: 'kiros', password: 'kiros password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 150 await command.login({ user: { username: 'kiros', password: 'kiros password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
151 await server.serversCommand.waitUntilLog('valid display name') 151 await server.servers.waitUntilLog('valid display name')
152 152
153 await command.login({ user: { username: 'raine', password: 'raine password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 153 await command.login({ user: { username: 'raine', password: 'raine password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
154 await server.serversCommand.waitUntilLog('valid role') 154 await server.servers.waitUntilLog('valid role')
155 155
156 await command.login({ user: { username: 'ellone', password: 'elonne password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 156 await command.login({ user: { username: 'ellone', password: 'elonne password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
157 await server.serversCommand.waitUntilLog('valid email') 157 await server.servers.waitUntilLog('valid email')
158 }) 158 })
159 159
160 it('Should unregister spyro-auth and do not login existing Spyro', async function () { 160 it('Should unregister spyro-auth and do not login existing Spyro', async function () {
161 await server.pluginsCommand.updateSettings({ 161 await server.plugins.updateSettings({
162 npmName: 'peertube-plugin-test-id-pass-auth-one', 162 npmName: 'peertube-plugin-test-id-pass-auth-one',
163 settings: { disableSpyro: true } 163 settings: { disableSpyro: true }
164 }) 164 })
165 165
166 const command = server.loginCommand 166 const command = server.login
167 await command.login({ user: { username: 'spyro', password: 'spyro password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 167 await command.login({ user: { username: 'spyro', password: 'spyro password' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
168 await command.login({ user: { username: 'spyro', password: 'fake' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 168 await command.login({ user: { username: 'spyro', password: 'fake' }, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
169 }) 169 })
170 170
171 it('Should have disabled this auth', async function () { 171 it('Should have disabled this auth', async function () {
172 const config = await server.configCommand.getConfig() 172 const config = await server.config.getConfig()
173 173
174 const auths = config.plugin.registeredIdAndPassAuths 174 const auths = config.plugin.registeredIdAndPassAuths
175 expect(auths).to.have.lengthOf(7) 175 expect(auths).to.have.lengthOf(7)
@@ -179,16 +179,16 @@ describe('Test id and pass auth plugins', function () {
179 }) 179 })
180 180
181 it('Should uninstall the plugin one and do not login existing Crash', async function () { 181 it('Should uninstall the plugin one and do not login existing Crash', async function () {
182 await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-id-pass-auth-one' }) 182 await server.plugins.uninstall({ npmName: 'peertube-plugin-test-id-pass-auth-one' })
183 183
184 await server.loginCommand.login({ 184 await server.login.login({
185 user: { username: 'crash', password: 'crash password' }, 185 user: { username: 'crash', password: 'crash password' },
186 expectedStatus: HttpStatusCode.BAD_REQUEST_400 186 expectedStatus: HttpStatusCode.BAD_REQUEST_400
187 }) 187 })
188 }) 188 })
189 189
190 it('Should display the correct configuration', async function () { 190 it('Should display the correct configuration', async function () {
191 const config = await server.configCommand.getConfig() 191 const config = await server.config.getConfig()
192 192
193 const auths = config.plugin.registeredIdAndPassAuths 193 const auths = config.plugin.registeredIdAndPassAuths
194 expect(auths).to.have.lengthOf(6) 194 expect(auths).to.have.lengthOf(6)
@@ -198,7 +198,7 @@ describe('Test id and pass auth plugins', function () {
198 }) 198 })
199 199
200 it('Should display plugin auth information in users list', async function () { 200 it('Should display plugin auth information in users list', async function () {
201 const { data } = await server.usersCommand.list() 201 const { data } = await server.users.list()
202 202
203 const root = data.find(u => u.username === 'root') 203 const root = data.find(u => u.username === 'root')
204 const crash = data.find(u => u.username === 'crash') 204 const crash = data.find(u => u.username === 'crash')
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts
index 509aba13d..cf16aaa9d 100644
--- a/server/tests/plugins/plugin-helpers.ts
+++ b/server/tests/plugins/plugin-helpers.ts
@@ -39,28 +39,28 @@ describe('Test plugin helpers', function () {
39 39
40 await doubleFollow(servers[0], servers[1]) 40 await doubleFollow(servers[0], servers[1])
41 41
42 await servers[0].pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-four') }) 42 await servers[0].plugins.install({ path: PluginsCommand.getPluginTestPath('-four') })
43 }) 43 })
44 44
45 describe('Logger', function () { 45 describe('Logger', function () {
46 46
47 it('Should have logged things', async function () { 47 it('Should have logged things', async function () {
48 await servers[0].serversCommand.waitUntilLog('localhost:' + servers[0].port + ' peertube-plugin-test-four', 1, false) 48 await servers[0].servers.waitUntilLog('localhost:' + servers[0].port + ' peertube-plugin-test-four', 1, false)
49 await servers[0].serversCommand.waitUntilLog('Hello world from plugin four', 1) 49 await servers[0].servers.waitUntilLog('Hello world from plugin four', 1)
50 }) 50 })
51 }) 51 })
52 52
53 describe('Database', function () { 53 describe('Database', function () {
54 54
55 it('Should have made a query', async function () { 55 it('Should have made a query', async function () {
56 await servers[0].serversCommand.waitUntilLog(`root email is admin${servers[0].internalServerNumber}@example.com`) 56 await servers[0].servers.waitUntilLog(`root email is admin${servers[0].internalServerNumber}@example.com`)
57 }) 57 })
58 }) 58 })
59 59
60 describe('Config', function () { 60 describe('Config', function () {
61 61
62 it('Should have the correct webserver url', async function () { 62 it('Should have the correct webserver url', async function () {
63 await servers[0].serversCommand.waitUntilLog(`server url is http://localhost:${servers[0].port}`) 63 await servers[0].servers.waitUntilLog(`server url is http://localhost:${servers[0].port}`)
64 }) 64 })
65 65
66 it('Should have the correct config', async function () { 66 it('Should have the correct config', async function () {
@@ -78,7 +78,7 @@ describe('Test plugin helpers', function () {
78 describe('Server', function () { 78 describe('Server', function () {
79 79
80 it('Should get the server actor', async function () { 80 it('Should get the server actor', async function () {
81 await servers[0].serversCommand.waitUntilLog('server actor name is peertube') 81 await servers[0].servers.waitUntilLog('server actor name is peertube')
82 }) 82 })
83 }) 83 })
84 84
@@ -140,17 +140,17 @@ describe('Test plugin helpers', function () {
140 this.timeout(60000) 140 this.timeout(60000)
141 141
142 { 142 {
143 const res = await await servers[0].videosCommand.quickUpload({ name: 'video server 1' }) 143 const res = await await servers[0].videos.quickUpload({ name: 'video server 1' })
144 videoUUIDServer1 = res.uuid 144 videoUUIDServer1 = res.uuid
145 } 145 }
146 146
147 { 147 {
148 await await servers[1].videosCommand.quickUpload({ name: 'video server 2' }) 148 await await servers[1].videos.quickUpload({ name: 'video server 2' })
149 } 149 }
150 150
151 await waitJobs(servers) 151 await waitJobs(servers)
152 152
153 const { data } = await servers[0].videosCommand.list() 153 const { data } = await servers[0].videos.list()
154 154
155 expect(data).to.have.lengthOf(2) 155 expect(data).to.have.lengthOf(2)
156 }) 156 })
@@ -159,7 +159,7 @@ describe('Test plugin helpers', function () {
159 this.timeout(10000) 159 this.timeout(10000)
160 await postCommand(servers[0], 'blockServer', { hostToBlock: `localhost:${servers[1].port}` }) 160 await postCommand(servers[0], 'blockServer', { hostToBlock: `localhost:${servers[1].port}` })
161 161
162 const { data } = await servers[0].videosCommand.list() 162 const { data } = await servers[0].videos.list()
163 163
164 expect(data).to.have.lengthOf(1) 164 expect(data).to.have.lengthOf(1)
165 expect(data[0].name).to.equal('video server 1') 165 expect(data[0].name).to.equal('video server 1')
@@ -168,7 +168,7 @@ describe('Test plugin helpers', function () {
168 it('Should unmute server 2', async function () { 168 it('Should unmute server 2', async function () {
169 await postCommand(servers[0], 'unblockServer', { hostToUnblock: `localhost:${servers[1].port}` }) 169 await postCommand(servers[0], 'unblockServer', { hostToUnblock: `localhost:${servers[1].port}` })
170 170
171 const { data } = await servers[0].videosCommand.list() 171 const { data } = await servers[0].videos.list()
172 172
173 expect(data).to.have.lengthOf(2) 173 expect(data).to.have.lengthOf(2)
174 }) 174 })
@@ -176,7 +176,7 @@ describe('Test plugin helpers', function () {
176 it('Should mute account of server 2', async function () { 176 it('Should mute account of server 2', async function () {
177 await postCommand(servers[0], 'blockAccount', { handleToBlock: `root@localhost:${servers[1].port}` }) 177 await postCommand(servers[0], 'blockAccount', { handleToBlock: `root@localhost:${servers[1].port}` })
178 178
179 const { data } = await servers[0].videosCommand.list() 179 const { data } = await servers[0].videos.list()
180 180
181 expect(data).to.have.lengthOf(1) 181 expect(data).to.have.lengthOf(1)
182 expect(data[0].name).to.equal('video server 1') 182 expect(data[0].name).to.equal('video server 1')
@@ -185,7 +185,7 @@ describe('Test plugin helpers', function () {
185 it('Should unmute account of server 2', async function () { 185 it('Should unmute account of server 2', async function () {
186 await postCommand(servers[0], 'unblockAccount', { handleToUnblock: `root@localhost:${servers[1].port}` }) 186 await postCommand(servers[0], 'unblockAccount', { handleToUnblock: `root@localhost:${servers[1].port}` })
187 187
188 const { data } = await servers[0].videosCommand.list() 188 const { data } = await servers[0].videos.list()
189 189
190 expect(data).to.have.lengthOf(2) 190 expect(data).to.have.lengthOf(2)
191 }) 191 })
@@ -198,7 +198,7 @@ describe('Test plugin helpers', function () {
198 await waitJobs(servers) 198 await waitJobs(servers)
199 199
200 for (const server of servers) { 200 for (const server of servers) {
201 const { data } = await server.videosCommand.list() 201 const { data } = await server.videos.list()
202 202
203 expect(data).to.have.lengthOf(1) 203 expect(data).to.have.lengthOf(1)
204 expect(data[0].name).to.equal('video server 2') 204 expect(data[0].name).to.equal('video server 2')
@@ -213,7 +213,7 @@ describe('Test plugin helpers', function () {
213 await waitJobs(servers) 213 await waitJobs(servers)
214 214
215 for (const server of servers) { 215 for (const server of servers) {
216 const { data } = await server.videosCommand.list() 216 const { data } = await server.videos.list()
217 217
218 expect(data).to.have.lengthOf(2) 218 expect(data).to.have.lengthOf(2)
219 } 219 }
@@ -224,7 +224,7 @@ describe('Test plugin helpers', function () {
224 let videoUUID: string 224 let videoUUID: string
225 225
226 before(async () => { 226 before(async () => {
227 const res = await await servers[0].videosCommand.quickUpload({ name: 'video1' }) 227 const res = await await servers[0].videos.quickUpload({ name: 'video1' })
228 videoUUID = res.uuid 228 videoUUID = res.uuid
229 }) 229 })
230 230
@@ -232,15 +232,15 @@ describe('Test plugin helpers', function () {
232 this.timeout(40000) 232 this.timeout(40000)
233 233
234 // Should not throw -> video exists 234 // Should not throw -> video exists
235 await servers[0].videosCommand.get({ id: videoUUID }) 235 await servers[0].videos.get({ id: videoUUID })
236 // Should delete the video 236 // Should delete the video
237 await servers[0].videosCommand.view({ id: videoUUID }) 237 await servers[0].videos.view({ id: videoUUID })
238 238
239 await servers[0].serversCommand.waitUntilLog('Video deleted by plugin four.') 239 await servers[0].servers.waitUntilLog('Video deleted by plugin four.')
240 240
241 try { 241 try {
242 // Should throw because the video should have been deleted 242 // Should throw because the video should have been deleted
243 await servers[0].videosCommand.get({ id: videoUUID }) 243 await servers[0].videos.get({ id: videoUUID })
244 throw new Error('Video exists') 244 throw new Error('Video exists')
245 } catch (err) { 245 } catch (err) {
246 if (err.message.includes('exists')) throw err 246 if (err.message.includes('exists')) throw err
@@ -250,7 +250,7 @@ describe('Test plugin helpers', function () {
250 }) 250 })
251 251
252 it('Should have fetched the video by URL', async function () { 252 it('Should have fetched the video by URL', async function () {
253 await servers[0].serversCommand.waitUntilLog(`video from DB uuid is ${videoUUID}`) 253 await servers[0].servers.waitUntilLog(`video from DB uuid is ${videoUUID}`)
254 }) 254 })
255 }) 255 })
256 256
diff --git a/server/tests/plugins/plugin-router.ts b/server/tests/plugins/plugin-router.ts
index 81e18dabd..1c53dd80c 100644
--- a/server/tests/plugins/plugin-router.ts
+++ b/server/tests/plugins/plugin-router.ts
@@ -26,7 +26,7 @@ describe('Test plugin helpers', function () {
26 server = await flushAndRunServer(1) 26 server = await flushAndRunServer(1)
27 await setAccessTokensToServers([ server ]) 27 await setAccessTokensToServers([ server ])
28 28
29 await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-five') }) 29 await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-five') })
30 }) 30 })
31 31
32 it('Should answer "pong"', async function () { 32 it('Should answer "pong"', async function () {
@@ -82,7 +82,7 @@ describe('Test plugin helpers', function () {
82 }) 82 })
83 83
84 it('Should remove the plugin and remove the routes', async function () { 84 it('Should remove the plugin and remove the routes', async function () {
85 await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-five' }) 85 await server.plugins.uninstall({ npmName: 'peertube-plugin-test-five' })
86 86
87 for (const path of basePaths) { 87 for (const path of basePaths) {
88 await makeGetRequest({ 88 await makeGetRequest({
diff --git a/server/tests/plugins/plugin-storage.ts b/server/tests/plugins/plugin-storage.ts
index 9babfc83e..30e231439 100644
--- a/server/tests/plugins/plugin-storage.ts
+++ b/server/tests/plugins/plugin-storage.ts
@@ -16,13 +16,13 @@ describe('Test plugin storage', function () {
16 server = await flushAndRunServer(1) 16 server = await flushAndRunServer(1)
17 await setAccessTokensToServers([ server ]) 17 await setAccessTokensToServers([ server ])
18 18
19 await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-six') }) 19 await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-six') })
20 }) 20 })
21 21
22 describe('DB storage', function () { 22 describe('DB storage', function () {
23 23
24 it('Should correctly store a subkey', async function () { 24 it('Should correctly store a subkey', async function () {
25 await server.serversCommand.waitUntilLog('superkey stored value is toto') 25 await server.servers.waitUntilLog('superkey stored value is toto')
26 }) 26 })
27 }) 27 })
28 28
@@ -38,12 +38,12 @@ describe('Test plugin storage', function () {
38 } 38 }
39 39
40 before(function () { 40 before(function () {
41 dataPath = server.serversCommand.buildDirectory('plugins/data') 41 dataPath = server.servers.buildDirectory('plugins/data')
42 pluginDataPath = join(dataPath, 'peertube-plugin-test-six') 42 pluginDataPath = join(dataPath, 'peertube-plugin-test-six')
43 }) 43 })
44 44
45 it('Should have created the directory on install', async function () { 45 it('Should have created the directory on install', async function () {
46 const dataPath = server.serversCommand.buildDirectory('plugins/data') 46 const dataPath = server.servers.buildDirectory('plugins/data')
47 const pluginDataPath = join(dataPath, 'peertube-plugin-test-six') 47 const pluginDataPath = join(dataPath, 'peertube-plugin-test-six')
48 48
49 expect(await pathExists(dataPath)).to.be.true 49 expect(await pathExists(dataPath)).to.be.true
@@ -64,14 +64,14 @@ describe('Test plugin storage', function () {
64 }) 64 })
65 65
66 it('Should still have the file after an uninstallation', async function () { 66 it('Should still have the file after an uninstallation', async function () {
67 await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-six' }) 67 await server.plugins.uninstall({ npmName: 'peertube-plugin-test-six' })
68 68
69 const content = await getFileContent() 69 const content = await getFileContent()
70 expect(content).to.equal('Prince Ali') 70 expect(content).to.equal('Prince Ali')
71 }) 71 })
72 72
73 it('Should still have the file after the reinstallation', async function () { 73 it('Should still have the file after the reinstallation', async function () {
74 await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-six') }) 74 await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-six') })
75 75
76 const content = await getFileContent() 76 const content = await getFileContent()
77 expect(content).to.equal('Prince Ali') 77 expect(content).to.equal('Prince Ali')
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts
index a3613293a..3a03065b0 100644
--- a/server/tests/plugins/plugin-transcoding.ts
+++ b/server/tests/plugins/plugin-transcoding.ts
@@ -19,17 +19,17 @@ import { VideoPrivacy } from '@shared/models'
19async function createLiveWrapper (server: ServerInfo) { 19async function createLiveWrapper (server: ServerInfo) {
20 const liveAttributes = { 20 const liveAttributes = {
21 name: 'live video', 21 name: 'live video',
22 channelId: server.videoChannel.id, 22 channelId: server.store.channel.id,
23 privacy: VideoPrivacy.PUBLIC 23 privacy: VideoPrivacy.PUBLIC
24 } 24 }
25 25
26 const { uuid } = await server.liveCommand.create({ fields: liveAttributes }) 26 const { uuid } = await server.live.create({ fields: liveAttributes })
27 27
28 return uuid 28 return uuid
29} 29}
30 30
31function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) { 31function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) {
32 return server.configCommand.updateCustomSubConfig({ 32 return server.config.updateCustomSubConfig({
33 newConfig: { 33 newConfig: {
34 transcoding: { 34 transcoding: {
35 enabled: true, 35 enabled: true,
@@ -79,7 +79,7 @@ describe('Test transcoding plugins', function () {
79 describe('When using a plugin adding profiles to existing encoders', function () { 79 describe('When using a plugin adding profiles to existing encoders', function () {
80 80
81 async function checkVideoFPS (uuid: string, type: 'above' | 'below', fps: number) { 81 async function checkVideoFPS (uuid: string, type: 'above' | 'below', fps: number) {
82 const video = await server.videosCommand.get({ id: uuid }) 82 const video = await server.videos.get({ id: uuid })
83 const files = video.files.concat(...video.streamingPlaylists.map(p => p.files)) 83 const files = video.files.concat(...video.streamingPlaylists.map(p => p.files))
84 84
85 for (const file of files) { 85 for (const file of files) {
@@ -103,11 +103,11 @@ describe('Test transcoding plugins', function () {
103 } 103 }
104 104
105 before(async function () { 105 before(async function () {
106 await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-transcoding-one') }) 106 await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-transcoding-one') })
107 }) 107 })
108 108
109 it('Should have the appropriate available profiles', async function () { 109 it('Should have the appropriate available profiles', async function () {
110 const config = await server.configCommand.getConfig() 110 const config = await server.config.getConfig()
111 111
112 expect(config.transcoding.availableProfiles).to.have.members([ 'default', 'low-vod', 'input-options-vod', 'bad-scale-vod' ]) 112 expect(config.transcoding.availableProfiles).to.have.members([ 'default', 'low-vod', 'input-options-vod', 'bad-scale-vod' ])
113 expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live', 'input-options-live', 'bad-scale-live' ]) 113 expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live', 'input-options-live', 'bad-scale-live' ])
@@ -116,7 +116,7 @@ describe('Test transcoding plugins', function () {
116 it('Should not use the plugin profile if not chosen by the admin', async function () { 116 it('Should not use the plugin profile if not chosen by the admin', async function () {
117 this.timeout(240000) 117 this.timeout(240000)
118 118
119 const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid 119 const videoUUID = (await server.videos.quickUpload({ name: 'video' })).uuid
120 await waitJobs([ server ]) 120 await waitJobs([ server ])
121 121
122 await checkVideoFPS(videoUUID, 'above', 20) 122 await checkVideoFPS(videoUUID, 'above', 20)
@@ -127,7 +127,7 @@ describe('Test transcoding plugins', function () {
127 127
128 await updateConf(server, 'low-vod', 'default') 128 await updateConf(server, 'low-vod', 'default')
129 129
130 const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid 130 const videoUUID = (await server.videos.quickUpload({ name: 'video' })).uuid
131 await waitJobs([ server ]) 131 await waitJobs([ server ])
132 132
133 await checkVideoFPS(videoUUID, 'below', 12) 133 await checkVideoFPS(videoUUID, 'below', 12)
@@ -138,7 +138,7 @@ describe('Test transcoding plugins', function () {
138 138
139 await updateConf(server, 'input-options-vod', 'default') 139 await updateConf(server, 'input-options-vod', 'default')
140 140
141 const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid 141 const videoUUID = (await server.videos.quickUpload({ name: 'video' })).uuid
142 await waitJobs([ server ]) 142 await waitJobs([ server ])
143 143
144 await checkVideoFPS(videoUUID, 'below', 6) 144 await checkVideoFPS(videoUUID, 'below', 6)
@@ -149,11 +149,11 @@ describe('Test transcoding plugins', function () {
149 149
150 await updateConf(server, 'bad-scale-vod', 'default') 150 await updateConf(server, 'bad-scale-vod', 'default')
151 151
152 const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid 152 const videoUUID = (await server.videos.quickUpload({ name: 'video' })).uuid
153 await waitJobs([ server ]) 153 await waitJobs([ server ])
154 154
155 // Transcoding failed 155 // Transcoding failed
156 const video = await server.videosCommand.get({ id: videoUUID }) 156 const video = await server.videos.get({ id: videoUUID })
157 expect(video.files).to.have.lengthOf(1) 157 expect(video.files).to.have.lengthOf(1)
158 expect(video.streamingPlaylists).to.have.lengthOf(0) 158 expect(video.streamingPlaylists).to.have.lengthOf(0)
159 }) 159 })
@@ -163,8 +163,8 @@ describe('Test transcoding plugins', function () {
163 163
164 const liveVideoId = await createLiveWrapper(server) 164 const liveVideoId = await createLiveWrapper(server)
165 165
166 await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) 166 await server.live.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' })
167 await server.liveCommand.waitUntilPublished({ videoId: liveVideoId }) 167 await server.live.waitUntilPublished({ videoId: liveVideoId })
168 await waitJobs([ server ]) 168 await waitJobs([ server ])
169 169
170 await checkLiveFPS(liveVideoId, 'above', 20) 170 await checkLiveFPS(liveVideoId, 'above', 20)
@@ -177,8 +177,8 @@ describe('Test transcoding plugins', function () {
177 177
178 const liveVideoId = await createLiveWrapper(server) 178 const liveVideoId = await createLiveWrapper(server)
179 179
180 await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) 180 await server.live.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' })
181 await server.liveCommand.waitUntilPublished({ videoId: liveVideoId }) 181 await server.live.waitUntilPublished({ videoId: liveVideoId })
182 await waitJobs([ server ]) 182 await waitJobs([ server ])
183 183
184 await checkLiveFPS(liveVideoId, 'below', 12) 184 await checkLiveFPS(liveVideoId, 'below', 12)
@@ -191,8 +191,8 @@ describe('Test transcoding plugins', function () {
191 191
192 const liveVideoId = await createLiveWrapper(server) 192 const liveVideoId = await createLiveWrapper(server)
193 193
194 await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) 194 await server.live.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' })
195 await server.liveCommand.waitUntilPublished({ videoId: liveVideoId }) 195 await server.live.waitUntilPublished({ videoId: liveVideoId })
196 await waitJobs([ server ]) 196 await waitJobs([ server ])
197 197
198 await checkLiveFPS(liveVideoId, 'below', 6) 198 await checkLiveFPS(liveVideoId, 'below', 6)
@@ -205,21 +205,21 @@ describe('Test transcoding plugins', function () {
205 205
206 const liveVideoId = await createLiveWrapper(server) 206 const liveVideoId = await createLiveWrapper(server)
207 207
208 const command = await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) 208 const command = await server.live.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' })
209 await testFfmpegStreamError(command, true) 209 await testFfmpegStreamError(command, true)
210 }) 210 })
211 211
212 it('Should default to the default profile if the specified profile does not exist', async function () { 212 it('Should default to the default profile if the specified profile does not exist', async function () {
213 this.timeout(240000) 213 this.timeout(240000)
214 214
215 await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-transcoding-one' }) 215 await server.plugins.uninstall({ npmName: 'peertube-plugin-test-transcoding-one' })
216 216
217 const config = await server.configCommand.getConfig() 217 const config = await server.config.getConfig()
218 218
219 expect(config.transcoding.availableProfiles).to.deep.equal([ 'default' ]) 219 expect(config.transcoding.availableProfiles).to.deep.equal([ 'default' ])
220 expect(config.live.transcoding.availableProfiles).to.deep.equal([ 'default' ]) 220 expect(config.live.transcoding.availableProfiles).to.deep.equal([ 'default' ])
221 221
222 const videoUUID = (await server.videosCommand.quickUpload({ name: 'video' })).uuid 222 const videoUUID = (await server.videos.quickUpload({ name: 'video' })).uuid
223 await waitJobs([ server ]) 223 await waitJobs([ server ])
224 224
225 await checkVideoFPS(videoUUID, 'above', 20) 225 await checkVideoFPS(videoUUID, 'above', 20)
@@ -230,7 +230,7 @@ describe('Test transcoding plugins', function () {
230 describe('When using a plugin adding new encoders', function () { 230 describe('When using a plugin adding new encoders', function () {
231 231
232 before(async function () { 232 before(async function () {
233 await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-transcoding-two') }) 233 await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-transcoding-two') })
234 234
235 await updateConf(server, 'test-vod-profile', 'test-live-profile') 235 await updateConf(server, 'test-vod-profile', 'test-live-profile')
236 }) 236 })
@@ -238,10 +238,10 @@ describe('Test transcoding plugins', function () {
238 it('Should use the new vod encoders', async function () { 238 it('Should use the new vod encoders', async function () {
239 this.timeout(240000) 239 this.timeout(240000)
240 240
241 const videoUUID = (await server.videosCommand.quickUpload({ name: 'video', fixture: 'video_short_240p.mp4' })).uuid 241 const videoUUID = (await server.videos.quickUpload({ name: 'video', fixture: 'video_short_240p.mp4' })).uuid
242 await waitJobs([ server ]) 242 await waitJobs([ server ])
243 243
244 const path = server.serversCommand.buildDirectory(join('videos', videoUUID + '-240.mp4')) 244 const path = server.servers.buildDirectory(join('videos', videoUUID + '-240.mp4'))
245 const audioProbe = await getAudioStream(path) 245 const audioProbe = await getAudioStream(path)
246 expect(audioProbe.audioStream.codec_name).to.equal('opus') 246 expect(audioProbe.audioStream.codec_name).to.equal('opus')
247 247
@@ -254,8 +254,8 @@ describe('Test transcoding plugins', function () {
254 254
255 const liveVideoId = await createLiveWrapper(server) 255 const liveVideoId = await createLiveWrapper(server)
256 256
257 await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) 257 await server.live.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' })
258 await server.liveCommand.waitUntilPublished({ videoId: liveVideoId }) 258 await server.live.waitUntilPublished({ videoId: liveVideoId })
259 await waitJobs([ server ]) 259 await waitJobs([ server ])
260 260
261 const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8` 261 const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8`
diff --git a/server/tests/plugins/plugin-unloading.ts b/server/tests/plugins/plugin-unloading.ts
index f430f82b8..26a27abca 100644
--- a/server/tests/plugins/plugin-unloading.ts
+++ b/server/tests/plugins/plugin-unloading.ts
@@ -16,7 +16,7 @@ describe('Test plugins module unloading', function () {
16 server = await flushAndRunServer(1) 16 server = await flushAndRunServer(1)
17 await setAccessTokensToServers([ server ]) 17 await setAccessTokensToServers([ server ])
18 18
19 await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-unloading') }) 19 await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-unloading') })
20 }) 20 })
21 21
22 it('Should return a numeric value', async function () { 22 it('Should return a numeric value', async function () {
@@ -41,7 +41,7 @@ describe('Test plugins module unloading', function () {
41 }) 41 })
42 42
43 it('Should uninstall the plugin and free the route', async function () { 43 it('Should uninstall the plugin and free the route', async function () {
44 await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-unloading' }) 44 await server.plugins.uninstall({ npmName: 'peertube-plugin-test-unloading' })
45 45
46 await makeGetRequest({ 46 await makeGetRequest({
47 url: server.url, 47 url: server.url,
@@ -51,7 +51,7 @@ describe('Test plugins module unloading', function () {
51 }) 51 })
52 52
53 it('Should return a different numeric value', async function () { 53 it('Should return a different numeric value', async function () {
54 await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-unloading') }) 54 await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-unloading') })
55 55
56 const res = await makeGetRequest({ 56 const res = await makeGetRequest({
57 url: server.url, 57 url: server.url,
diff --git a/server/tests/plugins/translations.ts b/server/tests/plugins/translations.ts
index 0e11a0b53..d8d878026 100644
--- a/server/tests/plugins/translations.ts
+++ b/server/tests/plugins/translations.ts
@@ -17,7 +17,7 @@ describe('Test plugin translations', function () {
17 server = await flushAndRunServer(1) 17 server = await flushAndRunServer(1)
18 await setAccessTokensToServers([ server ]) 18 await setAccessTokensToServers([ server ])
19 19
20 command = server.pluginsCommand 20 command = server.plugins
21 21
22 await command.install({ path: PluginsCommand.getPluginTestPath() }) 22 await command.install({ path: PluginsCommand.getPluginTestPath() })
23 await command.install({ path: PluginsCommand.getPluginTestPath('-filter-translations') }) 23 await command.install({ path: PluginsCommand.getPluginTestPath('-filter-translations') })
diff --git a/server/tests/plugins/video-constants.ts b/server/tests/plugins/video-constants.ts
index 641e37fbb..facc6bbc1 100644
--- a/server/tests/plugins/video-constants.ts
+++ b/server/tests/plugins/video-constants.ts
@@ -17,11 +17,11 @@ describe('Test plugin altering video constants', function () {
17 server = await flushAndRunServer(1) 17 server = await flushAndRunServer(1)
18 await setAccessTokensToServers([ server ]) 18 await setAccessTokensToServers([ server ])
19 19
20 await server.pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-video-constants') }) 20 await server.plugins.install({ path: PluginsCommand.getPluginTestPath('-video-constants') })
21 }) 21 })
22 22
23 it('Should have updated languages', async function () { 23 it('Should have updated languages', async function () {
24 const languages = await server.videosCommand.getLanguages() 24 const languages = await server.videos.getLanguages()
25 25
26 expect(languages['en']).to.not.exist 26 expect(languages['en']).to.not.exist
27 expect(languages['fr']).to.not.exist 27 expect(languages['fr']).to.not.exist
@@ -32,7 +32,7 @@ describe('Test plugin altering video constants', function () {
32 }) 32 })
33 33
34 it('Should have updated categories', async function () { 34 it('Should have updated categories', async function () {
35 const categories = await server.videosCommand.getCategories() 35 const categories = await server.videos.getCategories()
36 36
37 expect(categories[1]).to.not.exist 37 expect(categories[1]).to.not.exist
38 expect(categories[2]).to.not.exist 38 expect(categories[2]).to.not.exist
@@ -42,7 +42,7 @@ describe('Test plugin altering video constants', function () {
42 }) 42 })
43 43
44 it('Should have updated licences', async function () { 44 it('Should have updated licences', async function () {
45 const licences = await server.videosCommand.getLicences() 45 const licences = await server.videos.getLicences()
46 46
47 expect(licences[1]).to.not.exist 47 expect(licences[1]).to.not.exist
48 expect(licences[7]).to.not.exist 48 expect(licences[7]).to.not.exist
@@ -52,7 +52,7 @@ describe('Test plugin altering video constants', function () {
52 }) 52 })
53 53
54 it('Should have updated video privacies', async function () { 54 it('Should have updated video privacies', async function () {
55 const privacies = await server.videosCommand.getPrivacies() 55 const privacies = await server.videos.getPrivacies()
56 56
57 expect(privacies[1]).to.exist 57 expect(privacies[1]).to.exist
58 expect(privacies[2]).to.not.exist 58 expect(privacies[2]).to.not.exist
@@ -61,7 +61,7 @@ describe('Test plugin altering video constants', function () {
61 }) 61 })
62 62
63 it('Should have updated playlist privacies', async function () { 63 it('Should have updated playlist privacies', async function () {
64 const playlistPrivacies = await server.playlistsCommand.getPrivacies() 64 const playlistPrivacies = await server.playlists.getPrivacies()
65 65
66 expect(playlistPrivacies[1]).to.exist 66 expect(playlistPrivacies[1]).to.exist
67 expect(playlistPrivacies[2]).to.exist 67 expect(playlistPrivacies[2]).to.exist
@@ -70,29 +70,29 @@ describe('Test plugin altering video constants', function () {
70 70
71 it('Should not be able to create a video with this privacy', async function () { 71 it('Should not be able to create a video with this privacy', async function () {
72 const attributes = { name: 'video', privacy: 2 } 72 const attributes = { name: 'video', privacy: 2 }
73 await server.videosCommand.upload({ attributes, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 73 await server.videos.upload({ attributes, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
74 }) 74 })
75 75
76 it('Should not be able to create a video with this privacy', async function () { 76 it('Should not be able to create a video with this privacy', async function () {
77 const attributes = { displayName: 'video playlist', privacy: VideoPlaylistPrivacy.PRIVATE } 77 const attributes = { displayName: 'video playlist', privacy: VideoPlaylistPrivacy.PRIVATE }
78 await server.playlistsCommand.create({ attributes, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 78 await server.playlists.create({ attributes, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
79 }) 79 })
80 80
81 it('Should be able to upload a video with these values', async function () { 81 it('Should be able to upload a video with these values', async function () {
82 const attributes = { name: 'video', category: 42, licence: 42, language: 'al_bhed2' } 82 const attributes = { name: 'video', category: 42, licence: 42, language: 'al_bhed2' }
83 const { uuid } = await server.videosCommand.upload({ attributes }) 83 const { uuid } = await server.videos.upload({ attributes })
84 84
85 const video = await server.videosCommand.get({ id: uuid }) 85 const video = await server.videos.get({ id: uuid })
86 expect(video.language.label).to.equal('Al Bhed 2') 86 expect(video.language.label).to.equal('Al Bhed 2')
87 expect(video.licence.label).to.equal('Best licence') 87 expect(video.licence.label).to.equal('Best licence')
88 expect(video.category.label).to.equal('Best category') 88 expect(video.category.label).to.equal('Best category')
89 }) 89 })
90 90
91 it('Should uninstall the plugin and reset languages, categories, licences and privacies', async function () { 91 it('Should uninstall the plugin and reset languages, categories, licences and privacies', async function () {
92 await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-video-constants' }) 92 await server.plugins.uninstall({ npmName: 'peertube-plugin-test-video-constants' })
93 93
94 { 94 {
95 const languages = await server.videosCommand.getLanguages() 95 const languages = await server.videos.getLanguages()
96 96
97 expect(languages['en']).to.equal('English') 97 expect(languages['en']).to.equal('English')
98 expect(languages['fr']).to.equal('French') 98 expect(languages['fr']).to.equal('French')
@@ -103,7 +103,7 @@ describe('Test plugin altering video constants', function () {
103 } 103 }
104 104
105 { 105 {
106 const categories = await server.videosCommand.getCategories() 106 const categories = await server.videos.getCategories()
107 107
108 expect(categories[1]).to.equal('Music') 108 expect(categories[1]).to.equal('Music')
109 expect(categories[2]).to.equal('Films') 109 expect(categories[2]).to.equal('Films')
@@ -113,7 +113,7 @@ describe('Test plugin altering video constants', function () {
113 } 113 }
114 114
115 { 115 {
116 const licences = await server.videosCommand.getLicences() 116 const licences = await server.videos.getLicences()
117 117
118 expect(licences[1]).to.equal('Attribution') 118 expect(licences[1]).to.equal('Attribution')
119 expect(licences[7]).to.equal('Public Domain Dedication') 119 expect(licences[7]).to.equal('Public Domain Dedication')
@@ -123,7 +123,7 @@ describe('Test plugin altering video constants', function () {
123 } 123 }
124 124
125 { 125 {
126 const privacies = await server.videosCommand.getPrivacies() 126 const privacies = await server.videos.getPrivacies()
127 127
128 expect(privacies[1]).to.exist 128 expect(privacies[1]).to.exist
129 expect(privacies[2]).to.exist 129 expect(privacies[2]).to.exist
@@ -132,7 +132,7 @@ describe('Test plugin altering video constants', function () {
132 } 132 }
133 133
134 { 134 {
135 const playlistPrivacies = await server.playlistsCommand.getPrivacies() 135 const playlistPrivacies = await server.playlists.getPrivacies()
136 136
137 expect(playlistPrivacies[1]).to.exist 137 expect(playlistPrivacies[1]).to.exist
138 expect(playlistPrivacies[2]).to.exist 138 expect(playlistPrivacies[2]).to.exist