From b6c6f935d4eb3692cfd7f79a66cc40e0fef69256 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 13 May 2016 15:27:31 +0200 Subject: Fix typos in server tests --- server/tests/api/checkParams.js | 28 ++++++++++++++-------------- server/tests/api/friendsAdvanced.js | 2 +- server/tests/api/multiplePods.js | 8 ++++---- server/tests/api/singlePod.js | 7 ++++--- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/server/tests/api/checkParams.js b/server/tests/api/checkParams.js index 71113fd39..1f47e5ef4 100644 --- a/server/tests/api/checkParams.js +++ b/server/tests/api/checkParams.js @@ -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) }) diff --git a/server/tests/api/friendsAdvanced.js b/server/tests/api/friendsAdvanced.js index 833a530dd..9bd202a05 100644 --- a/server/tests/api/friendsAdvanced.js +++ b/server/tests/api/friendsAdvanced.js @@ -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) { diff --git a/server/tests/api/multiplePods.js b/server/tests/api/multiplePods.js index f1415f6f1..1a61034fc 100644 --- a/server/tests/api/multiplePods.js +++ b/server/tests/api/multiplePods.js @@ -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) diff --git a/server/tests/api/singlePod.js b/server/tests/api/singlePod.js index 542dea430..0d0e6a82e 100644 --- a/server/tests/api/singlePod.js +++ b/server/tests/api/singlePod.js @@ -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) }) }) }) -- cgit v1.2.3