|
@@ -254,6 +254,8 @@ describe "AuthenticationController", ->
|
|
|
@cb = sinon.stub()
|
|
@cb = sinon.stub()
|
|
|
@LoginRateLimiter.processLoginRequest.callsArgWith(1, null, true)
|
|
@LoginRateLimiter.processLoginRequest.callsArgWith(1, null, true)
|
|
|
@AuthenticationManager.authenticate = sinon.stub().callsArgWith(2, null, @user)
|
|
@AuthenticationManager.authenticate = sinon.stub().callsArgWith(2, null, @user)
|
|
|
|
|
+ @req.sessionID = Math.random()
|
|
|
|
|
+ @AnalyticsManager.idendifyUser = sinon.stub()
|
|
|
@AuthenticationController.doPassportLogin(@req, @req.body.email, @req.body.password, @cb)
|
|
@AuthenticationController.doPassportLogin(@req, @req.body.email, @req.body.password, @cb)
|
|
|
|
|
|
|
|
it "should attempt to authorise the user", ->
|
|
it "should attempt to authorise the user", ->
|
|
@@ -261,6 +263,9 @@ describe "AuthenticationController", ->
|
|
|
.calledWith(email: @email.toLowerCase(), @password)
|
|
.calledWith(email: @email.toLowerCase(), @password)
|
|
|
.should.equal true
|
|
.should.equal true
|
|
|
|
|
|
|
|
|
|
+ it "should call idendifyUser", ->
|
|
|
|
|
+ @AnalyticsManager.idendifyUser.calledWith(@user._id, @req.sessionID).should.equal true
|
|
|
|
|
+
|
|
|
it "should setup the user data in the background", ->
|
|
it "should setup the user data in the background", ->
|
|
|
@UserHandler.setupLoginData.calledWith(@user).should.equal true
|
|
@UserHandler.setupLoginData.calledWith(@user).should.equal true
|
|
|
|
|
|