aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/client.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/client.ts
parentd23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff)
downloadPeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip
Shorter server command names
Diffstat (limited to 'server/tests/client.ts')
-rw-r--r--server/tests/client.ts76
1 files changed, 38 insertions, 38 deletions
diff --git a/server/tests/client.ts b/server/tests/client.ts
index e91d4c671..caf6fb00c 100644
--- a/server/tests/client.ts
+++ b/server/tests/client.ts
@@ -59,8 +59,8 @@ describe('Test a client controllers', function () {
59 59
60 await setDefaultVideoChannel(servers) 60 await setDefaultVideoChannel(servers)
61 61
62 await servers[0].channelsCommand.update({ 62 await servers[0].channels.update({
63 channelName: servers[0].videoChannel.name, 63 channelName: servers[0].store.channel.name,
64 attributes: { description: channelDescription } 64 attributes: { description: channelDescription }
65 }) 65 })
66 66
@@ -68,13 +68,13 @@ describe('Test a client controllers', function () {
68 68
69 { 69 {
70 const attributes = { name: videoName, description: videoDescription } 70 const attributes = { name: videoName, description: videoDescription }
71 await servers[0].videosCommand.upload({ attributes }) 71 await servers[0].videos.upload({ attributes })
72 72
73 const { data } = await servers[0].videosCommand.list() 73 const { data } = await servers[0].videos.list()
74 expect(data.length).to.equal(1) 74 expect(data.length).to.equal(1)
75 75
76 const video = data[0] 76 const video = data[0]
77 servers[0].video = video 77 servers[0].store.video = video
78 videoIds = [ video.id, video.uuid, video.shortUUID ] 78 videoIds = [ video.id, video.uuid, video.shortUUID ]
79 } 79 }
80 80
@@ -85,21 +85,21 @@ describe('Test a client controllers', function () {
85 displayName: playlistName, 85 displayName: playlistName,
86 description: playlistDescription, 86 description: playlistDescription,
87 privacy: VideoPlaylistPrivacy.PUBLIC, 87 privacy: VideoPlaylistPrivacy.PUBLIC,
88 videoChannelId: servers[0].videoChannel.id 88 videoChannelId: servers[0].store.channel.id
89 } 89 }
90 90
91 playlist = await servers[0].playlistsCommand.create({ attributes }) 91 playlist = await servers[0].playlists.create({ attributes })
92 playlistIds = [ playlist.id, playlist.shortUUID, playlist.uuid ] 92 playlistIds = [ playlist.id, playlist.shortUUID, playlist.uuid ]
93 93
94 await servers[0].playlistsCommand.addElement({ playlistId: playlist.shortUUID, attributes: { videoId: servers[0].video.id } }) 94 await servers[0].playlists.addElement({ playlistId: playlist.shortUUID, attributes: { videoId: servers[0].store.video.id } })
95 } 95 }
96 96
97 // Account 97 // Account
98 98
99 { 99 {
100 await servers[0].usersCommand.updateMe({ description: 'my account description' }) 100 await servers[0].users.updateMe({ description: 'my account description' })
101 101
102 account = await servers[0].accountsCommand.get({ accountName: `${servers[0].user.username}@${servers[0].host}` }) 102 account = await servers[0].accounts.get({ accountName: `${servers[0].store.user.username}@${servers[0].host}` })
103 } 103 }
104 104
105 await waitJobs(servers) 105 await waitJobs(servers)
@@ -120,8 +120,8 @@ describe('Test a client controllers', function () {
120 const port = servers[0].port 120 const port = servers[0].port
121 121
122 const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:' + port + '/services/oembed?' + 122 const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:' + port + '/services/oembed?' +
123 `url=http%3A%2F%2Flocalhost%3A${port}%2Fw%2F${servers[0].video.uuid}" ` + 123 `url=http%3A%2F%2Flocalhost%3A${port}%2Fw%2F${servers[0].store.video.uuid}" ` +
124 `title="${servers[0].video.name}" />` 124 `title="${servers[0].store.video.name}" />`
125 125
126 expect(res.text).to.contain(expectedLink) 126 expect(res.text).to.contain(expectedLink)
127 } 127 }
@@ -159,17 +159,17 @@ describe('Test a client controllers', function () {
159 expect(text).to.contain(`<meta property="og:title" content="${account.displayName}" />`) 159 expect(text).to.contain(`<meta property="og:title" content="${account.displayName}" />`)
160 expect(text).to.contain(`<meta property="og:description" content="${account.description}" />`) 160 expect(text).to.contain(`<meta property="og:description" content="${account.description}" />`)
161 expect(text).to.contain('<meta property="og:type" content="website" />') 161 expect(text).to.contain('<meta property="og:type" content="website" />')
162 expect(text).to.contain(`<meta property="og:url" content="${servers[0].url}/accounts/${servers[0].user.username}" />`) 162 expect(text).to.contain(`<meta property="og:url" content="${servers[0].url}/accounts/${servers[0].store.user.username}" />`)
163 } 163 }
164 164
165 async function channelPageTest (path: string) { 165 async function channelPageTest (path: string) {
166 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', statusCodeExpected: HttpStatusCode.OK_200 }) 166 const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', statusCodeExpected: HttpStatusCode.OK_200 })
167 const text = res.text 167 const text = res.text
168 168
169 expect(text).to.contain(`<meta property="og:title" content="${servers[0].videoChannel.displayName}" />`) 169 expect(text).to.contain(`<meta property="og:title" content="${servers[0].store.channel.displayName}" />`)
170 expect(text).to.contain(`<meta property="og:description" content="${channelDescription}" />`) 170 expect(text).to.contain(`<meta property="og:description" content="${channelDescription}" />`)
171 expect(text).to.contain('<meta property="og:type" content="website" />') 171 expect(text).to.contain('<meta property="og:type" content="website" />')
172 expect(text).to.contain(`<meta property="og:url" content="${servers[0].url}/video-channels/${servers[0].videoChannel.name}" />`) 172 expect(text).to.contain(`<meta property="og:url" content="${servers[0].url}/video-channels/${servers[0].store.channel.name}" />`)
173 } 173 }
174 174
175 async function watchVideoPageTest (path: string) { 175 async function watchVideoPageTest (path: string) {
@@ -179,7 +179,7 @@ describe('Test a client controllers', function () {
179 expect(text).to.contain(`<meta property="og:title" content="${videoName}" />`) 179 expect(text).to.contain(`<meta property="og:title" content="${videoName}" />`)
180 expect(text).to.contain(`<meta property="og:description" content="${videoDescriptionPlainText}" />`) 180 expect(text).to.contain(`<meta property="og:description" content="${videoDescriptionPlainText}" />`)
181 expect(text).to.contain('<meta property="og:type" content="video" />') 181 expect(text).to.contain('<meta property="og:type" content="video" />')
182 expect(text).to.contain(`<meta property="og:url" content="${servers[0].url}/w/${servers[0].video.uuid}" />`) 182 expect(text).to.contain(`<meta property="og:url" content="${servers[0].url}/w/${servers[0].store.video.uuid}" />`)
183 } 183 }
184 184
185 async function watchPlaylistPageTest (path: string) { 185 async function watchPlaylistPageTest (path: string) {
@@ -193,15 +193,15 @@ describe('Test a client controllers', function () {
193 } 193 }
194 194
195 it('Should have valid Open Graph tags on the account page', async function () { 195 it('Should have valid Open Graph tags on the account page', async function () {
196 await accountPageTest('/accounts/' + servers[0].user.username) 196 await accountPageTest('/accounts/' + servers[0].store.user.username)
197 await accountPageTest('/a/' + servers[0].user.username) 197 await accountPageTest('/a/' + servers[0].store.user.username)
198 await accountPageTest('/@' + servers[0].user.username) 198 await accountPageTest('/@' + servers[0].store.user.username)
199 }) 199 })
200 200
201 it('Should have valid Open Graph tags on the channel page', async function () { 201 it('Should have valid Open Graph tags on the channel page', async function () {
202 await channelPageTest('/video-channels/' + servers[0].videoChannel.name) 202 await channelPageTest('/video-channels/' + servers[0].store.channel.name)
203 await channelPageTest('/c/' + servers[0].videoChannel.name) 203 await channelPageTest('/c/' + servers[0].store.channel.name)
204 await channelPageTest('/@' + servers[0].videoChannel.name) 204 await channelPageTest('/@' + servers[0].store.channel.name)
205 }) 205 })
206 206
207 it('Should have valid Open Graph tags on the watch page', async function () { 207 it('Should have valid Open Graph tags on the watch page', async function () {
@@ -241,7 +241,7 @@ describe('Test a client controllers', function () {
241 241
242 expect(text).to.contain('<meta property="twitter:card" content="summary" />') 242 expect(text).to.contain('<meta property="twitter:card" content="summary" />')
243 expect(text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />') 243 expect(text).to.contain('<meta property="twitter:site" content="@Chocobozzz" />')
244 expect(text).to.contain(`<meta property="twitter:title" content="${servers[0].videoChannel.displayName}" />`) 244 expect(text).to.contain(`<meta property="twitter:title" content="${servers[0].store.channel.displayName}" />`)
245 expect(text).to.contain(`<meta property="twitter:description" content="${channelDescription}" />`) 245 expect(text).to.contain(`<meta property="twitter:description" content="${channelDescription}" />`)
246 } 246 }
247 247
@@ -288,22 +288,22 @@ describe('Test a client controllers', function () {
288 }) 288 })
289 289
290 it('Should have valid twitter card on the channel page', async function () { 290 it('Should have valid twitter card on the channel page', async function () {
291 await channelPageTest('/video-channels/' + servers[0].videoChannel.name) 291 await channelPageTest('/video-channels/' + servers[0].store.channel.name)
292 await channelPageTest('/c/' + servers[0].videoChannel.name) 292 await channelPageTest('/c/' + servers[0].store.channel.name)
293 await channelPageTest('/@' + servers[0].videoChannel.name) 293 await channelPageTest('/@' + servers[0].store.channel.name)
294 }) 294 })
295 }) 295 })
296 296
297 describe('Whitelisted', function () { 297 describe('Whitelisted', function () {
298 298
299 before(async function () { 299 before(async function () {
300 const config = await servers[0].configCommand.getCustomConfig() 300 const config = await servers[0].config.getCustomConfig()
301 config.services.twitter = { 301 config.services.twitter = {
302 username: '@Kuja', 302 username: '@Kuja',
303 whitelisted: true 303 whitelisted: true
304 } 304 }
305 305
306 await servers[0].configCommand.updateCustomConfig({ newCustomConfig: config }) 306 await servers[0].config.updateCustomConfig({ newCustomConfig: config })
307 }) 307 })
308 308
309 async function accountPageTest (path: string) { 309 async function accountPageTest (path: string) {
@@ -361,9 +361,9 @@ describe('Test a client controllers', function () {
361 }) 361 })
362 362
363 it('Should have valid twitter card on the channel page', async function () { 363 it('Should have valid twitter card on the channel page', async function () {
364 await channelPageTest('/video-channels/' + servers[0].videoChannel.name) 364 await channelPageTest('/video-channels/' + servers[0].store.channel.name)
365 await channelPageTest('/c/' + servers[0].videoChannel.name) 365 await channelPageTest('/c/' + servers[0].store.channel.name)
366 await channelPageTest('/@' + servers[0].videoChannel.name) 366 await channelPageTest('/@' + servers[0].store.channel.name)
367 }) 367 })
368 }) 368 })
369 }) 369 })
@@ -371,7 +371,7 @@ describe('Test a client controllers', function () {
371 describe('Index HTML', function () { 371 describe('Index HTML', function () {
372 372
373 it('Should have valid index html tags (title, description...)', async function () { 373 it('Should have valid index html tags (title, description...)', async function () {
374 const config = await servers[0].configCommand.getConfig() 374 const config = await servers[0].config.getConfig()
375 const res = await makeHTMLRequest(servers[0].url, '/videos/trending') 375 const res = await makeHTMLRequest(servers[0].url, '/videos/trending')
376 376
377 const description = 'PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.' 377 const description = 'PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.'
@@ -379,7 +379,7 @@ describe('Test a client controllers', function () {
379 }) 379 })
380 380
381 it('Should update the customized configuration and have the correct index html tags', async function () { 381 it('Should update the customized configuration and have the correct index html tags', async function () {
382 await servers[0].configCommand.updateCustomSubConfig({ 382 await servers[0].config.updateCustomSubConfig({
383 newConfig: { 383 newConfig: {
384 instance: { 384 instance: {
385 name: 'PeerTube updated', 385 name: 'PeerTube updated',
@@ -396,14 +396,14 @@ describe('Test a client controllers', function () {
396 } 396 }
397 }) 397 })
398 398
399 const config = await servers[0].configCommand.getConfig() 399 const config = await servers[0].config.getConfig()
400 const res = await makeHTMLRequest(servers[0].url, '/videos/trending') 400 const res = await makeHTMLRequest(servers[0].url, '/videos/trending')
401 401
402 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }', config) 402 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }', config)
403 }) 403 })
404 404
405 it('Should have valid index html updated tags (title, description...)', async function () { 405 it('Should have valid index html updated tags (title, description...)', async function () {
406 const config = await servers[0].configCommand.getConfig() 406 const config = await servers[0].config.getConfig()
407 const res = await makeHTMLRequest(servers[0].url, '/videos/trending') 407 const res = await makeHTMLRequest(servers[0].url, '/videos/trending')
408 408
409 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }', config) 409 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }', config)
@@ -413,7 +413,7 @@ describe('Test a client controllers', function () {
413 for (const basePath of watchVideoBasePaths) { 413 for (const basePath of watchVideoBasePaths) {
414 for (const id of videoIds) { 414 for (const id of videoIds) {
415 const res = await makeHTMLRequest(servers[1].url, basePath + id) 415 const res = await makeHTMLRequest(servers[1].url, basePath + id)
416 expect(res.text).to.contain(`<link rel="canonical" href="${servers[0].url}/videos/watch/${servers[0].video.uuid}" />`) 416 expect(res.text).to.contain(`<link rel="canonical" href="${servers[0].url}/videos/watch/${servers[0].store.video.uuid}" />`)
417 } 417 }
418 } 418 }
419 }) 419 })
@@ -451,8 +451,8 @@ describe('Test a client controllers', function () {
451 describe('Embed HTML', function () { 451 describe('Embed HTML', function () {
452 452
453 it('Should have the correct embed html tags', async function () { 453 it('Should have the correct embed html tags', async function () {
454 const config = await servers[0].configCommand.getConfig() 454 const config = await servers[0].config.getConfig()
455 const res = await makeHTMLRequest(servers[0].url, servers[0].video.embedPath) 455 const res = await makeHTMLRequest(servers[0].url, servers[0].store.video.embedPath)
456 456
457 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }', config) 457 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }', config)
458 }) 458 })