Move admin register to user activate module

Move admin register to user activate module

Co-authored-by: John Lees-Miller <jdleesmiller@gmail.com> & Davinder Singh
GitOrigin-RevId: 79428f2932783086435bdad9b1efb5300c467511
This commit is contained in:
Davinder Singh
2022-04-07 14:41:05 +01:00
committed by Copybot
parent bce02b25e4
commit b3d55fa65e
8 changed files with 77 additions and 70 deletions
@@ -43,7 +43,6 @@ describe('UserController', function () {
}
this.User = { findById: sinon.stub().callsArgWith(1, null, this.user) }
this.NewsLetterManager = { unsubscribe: sinon.stub().callsArgWith(1) }
this.UserRegistrationHandler = { registerNewUser: sinon.stub() }
this.AuthenticationController = {
establishUserSession: sinon.stub().callsArg(2),
}
@@ -104,7 +103,6 @@ describe('UserController', function () {
User: this.User,
},
'../Newsletter/NewsletterManager': this.NewsLetterManager,
'./UserRegistrationHandler': this.UserRegistrationHandler,
'../Authentication/AuthenticationController':
this.AuthenticationController,
'../Authentication/SessionManager': this.SessionManager,
@@ -558,32 +556,6 @@ describe('UserController', function () {
})
})
describe('register', function () {
beforeEach(function () {
this.UserRegistrationHandler.registerNewUserAndSendActivationEmail = sinon
.stub()
.callsArgWith(1, null, this.user, (this.url = 'mock/url'))
this.req.body.email = this.user.email = this.email = 'email@example.com'
this.UserController.register(this.req, this.res)
})
it('should register the user and send them an email', function () {
sinon.assert.calledWith(
this.UserRegistrationHandler.registerNewUserAndSendActivationEmail,
this.email
)
})
it('should return the user and activation url', function () {
this.res.json
.calledWith({
email: this.email,
setNewPasswordUrl: this.url,
})
.should.equal(true)
})
})
describe('clearSessions', function () {
describe('success', function () {
it('should call revokeAllUserSessions', function (done) {