Update request, make server tests work with it

This commit is contained in:
Scott Erickson 2016-03-03 16:06:49 -08:00
parent eeb6f8c5e9
commit e1e5b66d7f
10 changed files with 2 additions and 11 deletions

View file

@ -78,7 +78,7 @@
"passport": "0.1.x", "passport": "0.1.x",
"passport-local": "0.1.x", "passport-local": "0.1.x",
"redis": "", "redis": "",
"request": "2.12.x", "request": "^2.69.0",
"sendwithus": "2.1.x", "sendwithus": "2.1.x",
"stream-buffers": "0.2.x", "stream-buffers": "0.2.x",
"stripe": "~2.9.0", "stripe": "~2.9.0",

View file

@ -77,7 +77,6 @@ beforeEach(function(done) {
}, },
function(cb) { function(cb) {
// Initialize products // Initialize products
var request = require('request');
request.get(getURL('/db/products'), function(err, res, body) { request.get(getURL('/db/products'), function(err, res, body) {
expect(err).toBe(null); expect(err).toBe(null);
expect(res.statusCode).toBe(200); expect(res.statusCode).toBe(200);

View file

@ -70,7 +70,7 @@ GLOBAL.saveModels = (models, done) ->
GLOBAL.simplePermissions = [target: 'public', access: 'owner'] GLOBAL.simplePermissions = [target: 'public', access: 'owner']
GLOBAL.ObjectId = mongoose.Types.ObjectId GLOBAL.ObjectId = mongoose.Types.ObjectId
GLOBAL.request = require 'request' GLOBAL.request = require('request').defaults({jar: true})
Promise = require 'bluebird' Promise = require 'bluebird'
Promise.promisifyAll(request, {multiArgs: true}) 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. # Creates the user if it doesn't already exist.
return done(unittest.users[email]) if unittest.users[email] and not force return done(unittest.users[email]) if unittest.users[email] and not force
request = require 'request'
request.post getURL('/auth/logout'), -> request.post getURL('/auth/logout'), ->
request.get getURL('/auth/whoami'), -> request.get getURL('/auth/whoami'), ->
req = request.post(getURL('/db/user'), (err, response, body) -> req = request.post(getURL('/db/user'), (err, response, body) ->

View file

@ -1,5 +1,4 @@
require '../common' require '../common'
request = require 'request'
User = require '../../../server/users/User' User = require '../../../server/users/User'
urlLogin = getURL('/auth/login') urlLogin = getURL('/auth/login')

View file

@ -1,7 +1,6 @@
require '../common' require '../common'
describe '/db/<id>/version', -> describe '/db/<id>/version', ->
request = require 'request'
it 'clears the db first', (done) -> it 'clears the db first', (done) ->
clearModels [User, Article], (err) -> clearModels [User, Article], (err) ->
throw err if err throw err if err

View file

@ -1,4 +1,3 @@
request = require 'request'
require '../common' require '../common'
config = require '../../../server_config' config = require '../../../server_config'
nockUtils = require('../nock-utils') nockUtils = require('../nock-utils')

View file

@ -1,7 +1,6 @@
require '../common' require '../common'
describe '/db/patch', -> describe '/db/patch', ->
request = require 'request'
async = require 'async' async = require 'async'
UserHandler = require '../../../server/users/user_handler' UserHandler = require '../../../server/users/user_handler'

View file

@ -6,7 +6,6 @@ nockUtils = require '../nock-utils'
describe '/db/payment', -> describe '/db/payment', ->
request = require 'request'
paymentURL = getURL('/db/payment') paymentURL = getURL('/db/payment')
checkChargesURL = getURL('/db/payment/check-stripe-charges') checkChargesURL = getURL('/db/payment/check-stripe-charges')
customPaymentURL = getURL('/db/payment/custom') customPaymentURL = getURL('/db/payment/custom')

View file

@ -1,5 +1,4 @@
require '../common' require '../common'
request = require 'request'
User = require '../../../server/users/User' User = require '../../../server/users/User'
urlUser = '/db/user' urlUser = '/db/user'

View file

@ -1,7 +1,6 @@
GLOBAL._ = require 'lodash' GLOBAL._ = require 'lodash'
require '../common' require '../common'
request = require 'request'
AnalyticsUsersActive = require '../../../server/analytics/AnalyticsUsersActive' AnalyticsUsersActive = require '../../../server/analytics/AnalyticsUsersActive'
LevelSession = require '../../../server/levels/sessions/LevelSession' LevelSession = require '../../../server/levels/sessions/LevelSession'
User = require '../../../server/users/User' User = require '../../../server/users/User'