mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-11 23:20:47 +02:00
Merge pull request #3173 from overleaf/jel-institution-sso-audit-log
Update audit log when institution SSO is linked/unlinked GitOrigin-RevId: 264ffbed025dccb4dd202f86afe545c3bf0c1f76
This commit is contained in:
@@ -66,11 +66,6 @@ describe('UserEmailsController', function() {
|
||||
}
|
||||
}),
|
||||
'../Helpers/EmailHelper': this.EmailHelper,
|
||||
'./UserAuditLogHandler': (this.UserAuditLogHandler = {
|
||||
promises: {
|
||||
addEntry: sinon.stub().resolves()
|
||||
}
|
||||
}),
|
||||
'./UserEmailsConfirmationHandler': (this.UserEmailsConfirmationHandler = {
|
||||
promises: {
|
||||
sendConfirmationEmail: sinon.stub().resolves()
|
||||
@@ -121,16 +116,14 @@ describe('UserEmailsController', function() {
|
||||
.yields()
|
||||
})
|
||||
|
||||
it('adds an entry to user audit log', function(done) {
|
||||
it('passed audit log to addEmailAddress', function(done) {
|
||||
this.res.sendStatus = sinon.stub()
|
||||
this.res.sendStatus.callsFake(() => {
|
||||
this.UserAuditLogHandler.promises.addEntry.should.have.been.calledWith(
|
||||
this.user._id,
|
||||
'add-email',
|
||||
this.user._id,
|
||||
this.req.ip,
|
||||
{ newSecondaryEmail: this.newEmail }
|
||||
)
|
||||
const addCall = this.UserUpdater.promises.addEmailAddress.lastCall
|
||||
expect(addCall.args[3]).to.deep.equal({
|
||||
initiatorId: this.user._id,
|
||||
ipAddress: this.req.ip
|
||||
})
|
||||
done()
|
||||
})
|
||||
this.UserEmailsController.add(this.req, this.res)
|
||||
@@ -246,22 +239,6 @@ describe('UserEmailsController', function() {
|
||||
})
|
||||
this.UserEmailsController.add(this.req, this.res, this.next)
|
||||
})
|
||||
|
||||
describe('errors', function() {
|
||||
describe('via UserAuditLogHandler', function() {
|
||||
beforeEach(function() {
|
||||
this.UserAuditLogHandler.promises.addEntry.throws('oops')
|
||||
})
|
||||
it('should not add email and should return error', function(done) {
|
||||
this.UserEmailsController.add(this.req, this.res, error => {
|
||||
expect(error).to.exist
|
||||
this.UserUpdater.promises.addEmailAddress.should.not.have.been
|
||||
.called
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('remove', function() {
|
||||
|
||||
Reference in New Issue
Block a user