mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Change api output for videos
This commit is contained in:
@@ -205,8 +205,8 @@ describe('Test multiple pods', function () {
|
||||
if (err) throw err
|
||||
|
||||
const video = res.body[0]
|
||||
to_remove.push(res.body[2]._id)
|
||||
to_remove.push(res.body[3]._id)
|
||||
to_remove.push(res.body[2].id)
|
||||
to_remove.push(res.body[3].id)
|
||||
|
||||
webtorrent.add(video.magnetUri, function (torrent) {
|
||||
expect(torrent.files).to.exist
|
||||
@@ -300,11 +300,11 @@ describe('Test multiple pods', function () {
|
||||
const videos = res.body
|
||||
expect(videos).to.be.an('array')
|
||||
expect(videos.length).to.equal(2)
|
||||
expect(videos[0]._id).not.to.equal(videos[1]._id)
|
||||
expect(videos[0]._id).not.to.equal(to_remove[0])
|
||||
expect(videos[1]._id).not.to.equal(to_remove[0])
|
||||
expect(videos[0]._id).not.to.equal(to_remove[1])
|
||||
expect(videos[1]._id).not.to.equal(to_remove[1])
|
||||
expect(videos[0].id).not.to.equal(videos[1].id)
|
||||
expect(videos[0].id).not.to.equal(to_remove[0])
|
||||
expect(videos[1].id).not.to.equal(to_remove[0])
|
||||
expect(videos[0].id).not.to.equal(to_remove[1])
|
||||
expect(videos[1].id).not.to.equal(to_remove[1])
|
||||
|
||||
callback()
|
||||
})
|
||||
|
||||
@@ -68,7 +68,30 @@ describe('Test a single pod', function () {
|
||||
expect(video.podUrl).to.equal('http://localhost:9001')
|
||||
expect(video.magnetUri).to.exist
|
||||
|
||||
video_id = video._id
|
||||
video_id = video.id
|
||||
|
||||
webtorrent.add(video.magnetUri, function (torrent) {
|
||||
expect(torrent.files).to.exist
|
||||
expect(torrent.files.length).to.equal(1)
|
||||
expect(torrent.files[0].path).to.exist.and.to.not.equal('')
|
||||
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('Should get the video', function (done) {
|
||||
// Yes, this could be long
|
||||
this.timeout(60000)
|
||||
|
||||
utils.getVideo(url, video_id, function (err, res) {
|
||||
if (err) throw err
|
||||
|
||||
const video = res.body
|
||||
expect(video.name).to.equal('my super name')
|
||||
expect(video.description).to.equal('my super description')
|
||||
expect(video.podUrl).to.equal('http://localhost:9001')
|
||||
expect(video.magnetUri).to.exist
|
||||
|
||||
webtorrent.add(video.magnetUri, function (torrent) {
|
||||
expect(torrent.files).to.exist
|
||||
@@ -91,7 +114,6 @@ describe('Test a single pod', function () {
|
||||
expect(video.name).to.equal('my super name')
|
||||
expect(video.description).to.equal('my super description')
|
||||
expect(video.podUrl).to.equal('http://localhost:9001')
|
||||
expect(video.magnetUri).to.exist
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
@@ -9,6 +9,7 @@ const request = require('supertest')
|
||||
const testUtils = {
|
||||
flushTests: flushTests,
|
||||
getFriendsList: getFriendsList,
|
||||
getVideo: getVideo,
|
||||
getVideosList: getVideosList,
|
||||
makeFriends: makeFriends,
|
||||
quitFriends: quitFriends,
|
||||
@@ -36,6 +37,17 @@ function getFriendsList (url, end) {
|
||||
.end(end)
|
||||
}
|
||||
|
||||
function getVideo (url, id, end) {
|
||||
const path = '/api/v1/videos/' + id
|
||||
|
||||
request(url)
|
||||
.get(path)
|
||||
.set('Accept', 'application/json')
|
||||
.expect(200)
|
||||
.expect('Content-Type', /json/)
|
||||
.end(end)
|
||||
}
|
||||
|
||||
function getVideosList (url, end) {
|
||||
const path = '/api/v1/videos'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user