aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-channels.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-13 14:23:01 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (patch)
tree7a166515e4d57a06eb3c08be569f106ed049988b /server/tests/api/videos/video-channels.ts
parentd0a0fa429d4651710ed951a3c11af0219e408964 (diff)
downloadPeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.tar.gz
PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.tar.zst
PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.zip
Introduce user command
Diffstat (limited to 'server/tests/api/videos/video-channels.ts')
-rw-r--r--server/tests/api/videos/video-channels.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 83645640c..2e57cbbff 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -6,21 +6,22 @@ import { basename } from 'path'
6import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants' 6import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants'
7import { 7import {
8 cleanupTests, 8 cleanupTests,
9 createUser,
10 doubleFollow, 9 doubleFollow,
11 flushAndRunMultipleServers, 10 flushAndRunMultipleServers,
12 getVideo, 11 getVideo,
13 getVideoChannelVideos, 12 getVideoChannelVideos,
13 ServerInfo,
14 setAccessTokensToServers,
14 setDefaultVideoChannel, 15 setDefaultVideoChannel,
15 testFileExistsOrNot, 16 testFileExistsOrNot,
16 testImage, 17 testImage,
17 updateVideo, 18 updateVideo,
18 uploadVideo, 19 uploadVideo,
19 wait 20 viewVideo,
20} from '../../../../shared/extra-utils' 21 wait,
21import { getMyUserInformation, ServerInfo, setAccessTokensToServers, viewVideo } from '../../../../shared/extra-utils/index' 22 waitJobs
22import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 23} from '@shared/extra-utils'
23import { User, Video, VideoChannel, VideoDetails } from '../../../../shared/index' 24import { User, Video, VideoChannel, VideoDetails } from '@shared/models'
24 25
25const expect = chai.expect 26const expect = chai.expect
26 27
@@ -85,8 +86,7 @@ describe('Test video channels', function () {
85 }) 86 })
86 87
87 it('Should have two video channels when getting my information', async () => { 88 it('Should have two video channels when getting my information', async () => {
88 const res = await getMyUserInformation(servers[0].url, servers[0].accessToken) 89 userInfo = await servers[0].usersCommand.getMyInfo()
89 userInfo = res.body
90 90
91 expect(userInfo.videoChannels).to.be.an('array') 91 expect(userInfo.videoChannels).to.be.an('array')
92 expect(userInfo.videoChannels).to.have.lengthOf(2) 92 expect(userInfo.videoChannels).to.have.lengthOf(2)
@@ -389,11 +389,11 @@ describe('Test video channels', function () {
389 } 389 }
390 390
391 { 391 {
392 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: 'toto', password: 'password' }) 392 await servers[0].usersCommand.create({ username: 'toto', password: 'password' })
393 const accessToken = await servers[0].loginCommand.getAccessToken({ username: 'toto', password: 'password' }) 393 const accessToken = await servers[0].loginCommand.getAccessToken({ username: 'toto', password: 'password' })
394 394
395 const res = await getMyUserInformation(servers[0].url, accessToken) 395 const { videoChannels } = await servers[0].usersCommand.getMyInfo({ token: accessToken })
396 const videoChannel = res.body.videoChannels[0] 396 const videoChannel = videoChannels[0]
397 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}/) 397 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}/)
398 } 398 }
399 }) 399 })