remove getUserOrCreateHoldingAccount function

The function is deprecated
This commit is contained in:
Tim Alby 2018-05-23 12:08:56 +02:00
parent 09ddc75126
commit 5a590aa021
3 changed files with 0 additions and 30 deletions

View file

@ -1,19 +1,10 @@
User = require("../../models/User").User
UserLocator = require("./UserLocator")
logger = require("logger-sharelatex")
metrics = require('metrics-sharelatex')
module.exports = UserCreator =
getUserOrCreateHoldingAccount: (email, callback = (err, user)->)->
self = @
UserLocator.findByEmail email, (err, user)->
if user?
callback(err, user)
else
self.createNewUser email:email, holdingAccount:true, callback
createNewUser: (opts, callback)->
logger.log opts:opts, "creating new user"
user = new User()

View file

@ -24,9 +24,6 @@ describe "SubscriptionGroupHandler", ->
getSubscriptionByMemberIdAndId: sinon.stub()
getSubscription: sinon.stub()
@UserCreator =
getUserOrCreateHoldingAccount: sinon.stub().callsArgWith(1, null, @user)
@SubscriptionUpdater =
addUserToGroup: sinon.stub().callsArgWith(2)
removeUserFromGroup: sinon.stub().callsArgWith(2)

View file

@ -25,24 +25,6 @@ describe "UserCreator", ->
@email = "bob.oswald@gmail.com"
describe "getUserOrCreateHoldingAccount", ->
it "should immediately return the user if found", (done)->
@UserLocator.findByEmail.callsArgWith(1, null, @user)
@UserCreator.getUserOrCreateHoldingAccount @email, (err, returnedUser)=>
assert.deepEqual returnedUser, @user
done()
it "should create new holding account if the user is not found", (done)->
@UserLocator.findByEmail.callsArgWith(1)
@UserCreator.createNewUser = sinon.stub().callsArgWith(1, null, @user)
@UserCreator.getUserOrCreateHoldingAccount @email, (err, returnedUser)=>
@UserCreator.createNewUser.calledWith(email:@email, holdingAccount:true).should.equal true
assert.deepEqual returnedUser, @user
done()
describe "createNewUser", ->
it "should take the opts and put them in the model", (done)->