aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-24 17:05:32 +0200
committerChocobozzz <me@florianbigard.com>2018-04-24 17:12:57 +0200
commit48dce1c90dff4e90a4bcffefaecf157336cf904b (patch)
tree478de23812d0bfd93f47e9ad6ad8888c9edcc235 /server/tests/api/videos
parent82e392f8a42a19815e932dd386e96e61ebe6d191 (diff)
downloadPeerTube-48dce1c90dff4e90a4bcffefaecf157336cf904b.tar.gz
PeerTube-48dce1c90dff4e90a4bcffefaecf157336cf904b.tar.zst
PeerTube-48dce1c90dff4e90a4bcffefaecf157336cf904b.zip
Update video channel routes
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/multiple-servers.ts21
-rw-r--r--server/tests/api/videos/video-channels.ts15
2 files changed, 26 insertions, 10 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index 2563939ec..6238cdc08 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -39,6 +39,7 @@ import {
39 getVideoCommentThreads, 39 getVideoCommentThreads,
40 getVideoThreadComments 40 getVideoThreadComments
41} from '../../utils/videos/video-comments' 41} from '../../utils/videos/video-comments'
42import { getAccountsList } from '../../utils/users/accounts'
42 43
43const expect = chai.expect 44const expect = chai.expect
44 45
@@ -46,6 +47,7 @@ describe('Test multiple servers', function () {
46 let servers: ServerInfo[] = [] 47 let servers: ServerInfo[] = []
47 const toRemove = [] 48 const toRemove = []
48 let videoUUID = '' 49 let videoUUID = ''
50 let accountId: number
49 let videoChannelId: number 51 let videoChannelId: number
50 52
51 before(async function () { 53 before(async function () {
@@ -56,13 +58,20 @@ describe('Test multiple servers', function () {
56 // Get the access tokens 58 // Get the access tokens
57 await setAccessTokensToServers(servers) 59 await setAccessTokensToServers(servers)
58 60
59 const videoChannel = { 61 {
60 name: 'my channel', 62 const res = await getAccountsList(servers[0].url)
61 description: 'super channel' 63 accountId = res.body.data[0].id
64 }
65
66 {
67 const videoChannel = {
68 name: 'my channel',
69 description: 'super channel'
70 }
71 await addVideoChannel(servers[ 0 ].url, servers[ 0 ].accessToken, accountId, videoChannel)
72 const channelRes = await getVideoChannelsList(servers[ 0 ].url, 0, 1)
73 videoChannelId = channelRes.body.data[ 0 ].id
62 } 74 }
63 await addVideoChannel(servers[0].url, servers[0].accessToken, videoChannel)
64 const channelRes = await getVideoChannelsList(servers[0].url, 0, 1)
65 videoChannelId = channelRes.body.data[0].id
66 75
67 // Server 1 and server 2 follow each other 76 // Server 1 and server 2 follow each other
68 await doubleFollow(servers[0], servers[1]) 77 await doubleFollow(servers[0], servers[1])
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index b9c9bbf3c..a7552a83a 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -17,12 +17,14 @@ import {
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 updateVideoChannel 18 updateVideoChannel
19} from '../../utils/index' 19} from '../../utils/index'
20import { getAccountsList } from '../../utils/users/accounts'
20 21
21const expect = chai.expect 22const expect = chai.expect
22 23
23describe('Test video channels', function () { 24describe('Test video channels', function () {
24 let servers: ServerInfo[] 25 let servers: ServerInfo[]
25 let userInfo: User 26 let userInfo: User
27 let accountId: number
26 let videoChannelId: number 28 let videoChannelId: number
27 29
28 before(async function () { 30 before(async function () {
@@ -35,6 +37,11 @@ describe('Test video channels', function () {
35 await setAccessTokensToServers(servers) 37 await setAccessTokensToServers(servers)
36 await doubleFollow(servers[0], servers[1]) 38 await doubleFollow(servers[0], servers[1])
37 39
40 {
41 const res = await getAccountsList(servers[0].url)
42 accountId = res.body.data[0].id
43 }
44
38 await wait(5000) 45 await wait(5000)
39 }) 46 })
40 47
@@ -54,7 +61,7 @@ describe('Test video channels', function () {
54 description: 'super video channel description', 61 description: 'super video channel description',
55 support: 'super video channel support text' 62 support: 'super video channel support text'
56 } 63 }
57 const res = await addVideoChannel(servers[0].url, servers[0].accessToken, videoChannel) 64 const res = await addVideoChannel(servers[0].url, servers[0].accessToken, accountId, videoChannel)
58 videoChannelId = res.body.videoChannel.id 65 videoChannelId = res.body.videoChannel.id
59 66
60 // The channel is 1 is propagated to servers 2 67 // The channel is 1 is propagated to servers 2
@@ -120,7 +127,7 @@ describe('Test video channels', function () {
120 support: 'video channel support text updated' 127 support: 'video channel support text updated'
121 } 128 }
122 129
123 await updateVideoChannel(servers[0].url, servers[0].accessToken, videoChannelId, videoChannelAttributes) 130 await updateVideoChannel(servers[0].url, servers[0].accessToken, accountId, videoChannelId, videoChannelAttributes)
124 131
125 await wait(3000) 132 await wait(3000)
126 }) 133 })
@@ -139,7 +146,7 @@ describe('Test video channels', function () {
139 }) 146 })
140 147
141 it('Should get video channel', async function () { 148 it('Should get video channel', async function () {
142 const res = await getVideoChannel(servers[0].url, videoChannelId) 149 const res = await getVideoChannel(servers[0].url, accountId, videoChannelId)
143 150
144 const videoChannel = res.body 151 const videoChannel = res.body
145 expect(videoChannel.displayName).to.equal('video channel updated') 152 expect(videoChannel.displayName).to.equal('video channel updated')
@@ -148,7 +155,7 @@ describe('Test video channels', function () {
148 }) 155 })
149 156
150 it('Should delete video channel', async function () { 157 it('Should delete video channel', async function () {
151 await deleteVideoChannel(servers[0].url, servers[0].accessToken, videoChannelId) 158 await deleteVideoChannel(servers[0].url, servers[0].accessToken, accountId, videoChannelId)
152 }) 159 })
153 160
154 it('Should have video channel deleted', async function () { 161 it('Should have video channel deleted', async function () {