From e1e5b66d7f9e5eca236eb179b7fc3d890ed70bb9 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Thu, 3 Mar 2016 16:06:49 -0800 Subject: [PATCH] Update request, make server tests work with it --- package.json | 2 +- spec/helpers/helper.js | 1 - spec/server/common.coffee | 3 +-- spec/server/functional/auth.spec.coffee | 1 - spec/server/functional/db-id-version.spec.coffee | 1 - spec/server/functional/nocked.spec.coffee | 1 - spec/server/functional/patch.spec.coffee | 1 - spec/server/functional/payment.spec.coffee | 1 - spec/server/functional/user.spec.coffee | 1 - spec/server/unit/analytics.spec.coffee | 1 - 10 files changed, 2 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 8b9201978..8d8c4c5b7 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "passport": "0.1.x", "passport-local": "0.1.x", "redis": "", - "request": "2.12.x", + "request": "^2.69.0", "sendwithus": "2.1.x", "stream-buffers": "0.2.x", "stripe": "~2.9.0", diff --git a/spec/helpers/helper.js b/spec/helpers/helper.js index 7184ad9c3..9303e3bef 100644 --- a/spec/helpers/helper.js +++ b/spec/helpers/helper.js @@ -77,7 +77,6 @@ beforeEach(function(done) { }, function(cb) { // Initialize products - var request = require('request'); request.get(getURL('/db/products'), function(err, res, body) { expect(err).toBe(null); expect(res.statusCode).toBe(200); diff --git a/spec/server/common.coffee b/spec/server/common.coffee index 64e715b8e..e27cb589a 100644 --- a/spec/server/common.coffee +++ b/spec/server/common.coffee @@ -70,7 +70,7 @@ GLOBAL.saveModels = (models, done) -> GLOBAL.simplePermissions = [target: 'public', access: 'owner'] GLOBAL.ObjectId = mongoose.Types.ObjectId -GLOBAL.request = require 'request' +GLOBAL.request = require('request').defaults({jar: true}) Promise = require 'bluebird' Promise.promisifyAll(request, {multiArgs: true}) @@ -88,7 +88,6 @@ unittest.getUser = (name, email, password, done, force) -> # Creates the user if it doesn't already exist. return done(unittest.users[email]) if unittest.users[email] and not force - request = require 'request' request.post getURL('/auth/logout'), -> request.get getURL('/auth/whoami'), -> req = request.post(getURL('/db/user'), (err, response, body) -> diff --git a/spec/server/functional/auth.spec.coffee b/spec/server/functional/auth.spec.coffee index 2111ec19c..0060f4224 100644 --- a/spec/server/functional/auth.spec.coffee +++ b/spec/server/functional/auth.spec.coffee @@ -1,5 +1,4 @@ require '../common' -request = require 'request' User = require '../../../server/users/User' urlLogin = getURL('/auth/login') diff --git a/spec/server/functional/db-id-version.spec.coffee b/spec/server/functional/db-id-version.spec.coffee index 2b6198fa3..746b5b2eb 100644 --- a/spec/server/functional/db-id-version.spec.coffee +++ b/spec/server/functional/db-id-version.spec.coffee @@ -1,7 +1,6 @@ require '../common' describe '/db//version', -> - request = require 'request' it 'clears the db first', (done) -> clearModels [User, Article], (err) -> throw err if err diff --git a/spec/server/functional/nocked.spec.coffee b/spec/server/functional/nocked.spec.coffee index 3883c86fa..dac0270a2 100644 --- a/spec/server/functional/nocked.spec.coffee +++ b/spec/server/functional/nocked.spec.coffee @@ -1,4 +1,3 @@ -request = require 'request' require '../common' config = require '../../../server_config' nockUtils = require('../nock-utils') diff --git a/spec/server/functional/patch.spec.coffee b/spec/server/functional/patch.spec.coffee index b1219ccb6..723a9586a 100644 --- a/spec/server/functional/patch.spec.coffee +++ b/spec/server/functional/patch.spec.coffee @@ -1,7 +1,6 @@ require '../common' describe '/db/patch', -> - request = require 'request' async = require 'async' UserHandler = require '../../../server/users/user_handler' diff --git a/spec/server/functional/payment.spec.coffee b/spec/server/functional/payment.spec.coffee index 7952752dd..4e342de2f 100644 --- a/spec/server/functional/payment.spec.coffee +++ b/spec/server/functional/payment.spec.coffee @@ -6,7 +6,6 @@ nockUtils = require '../nock-utils' describe '/db/payment', -> - request = require 'request' paymentURL = getURL('/db/payment') checkChargesURL = getURL('/db/payment/check-stripe-charges') customPaymentURL = getURL('/db/payment/custom') diff --git a/spec/server/functional/user.spec.coffee b/spec/server/functional/user.spec.coffee index f00498111..95f7206af 100644 --- a/spec/server/functional/user.spec.coffee +++ b/spec/server/functional/user.spec.coffee @@ -1,5 +1,4 @@ require '../common' -request = require 'request' User = require '../../../server/users/User' urlUser = '/db/user' diff --git a/spec/server/unit/analytics.spec.coffee b/spec/server/unit/analytics.spec.coffee index c25cad7c4..bae58bfc6 100644 --- a/spec/server/unit/analytics.spec.coffee +++ b/spec/server/unit/analytics.spec.coffee @@ -1,7 +1,6 @@ GLOBAL._ = require 'lodash' require '../common' -request = require 'request' AnalyticsUsersActive = require '../../../server/analytics/AnalyticsUsersActive' LevelSession = require '../../../server/levels/sessions/LevelSession' User = require '../../../server/users/User'