aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-03-13 10:24:28 +0100
committerChocobozzz <me@florianbigard.com>2018-03-13 10:24:28 +0100
commit066e94c5382a761180c7d82fa24b31b66dbeaca4 (patch)
tree36037c2c5aaa6c86c2299ceafe6ec35dd1abbd13 /server/tests
parent66c3b7744c6c7a91b9538eb5a6e0ae07e0a5a6af (diff)
downloadPeerTube-066e94c5382a761180c7d82fa24b31b66dbeaca4.tar.gz
PeerTube-066e94c5382a761180c7d82fa24b31b66dbeaca4.tar.zst
PeerTube-066e94c5382a761180c7d82fa24b31b66dbeaca4.zip
Add "local" videos in menu
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/videos/multiple-servers.ts32
-rw-r--r--server/tests/utils/videos/videos.ts12
2 files changed, 43 insertions, 1 deletions
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index 3f6b82c50..42a1241f7 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -15,7 +15,7 @@ import {
15 dateIsValid, 15 dateIsValid,
16 doubleFollow, 16 doubleFollow,
17 flushAndRunMultipleServers, 17 flushAndRunMultipleServers,
18 flushTests, 18 flushTests, getLocalVideos,
19 getVideo, 19 getVideo,
20 getVideoChannelsList, 20 getVideoChannelsList,
21 getVideosList, 21 getVideosList,
@@ -349,6 +349,36 @@ describe('Test multiple servers', function () {
349 }) 349 })
350 }) 350 })
351 351
352 describe('It should list local videos', function () {
353 it('Should list only local videos on server 1', async function () {
354 const { body } = await getLocalVideos(servers[0].url)
355
356 expect(body.total).to.equal(1)
357 expect(body.data).to.be.an('array')
358 expect(body.data.length).to.equal(1)
359 expect(body.data[0].name).to.equal('my super name for server 1')
360 })
361
362 it('Should list only local videos on server 2', async function () {
363 const { body } = await getLocalVideos(servers[1].url)
364
365 expect(body.total).to.equal(1)
366 expect(body.data).to.be.an('array')
367 expect(body.data.length).to.equal(1)
368 expect(body.data[0].name).to.equal('my super name for server 2')
369 })
370
371 it('Should list only local videos on server 3', async function () {
372 const { body } = await getLocalVideos(servers[2].url)
373
374 expect(body.total).to.equal(2)
375 expect(body.data).to.be.an('array')
376 expect(body.data.length).to.equal(2)
377 expect(body.data[0].name).to.equal('my super name for server 3')
378 expect(body.data[1].name).to.equal('my super name for server 3-2')
379 })
380 })
381
352 describe('Should seed the uploaded video', function () { 382 describe('Should seed the uploaded video', function () {
353 it('Should add the file 1 by asking server 3', async function () { 383 it('Should add the file 1 by asking server 3', async function () {
354 this.timeout(10000) 384 this.timeout(10000)
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts
index ec40c5465..89db16fec 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/server/tests/utils/videos/videos.ts
@@ -123,6 +123,17 @@ function getVideosList (url: string) {
123 .expect('Content-Type', /json/) 123 .expect('Content-Type', /json/)
124} 124}
125 125
126function getLocalVideos (url: string) {
127 const path = '/api/v1/videos'
128
129 return request(url)
130 .get(path)
131 .query({ sort: 'name', filter: 'local' })
132 .set('Accept', 'application/json')
133 .expect(200)
134 .expect('Content-Type', /json/)
135}
136
126function getMyVideos (url: string, accessToken: string, start: number, count: number, sort?: string) { 137function getMyVideos (url: string, accessToken: string, start: number, count: number, sort?: string) {
127 const path = '/api/v1/users/me/videos' 138 const path = '/api/v1/users/me/videos'
128 139
@@ -487,6 +498,7 @@ export {
487 rateVideo, 498 rateVideo,
488 viewVideo, 499 viewVideo,
489 parseTorrentVideo, 500 parseTorrentVideo,
501 getLocalVideos,
490 completeVideoCheck, 502 completeVideoCheck,
491 checkVideoFilesWereRemoved 503 checkVideoFilesWereRemoved
492} 504}