aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users/users-multiple-servers.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-15 10:02:54 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commitd23dd9fbfc4d26026352c10f81d2795ceaf2908a (patch)
treeda82286d423c5e834a1ee2dcd5970076b8263cf1 /server/tests/api/users/users-multiple-servers.ts
parent7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (diff)
downloadPeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.gz
PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.tar.zst
PeerTube-d23dd9fbfc4d26026352c10f81d2795ceaf2908a.zip
Introduce videos command
Diffstat (limited to 'server/tests/api/users/users-multiple-servers.ts')
-rw-r--r--server/tests/api/users/users-multiple-servers.ts34
1 files changed, 15 insertions, 19 deletions
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index 43e67ee60..3ae105008 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -9,11 +9,9 @@ import {
9 cleanupTests, 9 cleanupTests,
10 doubleFollow, 10 doubleFollow,
11 flushAndRunMultipleServers, 11 flushAndRunMultipleServers,
12 getAccountVideos,
13 ServerInfo, 12 ServerInfo,
14 setAccessTokensToServers, 13 setAccessTokensToServers,
15 testImage, 14 testImage,
16 uploadVideo,
17 waitJobs 15 waitJobs
18} from '@shared/extra-utils' 16} from '@shared/extra-utils'
19import { User } from '@shared/models' 17import { User } from '@shared/models'
@@ -44,7 +42,7 @@ describe('Test users with multiple servers', function () {
44 await doubleFollow(servers[1], servers[2]) 42 await doubleFollow(servers[1], servers[2])
45 43
46 // The root user of server 1 is propagated to servers 2 and 3 44 // The root user of server 1 is propagated to servers 2 and 3
47 await uploadVideo(servers[0].url, servers[0].accessToken, {}) 45 await servers[0].videosCommand.upload()
48 46
49 { 47 {
50 const user = { 48 const user = {
@@ -57,8 +55,8 @@ describe('Test users with multiple servers', function () {
57 } 55 }
58 56
59 { 57 {
60 const resVideo = await uploadVideo(servers[0].url, userAccessToken, {}) 58 const { uuid } = await servers[0].videosCommand.upload({ token: userAccessToken })
61 videoUUID = resVideo.body.video.uuid 59 videoUUID = uuid
62 } 60 }
63 61
64 await waitJobs(servers) 62 await waitJobs(servers)
@@ -133,31 +131,29 @@ describe('Test users with multiple servers', function () {
133 131
134 it('Should list account videos', async function () { 132 it('Should list account videos', async function () {
135 for (const server of servers) { 133 for (const server of servers) {
136 const res = await getAccountVideos(server.url, server.accessToken, 'user1@localhost:' + servers[0].port, 0, 5) 134 const { total, data } = await server.videosCommand.listByAccount({ accountName: 'user1@localhost:' + servers[0].port })
137 135
138 expect(res.body.total).to.equal(1) 136 expect(total).to.equal(1)
139 expect(res.body.data).to.be.an('array') 137 expect(data).to.be.an('array')
140 expect(res.body.data).to.have.lengthOf(1) 138 expect(data).to.have.lengthOf(1)
141 expect(res.body.data[0].uuid).to.equal(videoUUID) 139 expect(data[0].uuid).to.equal(videoUUID)
142 } 140 }
143 }) 141 })
144 142
145 it('Should search through account videos', async function () { 143 it('Should search through account videos', async function () {
146 this.timeout(10_000) 144 this.timeout(10_000)
147 145
148 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: 'Kami no chikara' }) 146 const created = await servers[0].videosCommand.upload({ token: userAccessToken, attributes: { name: 'Kami no chikara' } })
149 147
150 await waitJobs(servers) 148 await waitJobs(servers)
151 149
152 for (const server of servers) { 150 for (const server of servers) {
153 const res = await getAccountVideos(server.url, server.accessToken, 'user1@localhost:' + servers[0].port, 0, 5, undefined, { 151 const { total, data } = await server.videosCommand.listByAccount({ accountName: 'user1@localhost:' + servers[0].port, search: 'Kami' })
154 search: 'Kami' 152
155 }) 153 expect(total).to.equal(1)
156 154 expect(data).to.be.an('array')
157 expect(res.body.total).to.equal(1) 155 expect(data).to.have.lengthOf(1)
158 expect(res.body.data).to.be.an('array') 156 expect(data[0].uuid).to.equal(created.uuid)
159 expect(res.body.data).to.have.lengthOf(1)
160 expect(res.body.data[0].uuid).to.equal(resVideo.body.video.uuid)
161 } 157 }
162 }) 158 })
163 159