Fix typos in server tests
This commit is contained in:
parent
d6ea0175cb
commit
b6c6f935d4
4 changed files with 23 additions and 22 deletions
|
@ -59,7 +59,7 @@ describe('Test parameters validator', function () {
|
|||
function (next) {
|
||||
utils.loginAndGetAccessToken(server, function (err, token) {
|
||||
if (err) throw err
|
||||
server.access_token = token
|
||||
server.accessToken = token
|
||||
|
||||
next()
|
||||
})
|
||||
|
@ -138,7 +138,7 @@ describe('Test parameters validator', function () {
|
|||
it('Should fail with nothing', function (done) {
|
||||
const data = {}
|
||||
const attach = {}
|
||||
makePostRequest(path, server.access_token, data, attach, done)
|
||||
makePostRequest(path, server.accessToken, data, attach, done)
|
||||
})
|
||||
|
||||
it('Should fail without name', function (done) {
|
||||
|
@ -148,7 +148,7 @@ describe('Test parameters validator', function () {
|
|||
const attach = {
|
||||
'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
|
||||
}
|
||||
makePostRequest(path, server.access_token, data, attach, done)
|
||||
makePostRequest(path, server.accessToken, data, attach, done)
|
||||
})
|
||||
|
||||
it('Should fail with a long name', function (done) {
|
||||
|
@ -159,7 +159,7 @@ describe('Test parameters validator', function () {
|
|||
const attach = {
|
||||
'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
|
||||
}
|
||||
makePostRequest(path, server.access_token, data, attach, done)
|
||||
makePostRequest(path, server.accessToken, data, attach, done)
|
||||
})
|
||||
|
||||
it('Should fail without description', function (done) {
|
||||
|
@ -169,7 +169,7 @@ describe('Test parameters validator', function () {
|
|||
const attach = {
|
||||
'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
|
||||
}
|
||||
makePostRequest(path, server.access_token, data, attach, done)
|
||||
makePostRequest(path, server.accessToken, data, attach, done)
|
||||
})
|
||||
|
||||
it('Should fail with a long description', function (done) {
|
||||
|
@ -182,7 +182,7 @@ describe('Test parameters validator', function () {
|
|||
const attach = {
|
||||
'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
|
||||
}
|
||||
makePostRequest(path, server.access_token, data, attach, done)
|
||||
makePostRequest(path, server.accessToken, data, attach, done)
|
||||
})
|
||||
|
||||
it('Should fail without an input file', function (done) {
|
||||
|
@ -191,7 +191,7 @@ describe('Test parameters validator', function () {
|
|||
description: 'my super description'
|
||||
}
|
||||
const attach = {}
|
||||
makePostRequest(path, server.access_token, data, attach, done)
|
||||
makePostRequest(path, server.accessToken, data, attach, done)
|
||||
})
|
||||
|
||||
it('Should fail without an incorrect input file', function (done) {
|
||||
|
@ -202,7 +202,7 @@ describe('Test parameters validator', function () {
|
|||
const attach = {
|
||||
'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short_fake.webm')
|
||||
}
|
||||
makePostRequest(path, server.access_token, data, attach, done)
|
||||
makePostRequest(path, server.accessToken, data, attach, done)
|
||||
})
|
||||
|
||||
it('Should succeed with the correct parameters', function (done) {
|
||||
|
@ -213,11 +213,11 @@ describe('Test parameters validator', function () {
|
|||
const attach = {
|
||||
'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
|
||||
}
|
||||
makePostRequest(path, server.access_token, data, attach, function () {
|
||||
makePostRequest(path, server.accessToken, data, attach, function () {
|
||||
attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.mp4')
|
||||
makePostRequest(path, server.access_token, data, attach, function () {
|
||||
makePostRequest(path, server.accessToken, data, attach, function () {
|
||||
attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.ogv')
|
||||
makePostRequest(path, server.access_token, data, attach, done, true)
|
||||
makePostRequest(path, server.accessToken, data, attach, done, true)
|
||||
}, true)
|
||||
}, true)
|
||||
})
|
||||
|
@ -261,21 +261,21 @@ describe('Test parameters validator', function () {
|
|||
it('Should have 404 with nothing', function (done) {
|
||||
request(server.url)
|
||||
.delete(path)
|
||||
.set('Authorization', 'Bearer ' + server.access_token)
|
||||
.set('Authorization', 'Bearer ' + server.accessToken)
|
||||
.expect(400, done)
|
||||
})
|
||||
|
||||
it('Should fail without a mongodb id', function (done) {
|
||||
request(server.url)
|
||||
.delete(path + 'hello')
|
||||
.set('Authorization', 'Bearer ' + server.access_token)
|
||||
.set('Authorization', 'Bearer ' + server.accessToken)
|
||||
.expect(400, done)
|
||||
})
|
||||
|
||||
it('Should fail with a video which does not exist', function (done) {
|
||||
request(server.url)
|
||||
.delete(path + '123456789012345678901234')
|
||||
.set('Authorization', 'Bearer ' + server.access_token)
|
||||
.set('Authorization', 'Bearer ' + server.accessToken)
|
||||
.expect(404, done)
|
||||
})
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ describe('Test advanced friends', function () {
|
|||
const fixture = 'video_short.webm'
|
||||
const server = servers[podNumber - 1]
|
||||
|
||||
return utils.uploadVideo(server.url, server.access_token, name, description, fixture, callback)
|
||||
return utils.uploadVideo(server.url, server.accessToken, name, description, fixture, callback)
|
||||
}
|
||||
|
||||
function getVideos (podNumber, callback) {
|
||||
|
|
|
@ -72,7 +72,7 @@ describe('Test multiple pods', function () {
|
|||
|
||||
async.series([
|
||||
function (next) {
|
||||
utils.uploadVideo(servers[0].url, servers[0].access_token, 'my super name for pod 1', 'my super description for pod 1', 'video_short1.webm', next)
|
||||
utils.uploadVideo(servers[0].url, servers[0].accessToken, 'my super name for pod 1', 'my super description for pod 1', 'video_short1.webm', next)
|
||||
},
|
||||
function (next) {
|
||||
setTimeout(next, 11000)
|
||||
|
@ -127,7 +127,7 @@ describe('Test multiple pods', function () {
|
|||
|
||||
async.series([
|
||||
function (next) {
|
||||
utils.uploadVideo(servers[1].url, servers[1].access_token, 'my super name for pod 2', 'my super description for pod 2', 'video_short2.webm', next)
|
||||
utils.uploadVideo(servers[1].url, servers[1].accessToken, 'my super name for pod 2', 'my super description for pod 2', 'video_short2.webm', next)
|
||||
},
|
||||
function (next) {
|
||||
setTimeout(next, 11000)
|
||||
|
@ -182,10 +182,10 @@ describe('Test multiple pods', function () {
|
|||
|
||||
async.series([
|
||||
function (next) {
|
||||
utils.uploadVideo(servers[2].url, servers[2].access_token, 'my super name for pod 3', 'my super description for pod 3', 'video_short3.webm', next)
|
||||
utils.uploadVideo(servers[2].url, servers[2].accessToken, 'my super name for pod 3', 'my super description for pod 3', 'video_short3.webm', next)
|
||||
},
|
||||
function (next) {
|
||||
utils.uploadVideo(servers[2].url, servers[2].access_token, 'my super name for pod 3-2', 'my super description for pod 3-2', 'video_short.webm', next)
|
||||
utils.uploadVideo(servers[2].url, servers[2].accessToken, 'my super name for pod 3-2', 'my super description for pod 3-2', 'video_short.webm', next)
|
||||
},
|
||||
function (next) {
|
||||
setTimeout(next, 22000)
|
||||
|
|
|
@ -32,7 +32,7 @@ describe('Test a single pod', function () {
|
|||
function (next) {
|
||||
utils.loginAndGetAccessToken(server, function (err, token) {
|
||||
if (err) throw err
|
||||
server.access_token = token
|
||||
server.accessToken = token
|
||||
next()
|
||||
})
|
||||
},
|
||||
|
@ -55,7 +55,7 @@ describe('Test a single pod', function () {
|
|||
|
||||
it('Should upload the video', function (done) {
|
||||
this.timeout(5000)
|
||||
utils.uploadVideo(server.url, server.access_token, 'my super name', 'my super description', 'video_short.webm', done)
|
||||
utils.uploadVideo(server.url, server.accessToken, 'my super name', 'my super description', 'video_short.webm', done)
|
||||
})
|
||||
|
||||
it('Should seed the uploaded video', function (done) {
|
||||
|
@ -87,7 +87,8 @@ describe('Test a single pod', function () {
|
|||
expect(torrent.files.length).to.equal(1)
|
||||
expect(torrent.files[0].path).to.exist.and.to.not.equal('')
|
||||
|
||||
done()
|
||||
// We remove it because we'll add it again
|
||||
webtorrent.remove(video.magnetUri, done)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue