diff options
Diffstat (limited to 'server/tests/api/videos/video-channels.ts')
-rw-r--r-- | server/tests/api/videos/video-channels.ts | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index c25754eb6..d435f3682 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts | |||
@@ -4,6 +4,9 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { basename } from 'path' | 5 | import { basename } from 'path' |
6 | import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants' | 6 | import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants' |
7 | import { testFileExistsOrNot, testImage } from '@server/tests/shared' | ||
8 | import { wait } from '@shared/core-utils' | ||
9 | import { User, VideoChannel } from '@shared/models' | ||
7 | import { | 10 | import { |
8 | cleanupTests, | 11 | cleanupTests, |
9 | createMultipleServers, | 12 | createMultipleServers, |
@@ -11,12 +14,8 @@ import { | |||
11 | PeerTubeServer, | 14 | PeerTubeServer, |
12 | setAccessTokensToServers, | 15 | setAccessTokensToServers, |
13 | setDefaultVideoChannel, | 16 | setDefaultVideoChannel, |
14 | testFileExistsOrNot, | ||
15 | testImage, | ||
16 | wait, | ||
17 | waitJobs | 17 | waitJobs |
18 | } from '@shared/extra-utils' | 18 | } from '@shared/server-commands' |
19 | import { User, VideoChannel } from '@shared/models' | ||
20 | 19 | ||
21 | const expect = chai.expect | 20 | const expect = chai.expect |
22 | 21 | ||
@@ -33,6 +32,7 @@ describe('Test video channels', function () { | |||
33 | let totoChannel: number | 32 | let totoChannel: number |
34 | let videoUUID: string | 33 | let videoUUID: string |
35 | let accountName: string | 34 | let accountName: string |
35 | let secondUserChannelName: string | ||
36 | 36 | ||
37 | const avatarPaths: { [ port: number ]: string } = {} | 37 | const avatarPaths: { [ port: number ]: string } = {} |
38 | const bannerPaths: { [ port: number ]: string } = {} | 38 | const bannerPaths: { [ port: number ]: string } = {} |
@@ -219,6 +219,35 @@ describe('Test video channels', function () { | |||
219 | } | 219 | } |
220 | }) | 220 | }) |
221 | 221 | ||
222 | it('Should update another accounts video channel', async function () { | ||
223 | this.timeout(15000) | ||
224 | |||
225 | const result = await servers[0].users.generate('second_user') | ||
226 | secondUserChannelName = result.userChannelName | ||
227 | |||
228 | await servers[0].videos.quickUpload({ name: 'video', token: result.token }) | ||
229 | |||
230 | const videoChannelAttributes = { | ||
231 | displayName: 'video channel updated', | ||
232 | description: 'video channel description updated', | ||
233 | support: 'support updated' | ||
234 | } | ||
235 | |||
236 | await servers[0].channels.update({ channelName: secondUserChannelName, attributes: videoChannelAttributes }) | ||
237 | |||
238 | await waitJobs(servers) | ||
239 | }) | ||
240 | |||
241 | it('Should have another accounts video channel updated', async function () { | ||
242 | for (const server of servers) { | ||
243 | const body = await server.channels.get({ channelName: `${secondUserChannelName}@${servers[0].host}` }) | ||
244 | |||
245 | expect(body.displayName).to.equal('video channel updated') | ||
246 | expect(body.description).to.equal('video channel description updated') | ||
247 | expect(body.support).to.equal('support updated') | ||
248 | } | ||
249 | }) | ||
250 | |||
222 | it('Should update the channel support field and update videos too', async function () { | 251 | it('Should update the channel support field and update videos too', async function () { |
223 | this.timeout(35000) | 252 | this.timeout(35000) |
224 | 253 | ||
@@ -368,12 +397,13 @@ describe('Test video channels', function () { | |||
368 | }) | 397 | }) |
369 | 398 | ||
370 | it('Should have video channel deleted', async function () { | 399 | it('Should have video channel deleted', async function () { |
371 | const body = await servers[0].channels.list({ start: 0, count: 10 }) | 400 | const body = await servers[0].channels.list({ start: 0, count: 10, sort: 'createdAt' }) |
372 | 401 | ||
373 | expect(body.total).to.equal(1) | 402 | expect(body.total).to.equal(2) |
374 | expect(body.data).to.be.an('array') | 403 | expect(body.data).to.be.an('array') |
375 | expect(body.data).to.have.lengthOf(1) | 404 | expect(body.data).to.have.lengthOf(2) |
376 | expect(body.data[0].displayName).to.equal('Main root channel') | 405 | expect(body.data[0].displayName).to.equal('Main root channel') |
406 | expect(body.data[1].displayName).to.equal('video channel updated') | ||
377 | }) | 407 | }) |
378 | 408 | ||
379 | it('Should create the main channel with an uuid if there is a conflict', async function () { | 409 | it('Should create the main channel with an uuid if there is a conflict', async function () { |