aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/videos/videos.ts
diff options
context:
space:
mode:
authorGérald Niel <gerald.niel@gegeweb.org>2018-04-19 19:28:55 +0200
committerGérald Niel <gerald.niel@gegeweb.org>2018-04-19 19:28:55 +0200
commit0db1a226507a39b0a663e3e63f04851836a44d5a (patch)
tree8c8dad658ea5608afaae238cfb6fe803292f908f /server/tests/utils/videos/videos.ts
parent0030284b0df2983914291d6fe83675e2aa892e6a (diff)
parentd4f3fea659163749f9ea879a5e1dd313106353c6 (diff)
downloadPeerTube-0db1a226507a39b0a663e3e63f04851836a44d5a.tar.gz
PeerTube-0db1a226507a39b0a663e3e63f04851836a44d5a.tar.zst
PeerTube-0db1a226507a39b0a663e3e63f04851836a44d5a.zip
Merge branch 'develop' of framagit.org:chocobozzz/PeerTube into develop
Diffstat (limited to 'server/tests/utils/videos/videos.ts')
-rw-r--r--server/tests/utils/videos/videos.ts30
1 files changed, 28 insertions, 2 deletions
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts
index 01e7fa5a1..5e186147e 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/server/tests/utils/videos/videos.ts
@@ -128,6 +128,18 @@ function getVideosList (url: string) {
128 .expect('Content-Type', /json/) 128 .expect('Content-Type', /json/)
129} 129}
130 130
131function getVideosListWithToken (url: string, token: string) {
132 const path = '/api/v1/videos'
133
134 return request(url)
135 .get(path)
136 .set('Authorization', 'Bearer ' + token)
137 .query({ sort: 'name' })
138 .set('Accept', 'application/json')
139 .expect(200)
140 .expect('Content-Type', /json/)
141}
142
131function getLocalVideos (url: string) { 143function getLocalVideos (url: string) {
132 const path = '/api/v1/videos' 144 const path = '/api/v1/videos'
133 145
@@ -202,6 +214,18 @@ function searchVideo (url: string, search: string) {
202 .expect('Content-Type', /json/) 214 .expect('Content-Type', /json/)
203} 215}
204 216
217function searchVideoWithToken (url: string, search: string, token: string) {
218 const path = '/api/v1/videos'
219 const req = request(url)
220 .get(path + '/search')
221 .set('Authorization', 'Bearer ' + token)
222 .query({ search })
223 .set('Accept', 'application/json')
224
225 return req.expect(200)
226 .expect('Content-Type', /json/)
227}
228
205function searchVideoWithPagination (url: string, search: string, start: number, count: number, sort?: string) { 229function searchVideoWithPagination (url: string, search: string, start: number, count: number, sort?: string) {
206 const path = '/api/v1/videos' 230 const path = '/api/v1/videos'
207 231
@@ -418,6 +442,8 @@ async function completeVideoCheck (
418 expect(video.licence.label).to.equal(VIDEO_LICENCES[attributes.licence] || 'Unknown') 442 expect(video.licence.label).to.equal(VIDEO_LICENCES[attributes.licence] || 'Unknown')
419 expect(video.language.id).to.equal(attributes.language) 443 expect(video.language.id).to.equal(attributes.language)
420 expect(video.language.label).to.equal(VIDEO_LANGUAGES[attributes.language] || 'Unknown') 444 expect(video.language.label).to.equal(VIDEO_LANGUAGES[attributes.language] || 'Unknown')
445 expect(video.privacy.id).to.deep.equal(attributes.privacy)
446 expect(video.privacy.label).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy])
421 expect(video.nsfw).to.equal(attributes.nsfw) 447 expect(video.nsfw).to.equal(attributes.nsfw)
422 expect(video.description).to.equal(attributes.description) 448 expect(video.description).to.equal(attributes.description)
423 expect(video.account.host).to.equal(attributes.account.host) 449 expect(video.account.host).to.equal(attributes.account.host)
@@ -435,8 +461,6 @@ async function completeVideoCheck (
435 461
436 expect(videoDetails.files).to.have.lengthOf(attributes.files.length) 462 expect(videoDetails.files).to.have.lengthOf(attributes.files.length)
437 expect(videoDetails.tags).to.deep.equal(attributes.tags) 463 expect(videoDetails.tags).to.deep.equal(attributes.tags)
438 expect(videoDetails.privacy.id).to.deep.equal(attributes.privacy)
439 expect(videoDetails.privacy.label).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy])
440 expect(videoDetails.account.name).to.equal(attributes.account.name) 464 expect(videoDetails.account.name).to.equal(attributes.account.name)
441 expect(videoDetails.account.host).to.equal(attributes.account.host) 465 expect(videoDetails.account.host).to.equal(attributes.account.host)
442 expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled) 466 expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled)
@@ -490,6 +514,7 @@ export {
490 getVideoPrivacies, 514 getVideoPrivacies,
491 getVideoLanguages, 515 getVideoLanguages,
492 getMyVideos, 516 getMyVideos,
517 searchVideoWithToken,
493 getVideo, 518 getVideo,
494 getVideoWithToken, 519 getVideoWithToken,
495 getVideosList, 520 getVideosList,
@@ -499,6 +524,7 @@ export {
499 searchVideo, 524 searchVideo,
500 searchVideoWithPagination, 525 searchVideoWithPagination,
501 searchVideoWithSort, 526 searchVideoWithSort,
527 getVideosListWithToken,
502 uploadVideo, 528 uploadVideo,
503 updateVideo, 529 updateVideo,
504 rateVideo, 530 rateVideo,