Rename functions to make distinction between invited/token members

This commit is contained in:
Shane Kilkelly
2017-09-21 09:30:38 +01:00
parent 91ec0da239
commit ef7e1ceabf
6 changed files with 58 additions and 58 deletions
@@ -33,7 +33,7 @@ module.exports = CollaboratorsController =
getAllMembers: (req, res, next) -> getAllMembers: (req, res, next) ->
projectId = req.params.Project_id projectId = req.params.Project_id
logger.log {projectId}, "getting all active members for project" logger.log {projectId}, "getting all active members for project"
CollaboratorsHandler.getAllMembers projectId, (err, members) -> CollaboratorsHandler.getAllInvitedMembers projectId, (err, members) ->
if err? if err?
logger.err {projectId}, "error getting members for project" logger.err {projectId}, "error getting members for project"
return next(err) return next(err)
@@ -99,11 +99,11 @@ module.exports = CollaboratorsHandler =
return callback(error) if error? return callback(error) if error?
return callback null, count - 1 # Don't count project owner return callback null, count - 1 # Don't count project owner
isUserMemberOfProject: (user_id, project_id, callback = (error, isMember, privilegeLevel) ->) -> isUserInvitedMemberOfProject: (user_id, project_id, callback = (error, isMember, privilegeLevel) ->) ->
CollaboratorsHandler.getMemberIdsWithPrivilegeLevels project_id, (error, members = []) -> CollaboratorsHandler.getMemberIdsWithPrivilegeLevels project_id, (error, members = []) ->
return callback(error) if error? return callback(error) if error?
for member in members for member in members
if member.id.toString() == user_id.toString() if member.id.toString() == user_id.toString() and member.source == Sources.INVITE
return callback null, true, member.privilegeLevel return callback null, true, member.privilegeLevel
return callback null, false, null return callback null, false, null
@@ -186,9 +186,9 @@ module.exports = CollaboratorsHandler =
logger.error {err: error, project_id, user_id}, "error flushing to TPDS after adding collaborator" logger.error {err: error, project_id, user_id}, "error flushing to TPDS after adding collaborator"
callback() callback()
getAllMembers: (projectId, callback=(err, members)->) -> getAllInvitedMembers: (projectId, callback=(err, members)->) ->
logger.log {projectId}, "fetching all members" logger.log {projectId}, "fetching all members"
CollaboratorsHandler.getMembersWithPrivilegeLevels projectId, (error, rawMembers) -> CollaboratorsHandler.getInvitedMembersWithPrivilegeLevels projectId, (error, rawMembers) ->
if error? if error?
logger.err {projectId, error}, "error getting members for project" logger.err {projectId, error}, "error getting members for project"
return callback(error) return callback(error)
@@ -114,7 +114,7 @@ module.exports = CollaboratorsInviteController =
res.render "project/invite/not-valid", {title: "Invalid Invite"} res.render "project/invite/not-valid", {title: "Invalid Invite"}
# check if the user is already a member of the project # check if the user is already a member of the project
currentUser = AuthenticationController.getSessionUser(req) currentUser = AuthenticationController.getSessionUser(req)
CollaboratorsHandler.isUserMemberOfProject currentUser._id, projectId, (err, isMember, _privilegeLevel) -> CollaboratorsHandler.isUserInvitedMemberOfProject currentUser._id, projectId, (err, isMember, _privilegeLevel) ->
if err? if err?
logger.err {err, projectId}, "error checking if user is member of project" logger.err {err, projectId}, "error checking if user is member of project"
return next(err) return next(err)
@@ -82,7 +82,7 @@ describe "CollaboratorsController", ->
@res.json = sinon.stub() @res.json = sinon.stub()
@next = sinon.stub() @next = sinon.stub()
@members = [{a: 1}] @members = [{a: 1}]
@CollaboratorsHandler.getAllMembers = sinon.stub().callsArgWith(1, null, @members) @CollaboratorsHandler.getAllInvitedMembers = sinon.stub().callsArgWith(1, null, @members)
@CollaboratorsController.getAllMembers(@req, @res, @next) @CollaboratorsController.getAllMembers(@req, @res, @next)
it 'should not produce an error', -> it 'should not produce an error', ->
@@ -93,13 +93,13 @@ describe "CollaboratorsController", ->
@res.json.calledWith({members: @members}).should.equal true @res.json.calledWith({members: @members}).should.equal true
it 'should call CollaboratorsHandler.getAllMembers', -> it 'should call CollaboratorsHandler.getAllMembers', ->
@CollaboratorsHandler.getAllMembers.callCount.should.equal 1 @CollaboratorsHandler.getAllInvitedMembers.callCount.should.equal 1
describe 'when CollaboratorsHandler.getAllMembers produces an error', -> describe 'when CollaboratorsHandler.getAllInvitedMembers produces an error', ->
beforeEach -> beforeEach ->
@res.json = sinon.stub() @res.json = sinon.stub()
@next = sinon.stub() @next = sinon.stub()
@CollaboratorsHandler.getAllMembers = sinon.stub().callsArgWith(1, new Error('woops')) @CollaboratorsHandler.getAllInvitedMembers = sinon.stub().callsArgWith(1, new Error('woops'))
@CollaboratorsController.getAllMembers(@req, @res, @next) @CollaboratorsController.getAllMembers(@req, @res, @next)
it 'should produce an error', -> it 'should produce an error', ->
@@ -157,17 +157,17 @@ describe "CollaboratorsHandler", ->
expect(level).to.equal false expect(level).to.equal false
done() done()
describe "isUserMemberOfProject", -> describe "isUserInvitedMemberOfProject", ->
beforeEach -> beforeEach ->
@CollaboratorHandler.getMemberIdsWithPrivilegeLevels = sinon.stub() @CollaboratorHandler.getMemberIdsWithPrivilegeLevels = sinon.stub()
describe "when user is a member of the project", -> describe "when user is a member of the project", ->
beforeEach -> beforeEach ->
@CollaboratorHandler.getMemberIdsWithPrivilegeLevels.withArgs(@project_id).yields(null, [ @CollaboratorHandler.getMemberIdsWithPrivilegeLevels.withArgs(@project_id).yields(null, [
{ id: "not-the-user", privilegeLevel: "readOnly" } { id: "not-the-user", privilegeLevel: "readOnly", source: 'invite' }
{ id: @user_id, privilegeLevel: "readAndWrite" } { id: @user_id, privilegeLevel: "readAndWrite", source: 'invite' }
]) ])
@CollaboratorHandler.isUserMemberOfProject @user_id, @project_id, @callback @CollaboratorHandler.isUserInvitedMemberOfProject @user_id, @project_id, @callback
it "should return true and the privilegeLevel", -> it "should return true and the privilegeLevel", ->
@callback @callback
@@ -179,7 +179,7 @@ describe "CollaboratorsHandler", ->
@CollaboratorHandler.getMemberIdsWithPrivilegeLevels.withArgs(@project_id).yields(null, [ @CollaboratorHandler.getMemberIdsWithPrivilegeLevels.withArgs(@project_id).yields(null, [
{ id: "not-the-user", privilegeLevel: "readOnly" } { id: "not-the-user", privilegeLevel: "readOnly" }
]) ])
@CollaboratorHandler.isUserMemberOfProject @user_id, @project_id, @callback @CollaboratorHandler.isUserInvitedMemberOfProject @user_id, @project_id, @callback
it "should return false", -> it "should return false", ->
@callback @callback
@@ -314,7 +314,7 @@ describe "CollaboratorsHandler", ->
.calledWith(project_id, @user_id) .calledWith(project_id, @user_id)
.should.equal true .should.equal true
describe 'getAllMembers', -> describe 'getAllInvitedMembers', ->
beforeEach -> beforeEach ->
@owning_user = {_id: 'owner-id', email: 'owner@example.com', features: {a: 1}} @owning_user = {_id: 'owner-id', email: 'owner@example.com', features: {a: 1}}
@@ -323,14 +323,14 @@ describe "CollaboratorsHandler", ->
{user: @owning_user, privilegeLevel: "owner"}, {user: @owning_user, privilegeLevel: "owner"},
{user: @readwrite_user, privilegeLevel: "readAndWrite"} {user: @readwrite_user, privilegeLevel: "readAndWrite"}
] ]
@CollaboratorHandler.getMembersWithPrivilegeLevels = sinon.stub().callsArgWith(1, null, @members) @CollaboratorHandler.getInvitedMembersWithPrivilegeLevels = sinon.stub().callsArgWith(1, null, @members)
@ProjectEditorHandler.buildOwnerAndMembersViews = sinon.stub().returns(@views = { @ProjectEditorHandler.buildOwnerAndMembersViews = sinon.stub().returns(@views = {
owner: @owning_user, owner: @owning_user,
ownerFeatures: @owning_user.features, ownerFeatures: @owning_user.features,
members: [ {_id: @readwrite_user._id, email: @readwrite_user.email} ] members: [ {_id: @readwrite_user._id, email: @readwrite_user.email} ]
}) })
@callback = sinon.stub() @callback = sinon.stub()
@CollaboratorHandler.getAllMembers @project_id, @callback @CollaboratorHandler.getAllInvitedMembers @project_id, @callback
it 'should not produce an error', -> it 'should not produce an error', ->
@callback.callCount.should.equal 1 @callback.callCount.should.equal 1
@@ -341,8 +341,8 @@ describe "CollaboratorsHandler", ->
expect(@callback.firstCall.args[1]).to.deep.equal @views.members expect(@callback.firstCall.args[1]).to.deep.equal @views.members
it 'should call getMembersWithPrivileges', -> it 'should call getMembersWithPrivileges', ->
@CollaboratorHandler.getMembersWithPrivilegeLevels.callCount.should.equal 1 @CollaboratorHandler.getInvitedMembersWithPrivilegeLevels.callCount.should.equal 1
@CollaboratorHandler.getMembersWithPrivilegeLevels.firstCall.args[0].should.equal @project_id @CollaboratorHandler.getInvitedMembersWithPrivilegeLevels.firstCall.args[0].should.equal @project_id
it 'should call ProjectEditorHandler.buildOwnerAndMembersViews', -> it 'should call ProjectEditorHandler.buildOwnerAndMembersViews', ->
@ProjectEditorHandler.buildOwnerAndMembersViews.callCount.should.equal 1 @ProjectEditorHandler.buildOwnerAndMembersViews.callCount.should.equal 1
@@ -351,14 +351,14 @@ describe "CollaboratorsHandler", ->
describe 'when getMembersWithPrivileges produces an error', -> describe 'when getMembersWithPrivileges produces an error', ->
beforeEach -> beforeEach ->
@CollaboratorHandler.getMembersWithPrivilegeLevels = sinon.stub().callsArgWith(1, new Error('woops')) @CollaboratorHandler.getInvitedMembersWithPrivilegeLevels = sinon.stub().callsArgWith(1, new Error('woops'))
@ProjectEditorHandler.buildOwnerAndMembersViews = sinon.stub().returns(@views = { @ProjectEditorHandler.buildOwnerAndMembersViews = sinon.stub().returns(@views = {
owner: @owning_user, owner: @owning_user,
ownerFeatures: @owning_user.features, ownerFeatures: @owning_user.features,
members: [ {_id: @readwrite_user._id, email: @readwrite_user.email} ] members: [ {_id: @readwrite_user._id, email: @readwrite_user.email} ]
}) })
@callback = sinon.stub() @callback = sinon.stub()
@CollaboratorHandler.getAllMembers @project_id, @callback @CollaboratorHandler.getAllInvitedMembers @project_id, @callback
it 'should produce an error', -> it 'should produce an error', ->
@callback.callCount.should.equal 1 @callback.callCount.should.equal 1
@@ -366,8 +366,8 @@ describe "CollaboratorsHandler", ->
expect(@callback.firstCall.args[0]).to.be.instanceof Error expect(@callback.firstCall.args[0]).to.be.instanceof Error
it 'should call getMembersWithPrivileges', -> it 'should call getMembersWithPrivileges', ->
@CollaboratorHandler.getMembersWithPrivilegeLevels.callCount.should.equal 1 @CollaboratorHandler.getInvitedMembersWithPrivilegeLevels.callCount.should.equal 1
@CollaboratorHandler.getMembersWithPrivilegeLevels.firstCall.args[0].should.equal @project_id @CollaboratorHandler.getInvitedMembersWithPrivilegeLevels.firstCall.args[0].should.equal @project_id
it 'should not call ProjectEditorHandler.buildOwnerAndMembersViews', -> it 'should not call ProjectEditorHandler.buildOwnerAndMembersViews', ->
@ProjectEditorHandler.buildOwnerAndMembersViews.callCount.should.equal 0 @ProjectEditorHandler.buildOwnerAndMembersViews.callCount.should.equal 0
@@ -317,7 +317,7 @@ describe "CollaboratorsInviteController", ->
last_name: "Doe" last_name: "Doe"
email: "john@example.com" email: "john@example.com"
@CollaboratorsHandler.isUserMemberOfProject = sinon.stub().callsArgWith(2, null, false, null) @CollaboratorsHandler.isUserInvitedMemberOfProject = sinon.stub().callsArgWith(2, null, false, null)
@CollaboratorsInviteHandler.getInviteByToken = sinon.stub().callsArgWith(2, null, @invite) @CollaboratorsInviteHandler.getInviteByToken = sinon.stub().callsArgWith(2, null, @invite)
@ProjectGetter.getProject = sinon.stub().callsArgWith(2, null, @fakeProject) @ProjectGetter.getProject = sinon.stub().callsArgWith(2, null, @fakeProject)
@UserGetter.getUser.callsArgWith(2, null, @owner) @UserGetter.getUser.callsArgWith(2, null, @owner)
@@ -337,9 +337,9 @@ describe "CollaboratorsInviteController", ->
it 'should not call next', -> it 'should not call next', ->
@next.callCount.should.equal 0 @next.callCount.should.equal 0
it 'should call CollaboratorsHandler.isUserMemberOfProject', -> it 'should call CollaboratorsHandler.isUserInvitedMemberOfProject', ->
@CollaboratorsHandler.isUserMemberOfProject.callCount.should.equal 1 @CollaboratorsHandler.isUserInvitedMemberOfProject.callCount.should.equal 1
@CollaboratorsHandler.isUserMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true @CollaboratorsHandler.isUserInvitedMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true
it 'should call getInviteByToken', -> it 'should call getInviteByToken', ->
@CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 1 @CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 1
@@ -356,7 +356,7 @@ describe "CollaboratorsInviteController", ->
describe 'when user is already a member of the project', -> describe 'when user is already a member of the project', ->
beforeEach -> beforeEach ->
@CollaboratorsHandler.isUserMemberOfProject = sinon.stub().callsArgWith(2, null, true, null) @CollaboratorsHandler.isUserInvitedMemberOfProject = sinon.stub().callsArgWith(2, null, true, null)
@CollaboratorsInviteController.viewInvite @req, @res, @next @CollaboratorsInviteController.viewInvite @req, @res, @next
it 'should redirect to the project page', -> it 'should redirect to the project page', ->
@@ -366,9 +366,9 @@ describe "CollaboratorsInviteController", ->
it 'should not call next with an error', -> it 'should not call next with an error', ->
@next.callCount.should.equal 0 @next.callCount.should.equal 0
it 'should call CollaboratorsHandler.isUserMemberOfProject', -> it 'should call CollaboratorsHandler.isUserInvitedMemberOfProject', ->
@CollaboratorsHandler.isUserMemberOfProject.callCount.should.equal 1 @CollaboratorsHandler.isUserInvitedMemberOfProject.callCount.should.equal 1
@CollaboratorsHandler.isUserMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true @CollaboratorsHandler.isUserInvitedMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true
it 'should not call getInviteByToken', -> it 'should not call getInviteByToken', ->
@CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 0 @CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 0
@@ -379,19 +379,19 @@ describe "CollaboratorsInviteController", ->
it 'should not call ProjectGetter.getProject', -> it 'should not call ProjectGetter.getProject', ->
@ProjectGetter.getProject.callCount.should.equal 0 @ProjectGetter.getProject.callCount.should.equal 0
describe 'when isUserMemberOfProject produces an error', -> describe 'when isUserInvitedMemberOfProject produces an error', ->
beforeEach -> beforeEach ->
@CollaboratorsHandler.isUserMemberOfProject = sinon.stub().callsArgWith(2, new Error('woops')) @CollaboratorsHandler.isUserInvitedMemberOfProject = sinon.stub().callsArgWith(2, new Error('woops'))
@CollaboratorsInviteController.viewInvite @req, @res, @next @CollaboratorsInviteController.viewInvite @req, @res, @next
it 'should call next with an error', -> it 'should call next with an error', ->
@next.callCount.should.equal 1 @next.callCount.should.equal 1
expect(@next.firstCall.args[0]).to.be.instanceof Error expect(@next.firstCall.args[0]).to.be.instanceof Error
it 'should call CollaboratorsHandler.isUserMemberOfProject', -> it 'should call CollaboratorsHandler.isUserInvitedMemberOfProject', ->
@CollaboratorsHandler.isUserMemberOfProject.callCount.should.equal 1 @CollaboratorsHandler.isUserInvitedMemberOfProject.callCount.should.equal 1
@CollaboratorsHandler.isUserMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true @CollaboratorsHandler.isUserInvitedMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true
it 'should not call getInviteByToken', -> it 'should not call getInviteByToken', ->
@CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 0 @CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 0
@@ -413,13 +413,13 @@ describe "CollaboratorsInviteController", ->
@next.callCount.should.equal 1 @next.callCount.should.equal 1
@next.calledWith(@err).should.equal true @next.calledWith(@err).should.equal true
it 'should call CollaboratorsHandler.isUserMemberOfProject', -> it 'should call CollaboratorsHandler.isUserInvitedMemberOfProject', ->
@CollaboratorsHandler.isUserMemberOfProject.callCount.should.equal 1 @CollaboratorsHandler.isUserInvitedMemberOfProject.callCount.should.equal 1
@CollaboratorsHandler.isUserMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true @CollaboratorsHandler.isUserInvitedMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true
it 'should call getInviteByToken', -> it 'should call getInviteByToken', ->
@CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 1 @CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 1
@CollaboratorsHandler.isUserMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true @CollaboratorsHandler.isUserInvitedMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true
it 'should not call User.getUser', -> it 'should not call User.getUser', ->
@UserGetter.getUser.callCount.should.equal 0 @UserGetter.getUser.callCount.should.equal 0
@@ -440,13 +440,13 @@ describe "CollaboratorsInviteController", ->
it 'should not call next', -> it 'should not call next', ->
@next.callCount.should.equal 0 @next.callCount.should.equal 0
it 'should call CollaboratorsHandler.isUserMemberOfProject', -> it 'should call CollaboratorsHandler.isUserInvitedMemberOfProject', ->
@CollaboratorsHandler.isUserMemberOfProject.callCount.should.equal 1 @CollaboratorsHandler.isUserInvitedMemberOfProject.callCount.should.equal 1
@CollaboratorsHandler.isUserMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true @CollaboratorsHandler.isUserInvitedMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true
it 'should call getInviteByToken', -> it 'should call getInviteByToken', ->
@CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 1 @CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 1
@CollaboratorsHandler.isUserMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true @CollaboratorsHandler.isUserInvitedMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true
it 'should not call User.getUser', -> it 'should not call User.getUser', ->
@UserGetter.getUser.callCount.should.equal 0 @UserGetter.getUser.callCount.should.equal 0
@@ -464,9 +464,9 @@ describe "CollaboratorsInviteController", ->
@next.callCount.should.equal 1 @next.callCount.should.equal 1
expect(@next.firstCall.args[0]).to.be.instanceof Error expect(@next.firstCall.args[0]).to.be.instanceof Error
it 'should call CollaboratorsHandler.isUserMemberOfProject', -> it 'should call CollaboratorsHandler.isUserInvitedMemberOfProject', ->
@CollaboratorsHandler.isUserMemberOfProject.callCount.should.equal 1 @CollaboratorsHandler.isUserInvitedMemberOfProject.callCount.should.equal 1
@CollaboratorsHandler.isUserMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true @CollaboratorsHandler.isUserInvitedMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true
it 'should call getInviteByToken', -> it 'should call getInviteByToken', ->
@CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 1 @CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 1
@@ -491,9 +491,9 @@ describe "CollaboratorsInviteController", ->
it 'should not call next', -> it 'should not call next', ->
@next.callCount.should.equal 0 @next.callCount.should.equal 0
it 'should call CollaboratorsHandler.isUserMemberOfProject', -> it 'should call CollaboratorsHandler.isUserInvitedMemberOfProject', ->
@CollaboratorsHandler.isUserMemberOfProject.callCount.should.equal 1 @CollaboratorsHandler.isUserInvitedMemberOfProject.callCount.should.equal 1
@CollaboratorsHandler.isUserMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true @CollaboratorsHandler.isUserInvitedMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true
it 'should call getInviteByToken', -> it 'should call getInviteByToken', ->
@CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 1 @CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 1
@@ -515,9 +515,9 @@ describe "CollaboratorsInviteController", ->
@next.callCount.should.equal 1 @next.callCount.should.equal 1
expect(@next.firstCall.args[0]).to.be.instanceof Error expect(@next.firstCall.args[0]).to.be.instanceof Error
it 'should call CollaboratorsHandler.isUserMemberOfProject', -> it 'should call CollaboratorsHandler.isUserInvitedMemberOfProject', ->
@CollaboratorsHandler.isUserMemberOfProject.callCount.should.equal 1 @CollaboratorsHandler.isUserInvitedMemberOfProject.callCount.should.equal 1
@CollaboratorsHandler.isUserMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true @CollaboratorsHandler.isUserInvitedMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true
it 'should call getInviteByToken', -> it 'should call getInviteByToken', ->
@CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 1 @CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 1
@@ -542,9 +542,9 @@ describe "CollaboratorsInviteController", ->
it 'should not call next', -> it 'should not call next', ->
@next.callCount.should.equal 0 @next.callCount.should.equal 0
it 'should call CollaboratorsHandler.isUserMemberOfProject', -> it 'should call CollaboratorsHandler.isUserInvitedMemberOfProject', ->
@CollaboratorsHandler.isUserMemberOfProject.callCount.should.equal 1 @CollaboratorsHandler.isUserInvitedMemberOfProject.callCount.should.equal 1
@CollaboratorsHandler.isUserMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true @CollaboratorsHandler.isUserInvitedMemberOfProject.calledWith(@current_user_id, @project_id).should.equal true
it 'should call getInviteByToken', -> it 'should call getInviteByToken', ->
@CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 1 @CollaboratorsInviteHandler.getInviteByToken.callCount.should.equal 1
@@ -791,4 +791,4 @@ describe "CollaboratorsInviteController", ->
@RateLimiter.addCount = sinon.stub().callsArgWith(1, null, true) @RateLimiter.addCount = sinon.stub().callsArgWith(1, null, true)
@CollaboratorsInviteController._checkRateLimit @sendingUserId, (err, result)=> @CollaboratorsInviteController._checkRateLimit @sendingUserId, (err, result)=>
@RateLimiter.addCount.args[0][0].throttle.should.equal(10) @RateLimiter.addCount.args[0][0].throttle.should.equal(10)
done() done()