mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #584 from sharelatex/ta-remove-deprecated-method
Remove getUserOrCreateHoldingAccount Function
This commit is contained in:
commit
eeff32bf4f
3 changed files with 0 additions and 30 deletions
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)->
|
||||
|
|
Loading…
Reference in a new issue