aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-change-ownership.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 09:04:35 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit89d241a79c262b9775c233b73cff080043ebb5e6 (patch)
treecb3b6cb431d25d891ef4e02f66c61d252d17048f /server/tests/api/videos/video-change-ownership.ts
parentd23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff)
downloadPeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip
Shorter server command names
Diffstat (limited to 'server/tests/api/videos/video-change-ownership.ts')
-rw-r--r--server/tests/api/videos/video-change-ownership.ts50
1 files changed, 25 insertions, 25 deletions
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts
index b85edd920..352eb5ea3 100644
--- a/server/tests/api/videos/video-change-ownership.ts
+++ b/server/tests/api/videos/video-change-ownership.ts
@@ -43,7 +43,7 @@ describe('Test video change ownership - nominal', function () {
43 await setAccessTokensToServers(servers) 43 await setAccessTokensToServers(servers)
44 await setDefaultVideoChannel(servers) 44 await setDefaultVideoChannel(servers)
45 45
46 await servers[0].configCommand.updateCustomSubConfig({ 46 await servers[0].config.updateCustomSubConfig({
47 newConfig: { 47 newConfig: {
48 transcoding: { 48 transcoding: {
49 enabled: false 49 enabled: false
@@ -54,16 +54,16 @@ describe('Test video change ownership - nominal', function () {
54 } 54 }
55 }) 55 })
56 56
57 firstUserToken = await servers[0].usersCommand.generateUserAndToken(firstUser) 57 firstUserToken = await servers[0].users.generateUserAndToken(firstUser)
58 secondUserToken = await servers[0].usersCommand.generateUserAndToken(secondUser) 58 secondUserToken = await servers[0].users.generateUserAndToken(secondUser)
59 59
60 { 60 {
61 const { videoChannels } = await servers[0].usersCommand.getMyInfo({ token: firstUserToken }) 61 const { videoChannels } = await servers[0].users.getMyInfo({ token: firstUserToken })
62 firstUserChannelId = videoChannels[0].id 62 firstUserChannelId = videoChannels[0].id
63 } 63 }
64 64
65 { 65 {
66 const { videoChannels } = await servers[0].usersCommand.getMyInfo({ token: secondUserToken }) 66 const { videoChannels } = await servers[0].users.getMyInfo({ token: secondUserToken })
67 secondUserChannelId = videoChannels[0].id 67 secondUserChannelId = videoChannels[0].id
68 } 68 }
69 69
@@ -72,19 +72,19 @@ describe('Test video change ownership - nominal', function () {
72 name: 'my super name', 72 name: 'my super name',
73 description: 'my super description' 73 description: 'my super description'
74 } 74 }
75 const { id } = await servers[0].videosCommand.upload({ token: firstUserToken, attributes }) 75 const { id } = await servers[0].videos.upload({ token: firstUserToken, attributes })
76 76
77 servers[0].video = await servers[0].videosCommand.get({ id }) 77 servers[0].store.video = await servers[0].videos.get({ id })
78 } 78 }
79 79
80 { 80 {
81 const attributes = { name: 'live', channelId: firstUserChannelId, privacy: VideoPrivacy.PUBLIC } 81 const attributes = { name: 'live', channelId: firstUserChannelId, privacy: VideoPrivacy.PUBLIC }
82 const video = await servers[0].liveCommand.create({ token: firstUserToken, fields: attributes }) 82 const video = await servers[0].live.create({ token: firstUserToken, fields: attributes })
83 83
84 liveId = video.id 84 liveId = video.id
85 } 85 }
86 86
87 command = servers[0].changeOwnershipCommand 87 command = servers[0].changeOwnership
88 88
89 await doubleFollow(servers[0], servers[1]) 89 await doubleFollow(servers[0], servers[1])
90 }) 90 })
@@ -110,7 +110,7 @@ describe('Test video change ownership - nominal', function () {
110 it('Should send a request to change ownership of a video', async function () { 110 it('Should send a request to change ownership of a video', async function () {
111 this.timeout(15000) 111 this.timeout(15000)
112 112
113 await command.create({ token: firstUserToken, videoId: servers[0].video.id, username: secondUser }) 113 await command.create({ token: firstUserToken, videoId: servers[0].store.video.id, username: secondUser })
114 }) 114 })
115 115
116 it('Should only return a request to change ownership for the second user', async function () { 116 it('Should only return a request to change ownership for the second user', async function () {
@@ -136,7 +136,7 @@ describe('Test video change ownership - nominal', function () {
136 it('Should accept the same change ownership request without crashing', async function () { 136 it('Should accept the same change ownership request without crashing', async function () {
137 this.timeout(10000) 137 this.timeout(10000)
138 138
139 await command.create({ token: firstUserToken, videoId: servers[0].video.id, username: secondUser }) 139 await command.create({ token: firstUserToken, videoId: servers[0].store.video.id, username: secondUser })
140 }) 140 })
141 141
142 it('Should not create multiple change ownership requests while one is waiting', async function () { 142 it('Should not create multiple change ownership requests while one is waiting', async function () {
@@ -164,7 +164,7 @@ describe('Test video change ownership - nominal', function () {
164 it('Should send a new request to change ownership of a video', async function () { 164 it('Should send a new request to change ownership of a video', async function () {
165 this.timeout(15000) 165 this.timeout(15000)
166 166
167 await command.create({ token: firstUserToken, videoId: servers[0].video.id, username: secondUser }) 167 await command.create({ token: firstUserToken, videoId: servers[0].store.video.id, username: secondUser })
168 }) 168 })
169 169
170 it('Should return two requests to change ownership for the second user', async function () { 170 it('Should return two requests to change ownership for the second user', async function () {
@@ -208,7 +208,7 @@ describe('Test video change ownership - nominal', function () {
208 208
209 it('Should have the channel of the video updated', async function () { 209 it('Should have the channel of the video updated', async function () {
210 for (const server of servers) { 210 for (const server of servers) {
211 const video = await server.videosCommand.get({ id: servers[0].video.uuid }) 211 const video = await server.videos.get({ id: servers[0].store.video.uuid })
212 212
213 expect(video.name).to.equal('my super name') 213 expect(video.name).to.equal('my super name')
214 expect(video.channel.displayName).to.equal('Main second channel') 214 expect(video.channel.displayName).to.equal('Main second channel')
@@ -237,7 +237,7 @@ describe('Test video change ownership - nominal', function () {
237 await waitJobs(servers) 237 await waitJobs(servers)
238 238
239 for (const server of servers) { 239 for (const server of servers) {
240 const video = await server.videosCommand.get({ id: servers[0].video.uuid }) 240 const video = await server.videos.get({ id: servers[0].store.video.uuid })
241 241
242 expect(video.name).to.equal('my super name') 242 expect(video.name).to.equal('my super name')
243 expect(video.channel.displayName).to.equal('Main second channel') 243 expect(video.channel.displayName).to.equal('Main second channel')
@@ -266,35 +266,35 @@ describe('Test video change ownership - quota too small', function () {
266 server = await flushAndRunServer(1) 266 server = await flushAndRunServer(1)
267 await setAccessTokensToServers([ server ]) 267 await setAccessTokensToServers([ server ])
268 268
269 await server.usersCommand.create({ username: secondUser, videoQuota: 10 }) 269 await server.users.create({ username: secondUser, videoQuota: 10 })
270 270
271 firstUserToken = await server.usersCommand.generateUserAndToken(firstUser) 271 firstUserToken = await server.users.generateUserAndToken(firstUser)
272 secondUserToken = await server.loginCommand.getAccessToken(secondUser) 272 secondUserToken = await server.login.getAccessToken(secondUser)
273 273
274 // Upload some videos on the server 274 // Upload some videos on the server
275 const attributes = { 275 const attributes = {
276 name: 'my super name', 276 name: 'my super name',
277 description: 'my super description' 277 description: 'my super description'
278 } 278 }
279 await server.videosCommand.upload({ token: firstUserToken, attributes }) 279 await server.videos.upload({ token: firstUserToken, attributes })
280 280
281 await waitJobs(server) 281 await waitJobs(server)
282 282
283 const { data } = await server.videosCommand.list() 283 const { data } = await server.videos.list()
284 expect(data.length).to.equal(1) 284 expect(data.length).to.equal(1)
285 285
286 server.video = data.find(video => video.name === 'my super name') 286 server.store.video = data.find(video => video.name === 'my super name')
287 }) 287 })
288 288
289 it('Should send a request to change ownership of a video', async function () { 289 it('Should send a request to change ownership of a video', async function () {
290 this.timeout(15000) 290 this.timeout(15000)
291 291
292 await server.changeOwnershipCommand.create({ token: firstUserToken, videoId: server.video.id, username: secondUser }) 292 await server.changeOwnership.create({ token: firstUserToken, videoId: server.store.video.id, username: secondUser })
293 }) 293 })
294 294
295 it('Should only return a request to change ownership for the second user', async function () { 295 it('Should only return a request to change ownership for the second user', async function () {
296 { 296 {
297 const body = await server.changeOwnershipCommand.list({ token: firstUserToken }) 297 const body = await server.changeOwnership.list({ token: firstUserToken })
298 298
299 expect(body.total).to.equal(0) 299 expect(body.total).to.equal(0)
300 expect(body.data).to.be.an('array') 300 expect(body.data).to.be.an('array')
@@ -302,7 +302,7 @@ describe('Test video change ownership - quota too small', function () {
302 } 302 }
303 303
304 { 304 {
305 const body = await server.changeOwnershipCommand.list({ token: secondUserToken }) 305 const body = await server.changeOwnership.list({ token: secondUserToken })
306 306
307 expect(body.total).to.equal(1) 307 expect(body.total).to.equal(1)
308 expect(body.data).to.be.an('array') 308 expect(body.data).to.be.an('array')
@@ -315,10 +315,10 @@ describe('Test video change ownership - quota too small', function () {
315 it('Should not be possible to accept the change of ownership from second user because of exceeded quota', async function () { 315 it('Should not be possible to accept the change of ownership from second user because of exceeded quota', async function () {
316 this.timeout(10000) 316 this.timeout(10000)
317 317
318 const { videoChannels } = await server.usersCommand.getMyInfo({ token: secondUserToken }) 318 const { videoChannels } = await server.users.getMyInfo({ token: secondUserToken })
319 const channelId = videoChannels[0].id 319 const channelId = videoChannels[0].id
320 320
321 await server.changeOwnershipCommand.accept({ 321 await server.changeOwnership.accept({
322 token: secondUserToken, 322 token: secondUserToken,
323 ownershipId: lastRequestId, 323 ownershipId: lastRequestId,
324 channelId, 324 channelId,