function (next) {
utils.loginAndGetAccessToken(server, function (err, token) {
if (err) throw err
- server.access_token = token
+ server.accessToken = token
next()
})
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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)
})
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)
})
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)
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)
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)