diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-16 09:04:35 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 89d241a79c262b9775c233b73cff080043ebb5e6 (patch) | |
tree | cb3b6cb431d25d891ef4e02f66c61d252d17048f /server/tests/api/videos/video-channels.ts | |
parent | d23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff) | |
download | PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip |
Shorter server command names
Diffstat (limited to 'server/tests/api/videos/video-channels.ts')
-rw-r--r-- | server/tests/api/videos/video-channels.ts | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index 170cc942e..1efef932c 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts | |||
@@ -21,7 +21,7 @@ import { User, VideoChannel } from '@shared/models' | |||
21 | const expect = chai.expect | 21 | const expect = chai.expect |
22 | 22 | ||
23 | async function findChannel (server: ServerInfo, channelId: number) { | 23 | async function findChannel (server: ServerInfo, channelId: number) { |
24 | const body = await server.channelsCommand.list({ sort: '-name' }) | 24 | const body = await server.channels.list({ sort: '-name' }) |
25 | 25 | ||
26 | return body.data.find(c => c.id === channelId) | 26 | return body.data.find(c => c.id === channelId) |
27 | } | 27 | } |
@@ -49,7 +49,7 @@ describe('Test video channels', function () { | |||
49 | }) | 49 | }) |
50 | 50 | ||
51 | it('Should have one video channel (created with root)', async () => { | 51 | it('Should have one video channel (created with root)', async () => { |
52 | const body = await servers[0].channelsCommand.list({ start: 0, count: 2 }) | 52 | const body = await servers[0].channels.list({ start: 0, count: 2 }) |
53 | 53 | ||
54 | expect(body.total).to.equal(1) | 54 | expect(body.total).to.equal(1) |
55 | expect(body.data).to.be.an('array') | 55 | expect(body.data).to.be.an('array') |
@@ -66,14 +66,14 @@ describe('Test video channels', function () { | |||
66 | description: 'super video channel description', | 66 | description: 'super video channel description', |
67 | support: 'super video channel support text' | 67 | support: 'super video channel support text' |
68 | } | 68 | } |
69 | const created = await servers[0].channelsCommand.create({ attributes: videoChannel }) | 69 | const created = await servers[0].channels.create({ attributes: videoChannel }) |
70 | secondVideoChannelId = created.id | 70 | secondVideoChannelId = created.id |
71 | } | 71 | } |
72 | 72 | ||
73 | // The channel is 1 is propagated to servers 2 | 73 | // The channel is 1 is propagated to servers 2 |
74 | { | 74 | { |
75 | const attributes = { name: 'my video name', channelId: secondVideoChannelId, support: 'video support field' } | 75 | const attributes = { name: 'my video name', channelId: secondVideoChannelId, support: 'video support field' } |
76 | const { uuid } = await servers[0].videosCommand.upload({ attributes }) | 76 | const { uuid } = await servers[0].videos.upload({ attributes }) |
77 | videoUUID = uuid | 77 | videoUUID = uuid |
78 | } | 78 | } |
79 | 79 | ||
@@ -81,7 +81,7 @@ describe('Test video channels', function () { | |||
81 | }) | 81 | }) |
82 | 82 | ||
83 | it('Should have two video channels when getting my information', async () => { | 83 | it('Should have two video channels when getting my information', async () => { |
84 | userInfo = await servers[0].usersCommand.getMyInfo() | 84 | userInfo = await servers[0].users.getMyInfo() |
85 | 85 | ||
86 | expect(userInfo.videoChannels).to.be.an('array') | 86 | expect(userInfo.videoChannels).to.be.an('array') |
87 | expect(userInfo.videoChannels).to.have.lengthOf(2) | 87 | expect(userInfo.videoChannels).to.have.lengthOf(2) |
@@ -99,7 +99,7 @@ describe('Test video channels', function () { | |||
99 | }) | 99 | }) |
100 | 100 | ||
101 | it('Should have two video channels when getting account channels on server 1', async function () { | 101 | it('Should have two video channels when getting account channels on server 1', async function () { |
102 | const body = await servers[0].channelsCommand.listByAccount({ accountName }) | 102 | const body = await servers[0].channels.listByAccount({ accountName }) |
103 | expect(body.total).to.equal(2) | 103 | expect(body.total).to.equal(2) |
104 | 104 | ||
105 | const videoChannels = body.data | 105 | const videoChannels = body.data |
@@ -118,7 +118,7 @@ describe('Test video channels', function () { | |||
118 | 118 | ||
119 | it('Should paginate and sort account channels', async function () { | 119 | it('Should paginate and sort account channels', async function () { |
120 | { | 120 | { |
121 | const body = await servers[0].channelsCommand.listByAccount({ | 121 | const body = await servers[0].channels.listByAccount({ |
122 | accountName, | 122 | accountName, |
123 | start: 0, | 123 | start: 0, |
124 | count: 1, | 124 | count: 1, |
@@ -133,7 +133,7 @@ describe('Test video channels', function () { | |||
133 | } | 133 | } |
134 | 134 | ||
135 | { | 135 | { |
136 | const body = await servers[0].channelsCommand.listByAccount({ | 136 | const body = await servers[0].channels.listByAccount({ |
137 | accountName, | 137 | accountName, |
138 | start: 0, | 138 | start: 0, |
139 | count: 1, | 139 | count: 1, |
@@ -146,7 +146,7 @@ describe('Test video channels', function () { | |||
146 | } | 146 | } |
147 | 147 | ||
148 | { | 148 | { |
149 | const body = await servers[0].channelsCommand.listByAccount({ | 149 | const body = await servers[0].channels.listByAccount({ |
150 | accountName, | 150 | accountName, |
151 | start: 1, | 151 | start: 1, |
152 | count: 1, | 152 | count: 1, |
@@ -160,7 +160,7 @@ describe('Test video channels', function () { | |||
160 | }) | 160 | }) |
161 | 161 | ||
162 | it('Should have one video channel when getting account channels on server 2', async function () { | 162 | it('Should have one video channel when getting account channels on server 2', async function () { |
163 | const body = await servers[1].channelsCommand.listByAccount({ accountName }) | 163 | const body = await servers[1].channels.listByAccount({ accountName }) |
164 | 164 | ||
165 | expect(body.total).to.equal(1) | 165 | expect(body.total).to.equal(1) |
166 | expect(body.data).to.be.an('array') | 166 | expect(body.data).to.be.an('array') |
@@ -174,7 +174,7 @@ describe('Test video channels', function () { | |||
174 | }) | 174 | }) |
175 | 175 | ||
176 | it('Should list video channels', async function () { | 176 | it('Should list video channels', async function () { |
177 | const body = await servers[0].channelsCommand.list({ start: 1, count: 1, sort: '-name' }) | 177 | const body = await servers[0].channels.list({ start: 1, count: 1, sort: '-name' }) |
178 | 178 | ||
179 | expect(body.total).to.equal(2) | 179 | expect(body.total).to.equal(2) |
180 | expect(body.data).to.be.an('array') | 180 | expect(body.data).to.be.an('array') |
@@ -192,14 +192,14 @@ describe('Test video channels', function () { | |||
192 | support: 'support updated' | 192 | support: 'support updated' |
193 | } | 193 | } |
194 | 194 | ||
195 | await servers[0].channelsCommand.update({ channelName: 'second_video_channel', attributes: videoChannelAttributes }) | 195 | await servers[0].channels.update({ channelName: 'second_video_channel', attributes: videoChannelAttributes }) |
196 | 196 | ||
197 | await waitJobs(servers) | 197 | await waitJobs(servers) |
198 | }) | 198 | }) |
199 | 199 | ||
200 | it('Should have video channel updated', async function () { | 200 | it('Should have video channel updated', async function () { |
201 | for (const server of servers) { | 201 | for (const server of servers) { |
202 | const body = await server.channelsCommand.list({ start: 0, count: 1, sort: '-name' }) | 202 | const body = await server.channels.list({ start: 0, count: 1, sort: '-name' }) |
203 | 203 | ||
204 | expect(body.total).to.equal(2) | 204 | expect(body.total).to.equal(2) |
205 | expect(body.data).to.be.an('array') | 205 | expect(body.data).to.be.an('array') |
@@ -214,7 +214,7 @@ describe('Test video channels', function () { | |||
214 | 214 | ||
215 | it('Should not have updated the video support field', async function () { | 215 | it('Should not have updated the video support field', async function () { |
216 | for (const server of servers) { | 216 | for (const server of servers) { |
217 | const video = await server.videosCommand.get({ id: videoUUID }) | 217 | const video = await server.videos.get({ id: videoUUID }) |
218 | expect(video.support).to.equal('video support field') | 218 | expect(video.support).to.equal('video support field') |
219 | } | 219 | } |
220 | }) | 220 | }) |
@@ -227,12 +227,12 @@ describe('Test video channels', function () { | |||
227 | bulkVideosSupportUpdate: true | 227 | bulkVideosSupportUpdate: true |
228 | } | 228 | } |
229 | 229 | ||
230 | await servers[0].channelsCommand.update({ channelName: 'second_video_channel', attributes: videoChannelAttributes }) | 230 | await servers[0].channels.update({ channelName: 'second_video_channel', attributes: videoChannelAttributes }) |
231 | 231 | ||
232 | await waitJobs(servers) | 232 | await waitJobs(servers) |
233 | 233 | ||
234 | for (const server of servers) { | 234 | for (const server of servers) { |
235 | const video = await server.videosCommand.get({ id: videoUUID }) | 235 | const video = await server.videos.get({ id: videoUUID }) |
236 | expect(video.support).to.equal(videoChannelAttributes.support) | 236 | expect(video.support).to.equal(videoChannelAttributes.support) |
237 | } | 237 | } |
238 | }) | 238 | }) |
@@ -242,7 +242,7 @@ describe('Test video channels', function () { | |||
242 | 242 | ||
243 | const fixture = 'avatar.png' | 243 | const fixture = 'avatar.png' |
244 | 244 | ||
245 | await servers[0].channelsCommand.updateImage({ | 245 | await servers[0].channels.updateImage({ |
246 | channelName: 'second_video_channel', | 246 | channelName: 'second_video_channel', |
247 | fixture, | 247 | fixture, |
248 | type: 'avatar' | 248 | type: 'avatar' |
@@ -257,7 +257,7 @@ describe('Test video channels', function () { | |||
257 | await testImage(server.url, 'avatar-resized', avatarPaths[server.port], '.png') | 257 | await testImage(server.url, 'avatar-resized', avatarPaths[server.port], '.png') |
258 | await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), true) | 258 | await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), true) |
259 | 259 | ||
260 | const row = await server.sqlCommand.getActorImage(basename(avatarPaths[server.port])) | 260 | const row = await server.sql.getActorImage(basename(avatarPaths[server.port])) |
261 | expect(row.height).to.equal(ACTOR_IMAGES_SIZE.AVATARS.height) | 261 | expect(row.height).to.equal(ACTOR_IMAGES_SIZE.AVATARS.height) |
262 | expect(row.width).to.equal(ACTOR_IMAGES_SIZE.AVATARS.width) | 262 | expect(row.width).to.equal(ACTOR_IMAGES_SIZE.AVATARS.width) |
263 | } | 263 | } |
@@ -268,7 +268,7 @@ describe('Test video channels', function () { | |||
268 | 268 | ||
269 | const fixture = 'banner.jpg' | 269 | const fixture = 'banner.jpg' |
270 | 270 | ||
271 | await servers[0].channelsCommand.updateImage({ | 271 | await servers[0].channels.updateImage({ |
272 | channelName: 'second_video_channel', | 272 | channelName: 'second_video_channel', |
273 | fixture, | 273 | fixture, |
274 | type: 'banner' | 274 | type: 'banner' |
@@ -277,13 +277,13 @@ describe('Test video channels', function () { | |||
277 | await waitJobs(servers) | 277 | await waitJobs(servers) |
278 | 278 | ||
279 | for (const server of servers) { | 279 | for (const server of servers) { |
280 | const videoChannel = await server.channelsCommand.get({ channelName: 'second_video_channel@' + servers[0].host }) | 280 | const videoChannel = await server.channels.get({ channelName: 'second_video_channel@' + servers[0].host }) |
281 | 281 | ||
282 | bannerPaths[server.port] = videoChannel.banner.path | 282 | bannerPaths[server.port] = videoChannel.banner.path |
283 | await testImage(server.url, 'banner-resized', bannerPaths[server.port]) | 283 | await testImage(server.url, 'banner-resized', bannerPaths[server.port]) |
284 | await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), true) | 284 | await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), true) |
285 | 285 | ||
286 | const row = await server.sqlCommand.getActorImage(basename(bannerPaths[server.port])) | 286 | const row = await server.sql.getActorImage(basename(bannerPaths[server.port])) |
287 | expect(row.height).to.equal(ACTOR_IMAGES_SIZE.BANNERS.height) | 287 | expect(row.height).to.equal(ACTOR_IMAGES_SIZE.BANNERS.height) |
288 | expect(row.width).to.equal(ACTOR_IMAGES_SIZE.BANNERS.width) | 288 | expect(row.width).to.equal(ACTOR_IMAGES_SIZE.BANNERS.width) |
289 | } | 289 | } |
@@ -292,7 +292,7 @@ describe('Test video channels', function () { | |||
292 | it('Should delete the video channel avatar', async function () { | 292 | it('Should delete the video channel avatar', async function () { |
293 | this.timeout(15000) | 293 | this.timeout(15000) |
294 | 294 | ||
295 | await servers[0].channelsCommand.deleteImage({ channelName: 'second_video_channel', type: 'avatar' }) | 295 | await servers[0].channels.deleteImage({ channelName: 'second_video_channel', type: 'avatar' }) |
296 | 296 | ||
297 | await waitJobs(servers) | 297 | await waitJobs(servers) |
298 | 298 | ||
@@ -307,7 +307,7 @@ describe('Test video channels', function () { | |||
307 | it('Should delete the video channel banner', async function () { | 307 | it('Should delete the video channel banner', async function () { |
308 | this.timeout(15000) | 308 | this.timeout(15000) |
309 | 309 | ||
310 | await servers[0].channelsCommand.deleteImage({ channelName: 'second_video_channel', type: 'banner' }) | 310 | await servers[0].channels.deleteImage({ channelName: 'second_video_channel', type: 'banner' }) |
311 | 311 | ||
312 | await waitJobs(servers) | 312 | await waitJobs(servers) |
313 | 313 | ||
@@ -324,7 +324,7 @@ describe('Test video channels', function () { | |||
324 | 324 | ||
325 | for (const server of servers) { | 325 | for (const server of servers) { |
326 | const channelURI = 'second_video_channel@localhost:' + servers[0].port | 326 | const channelURI = 'second_video_channel@localhost:' + servers[0].port |
327 | const { total, data } = await server.videosCommand.listByChannel({ videoChannelName: channelURI }) | 327 | const { total, data } = await server.videos.listByChannel({ videoChannelName: channelURI }) |
328 | 328 | ||
329 | expect(total).to.equal(1) | 329 | expect(total).to.equal(1) |
330 | expect(data).to.be.an('array') | 330 | expect(data).to.be.an('array') |
@@ -336,7 +336,7 @@ describe('Test video channels', function () { | |||
336 | it('Should change the video channel of a video', async function () { | 336 | it('Should change the video channel of a video', async function () { |
337 | this.timeout(10000) | 337 | this.timeout(10000) |
338 | 338 | ||
339 | await servers[0].videosCommand.update({ id: videoUUID, attributes: { channelId: servers[0].videoChannel.id } }) | 339 | await servers[0].videos.update({ id: videoUUID, attributes: { channelId: servers[0].store.channel.id } }) |
340 | 340 | ||
341 | await waitJobs(servers) | 341 | await waitJobs(servers) |
342 | }) | 342 | }) |
@@ -347,13 +347,13 @@ describe('Test video channels', function () { | |||
347 | for (const server of servers) { | 347 | for (const server of servers) { |
348 | { | 348 | { |
349 | const secondChannelURI = 'second_video_channel@localhost:' + servers[0].port | 349 | const secondChannelURI = 'second_video_channel@localhost:' + servers[0].port |
350 | const { total } = await server.videosCommand.listByChannel({ videoChannelName: secondChannelURI }) | 350 | const { total } = await server.videos.listByChannel({ videoChannelName: secondChannelURI }) |
351 | expect(total).to.equal(0) | 351 | expect(total).to.equal(0) |
352 | } | 352 | } |
353 | 353 | ||
354 | { | 354 | { |
355 | const channelURI = 'root_channel@localhost:' + servers[0].port | 355 | const channelURI = 'root_channel@localhost:' + servers[0].port |
356 | const { total, data } = await server.videosCommand.listByChannel({ videoChannelName: channelURI }) | 356 | const { total, data } = await server.videos.listByChannel({ videoChannelName: channelURI }) |
357 | expect(total).to.equal(1) | 357 | expect(total).to.equal(1) |
358 | 358 | ||
359 | expect(data).to.be.an('array') | 359 | expect(data).to.be.an('array') |
@@ -364,11 +364,11 @@ describe('Test video channels', function () { | |||
364 | }) | 364 | }) |
365 | 365 | ||
366 | it('Should delete video channel', async function () { | 366 | it('Should delete video channel', async function () { |
367 | await servers[0].channelsCommand.delete({ channelName: 'second_video_channel' }) | 367 | await servers[0].channels.delete({ channelName: 'second_video_channel' }) |
368 | }) | 368 | }) |
369 | 369 | ||
370 | it('Should have video channel deleted', async function () { | 370 | it('Should have video channel deleted', async function () { |
371 | const body = await servers[0].channelsCommand.list({ start: 0, count: 10 }) | 371 | const body = await servers[0].channels.list({ start: 0, count: 10 }) |
372 | 372 | ||
373 | expect(body.total).to.equal(1) | 373 | expect(body.total).to.equal(1) |
374 | expect(body.data).to.be.an('array') | 374 | expect(body.data).to.be.an('array') |
@@ -379,15 +379,15 @@ describe('Test video channels', function () { | |||
379 | it('Should create the main channel with an uuid if there is a conflict', async function () { | 379 | it('Should create the main channel with an uuid if there is a conflict', async function () { |
380 | { | 380 | { |
381 | const videoChannel = { name: 'toto_channel', displayName: 'My toto channel' } | 381 | const videoChannel = { name: 'toto_channel', displayName: 'My toto channel' } |
382 | const created = await servers[0].channelsCommand.create({ attributes: videoChannel }) | 382 | const created = await servers[0].channels.create({ attributes: videoChannel }) |
383 | totoChannel = created.id | 383 | totoChannel = created.id |
384 | } | 384 | } |
385 | 385 | ||
386 | { | 386 | { |
387 | await servers[0].usersCommand.create({ username: 'toto', password: 'password' }) | 387 | await servers[0].users.create({ username: 'toto', password: 'password' }) |
388 | const accessToken = await servers[0].loginCommand.getAccessToken({ username: 'toto', password: 'password' }) | 388 | const accessToken = await servers[0].login.getAccessToken({ username: 'toto', password: 'password' }) |
389 | 389 | ||
390 | const { videoChannels } = await servers[0].usersCommand.getMyInfo({ token: accessToken }) | 390 | const { videoChannels } = await servers[0].users.getMyInfo({ token: accessToken }) |
391 | const videoChannel = videoChannels[0] | 391 | const videoChannel = videoChannels[0] |
392 | expect(videoChannel.name).to.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/) | 392 | expect(videoChannel.name).to.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/) |
393 | } | 393 | } |
@@ -397,7 +397,7 @@ describe('Test video channels', function () { | |||
397 | this.timeout(10000) | 397 | this.timeout(10000) |
398 | 398 | ||
399 | { | 399 | { |
400 | const { data } = await servers[0].channelsCommand.listByAccount({ accountName, withStats: true }) | 400 | const { data } = await servers[0].channels.listByAccount({ accountName, withStats: true }) |
401 | 401 | ||
402 | for (const channel of data) { | 402 | for (const channel of data) { |
403 | expect(channel).to.haveOwnProperty('viewsPerDay') | 403 | expect(channel).to.haveOwnProperty('viewsPerDay') |
@@ -411,21 +411,21 @@ describe('Test video channels', function () { | |||
411 | } | 411 | } |
412 | 412 | ||
413 | { | 413 | { |
414 | // video has been posted on channel servers[0].videoChannel.id since last update | 414 | // video has been posted on channel servers[0].store.videoChannel.id since last update |
415 | await servers[0].videosCommand.view({ id: videoUUID, xForwardedFor: '0.0.0.1,127.0.0.1' }) | 415 | await servers[0].videos.view({ id: videoUUID, xForwardedFor: '0.0.0.1,127.0.0.1' }) |
416 | await servers[0].videosCommand.view({ id: videoUUID, xForwardedFor: '0.0.0.2,127.0.0.1' }) | 416 | await servers[0].videos.view({ id: videoUUID, xForwardedFor: '0.0.0.2,127.0.0.1' }) |
417 | 417 | ||
418 | // Wait the repeatable job | 418 | // Wait the repeatable job |
419 | await wait(8000) | 419 | await wait(8000) |
420 | 420 | ||
421 | const { data } = await servers[0].channelsCommand.listByAccount({ accountName, withStats: true }) | 421 | const { data } = await servers[0].channels.listByAccount({ accountName, withStats: true }) |
422 | const channelWithView = data.find(channel => channel.id === servers[0].videoChannel.id) | 422 | const channelWithView = data.find(channel => channel.id === servers[0].store.channel.id) |
423 | expect(channelWithView.viewsPerDay.slice(-1)[0].views).to.equal(2) | 423 | expect(channelWithView.viewsPerDay.slice(-1)[0].views).to.equal(2) |
424 | } | 424 | } |
425 | }) | 425 | }) |
426 | 426 | ||
427 | it('Should report correct videos count', async function () { | 427 | it('Should report correct videos count', async function () { |
428 | const { data } = await servers[0].channelsCommand.listByAccount({ accountName, withStats: true }) | 428 | const { data } = await servers[0].channels.listByAccount({ accountName, withStats: true }) |
429 | 429 | ||
430 | const totoChannel = data.find(c => c.name === 'toto_channel') | 430 | const totoChannel = data.find(c => c.name === 'toto_channel') |
431 | const rootChannel = data.find(c => c.name === 'root_channel') | 431 | const rootChannel = data.find(c => c.name === 'root_channel') |
@@ -436,7 +436,7 @@ describe('Test video channels', function () { | |||
436 | 436 | ||
437 | it('Should search among account video channels', async function () { | 437 | it('Should search among account video channels', async function () { |
438 | { | 438 | { |
439 | const body = await servers[0].channelsCommand.listByAccount({ accountName, search: 'root' }) | 439 | const body = await servers[0].channels.listByAccount({ accountName, search: 'root' }) |
440 | expect(body.total).to.equal(1) | 440 | expect(body.total).to.equal(1) |
441 | 441 | ||
442 | const channels = body.data | 442 | const channels = body.data |
@@ -444,7 +444,7 @@ describe('Test video channels', function () { | |||
444 | } | 444 | } |
445 | 445 | ||
446 | { | 446 | { |
447 | const body = await servers[0].channelsCommand.listByAccount({ accountName, search: 'does not exist' }) | 447 | const body = await servers[0].channels.listByAccount({ accountName, search: 'does not exist' }) |
448 | expect(body.total).to.equal(0) | 448 | expect(body.total).to.equal(0) |
449 | 449 | ||
450 | const channels = body.data | 450 | const channels = body.data |
@@ -455,21 +455,21 @@ describe('Test video channels', function () { | |||
455 | it('Should list channels by updatedAt desc if a video has been uploaded', async function () { | 455 | it('Should list channels by updatedAt desc if a video has been uploaded', async function () { |
456 | this.timeout(30000) | 456 | this.timeout(30000) |
457 | 457 | ||
458 | await servers[0].videosCommand.upload({ attributes: { channelId: totoChannel } }) | 458 | await servers[0].videos.upload({ attributes: { channelId: totoChannel } }) |
459 | await waitJobs(servers) | 459 | await waitJobs(servers) |
460 | 460 | ||
461 | for (const server of servers) { | 461 | for (const server of servers) { |
462 | const { data } = await server.channelsCommand.listByAccount({ accountName, sort: '-updatedAt' }) | 462 | const { data } = await server.channels.listByAccount({ accountName, sort: '-updatedAt' }) |
463 | 463 | ||
464 | expect(data[0].name).to.equal('toto_channel') | 464 | expect(data[0].name).to.equal('toto_channel') |
465 | expect(data[1].name).to.equal('root_channel') | 465 | expect(data[1].name).to.equal('root_channel') |
466 | } | 466 | } |
467 | 467 | ||
468 | await servers[0].videosCommand.upload({ attributes: { channelId: servers[0].videoChannel.id } }) | 468 | await servers[0].videos.upload({ attributes: { channelId: servers[0].store.channel.id } }) |
469 | await waitJobs(servers) | 469 | await waitJobs(servers) |
470 | 470 | ||
471 | for (const server of servers) { | 471 | for (const server of servers) { |
472 | const { data } = await server.channelsCommand.listByAccount({ accountName, sort: '-updatedAt' }) | 472 | const { data } = await server.channels.listByAccount({ accountName, sort: '-updatedAt' }) |
473 | 473 | ||
474 | expect(data[0].name).to.equal('root_channel') | 474 | expect(data[0].name).to.equal('root_channel') |
475 | expect(data[1].name).to.equal('toto_channel') | 475 | expect(data[1].name).to.equal('toto_channel') |