aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-channels.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-25 10:21:38 +0200
committerChocobozzz <me@florianbigard.com>2018-04-25 13:50:48 +0200
commit6b738c7a31591a83fdcd9c78b6b1f98e543c378b (patch)
treedb771d0e99e9ff27570885fe2a6f58a7c1948fbc /server/tests/api/videos/video-channels.ts
parent48dce1c90dff4e90a4bcffefaecf157336cf904b (diff)
downloadPeerTube-6b738c7a31591a83fdcd9c78b6b1f98e543c378b.tar.gz
PeerTube-6b738c7a31591a83fdcd9c78b6b1f98e543c378b.tar.zst
PeerTube-6b738c7a31591a83fdcd9c78b6b1f98e543c378b.zip
Video channel API routes refractor
Diffstat (limited to 'server/tests/api/videos/video-channels.ts')
-rw-r--r--server/tests/api/videos/video-channels.ts33
1 files changed, 24 insertions, 9 deletions
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index a7552a83a..04e7b8c6a 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -3,7 +3,7 @@
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { User } from '../../../../shared/index' 5import { User } from '../../../../shared/index'
6import { doubleFollow, flushAndRunMultipleServers, uploadVideo, wait } from '../../utils' 6import { doubleFollow, flushAndRunMultipleServers, getVideoChannelVideos, uploadVideo, wait } from '../../utils'
7import { 7import {
8 addVideoChannel, 8 addVideoChannel,
9 deleteVideoChannel, 9 deleteVideoChannel,
@@ -24,8 +24,9 @@ const expect = chai.expect
24describe('Test video channels', function () { 24describe('Test video channels', function () {
25 let servers: ServerInfo[] 25 let servers: ServerInfo[]
26 let userInfo: User 26 let userInfo: User
27 let accountId: number 27 let accountUUID: string
28 let videoChannelId: number 28 let videoChannelId: number
29 let videoChannelUUID: string
29 30
30 before(async function () { 31 before(async function () {
31 this.timeout(30000) 32 this.timeout(30000)
@@ -38,8 +39,9 @@ describe('Test video channels', function () {
38 await doubleFollow(servers[0], servers[1]) 39 await doubleFollow(servers[0], servers[1])
39 40
40 { 41 {
41 const res = await getAccountsList(servers[0].url) 42 const res = await getMyUserInformation(servers[0].url, servers[0].accessToken)
42 accountId = res.body.data[0].id 43 const user: User = res.body
44 accountUUID = user.account.uuid
43 } 45 }
44 46
45 await wait(5000) 47 await wait(5000)
@@ -61,11 +63,12 @@ describe('Test video channels', function () {
61 description: 'super video channel description', 63 description: 'super video channel description',
62 support: 'super video channel support text' 64 support: 'super video channel support text'
63 } 65 }
64 const res = await addVideoChannel(servers[0].url, servers[0].accessToken, accountId, videoChannel) 66 const res = await addVideoChannel(servers[0].url, servers[0].accessToken, accountUUID, videoChannel)
65 videoChannelId = res.body.videoChannel.id 67 videoChannelId = res.body.videoChannel.id
68 videoChannelUUID = res.body.videoChannel.uuid
66 69
67 // The channel is 1 is propagated to servers 2 70 // The channel is 1 is propagated to servers 2
68 await uploadVideo(servers[0].url, servers[0].accessToken, { channelId: videoChannelId }) 71 await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'my video name', channelId: videoChannelId })
69 72
70 await wait(3000) 73 await wait(3000)
71 }) 74 })
@@ -127,7 +130,7 @@ describe('Test video channels', function () {
127 support: 'video channel support text updated' 130 support: 'video channel support text updated'
128 } 131 }
129 132
130 await updateVideoChannel(servers[0].url, servers[0].accessToken, accountId, videoChannelId, videoChannelAttributes) 133 await updateVideoChannel(servers[0].url, servers[0].accessToken, accountUUID, videoChannelId, videoChannelAttributes)
131 134
132 await wait(3000) 135 await wait(3000)
133 }) 136 })
@@ -146,7 +149,7 @@ describe('Test video channels', function () {
146 }) 149 })
147 150
148 it('Should get video channel', async function () { 151 it('Should get video channel', async function () {
149 const res = await getVideoChannel(servers[0].url, accountId, videoChannelId) 152 const res = await getVideoChannel(servers[0].url, accountUUID, videoChannelId)
150 153
151 const videoChannel = res.body 154 const videoChannel = res.body
152 expect(videoChannel.displayName).to.equal('video channel updated') 155 expect(videoChannel.displayName).to.equal('video channel updated')
@@ -154,8 +157,20 @@ describe('Test video channels', function () {
154 expect(videoChannel.support).to.equal('video channel support text updated') 157 expect(videoChannel.support).to.equal('video channel support text updated')
155 }) 158 })
156 159
160 it('Should list the video channel videos', async function () {
161 this.timeout(10000)
162
163 for (const server of servers) {
164 const res = await getVideoChannelVideos(server.url, server.accessToken, accountUUID, videoChannelUUID, 0, 5)
165 expect(res.body.total).to.equal(1)
166 expect(res.body.data).to.be.an('array')
167 expect(res.body.data).to.have.lengthOf(1)
168 expect(res.body.data[0].name).to.equal('my video name')
169 }
170 })
171
157 it('Should delete video channel', async function () { 172 it('Should delete video channel', async function () {
158 await deleteVideoChannel(servers[0].url, servers[0].accessToken, accountId, videoChannelId) 173 await deleteVideoChannel(servers[0].url, servers[0].accessToken, accountUUID, videoChannelId)
159 }) 174 })
160 175
161 it('Should have video channel deleted', async function () { 176 it('Should have video channel deleted', async function () {