Merge pull request #2167 from overleaf/jel-saml-account-settings-layout
Account settings layout for institution SSO GitOrigin-RevId: d9c9e5eeb3b4a215456b0f5294139c1b8d4968c3
This commit is contained in:
committed by
sharelatex
parent
16ac5126cb
commit
039b5eaba0
@@ -0,0 +1,61 @@
|
||||
const sinon = require('sinon')
|
||||
const chai = require('chai')
|
||||
const { expect } = chai
|
||||
const SandboxedModule = require('sandboxed-module')
|
||||
const modulePath = '../../../../app/src/Features/User/SAMLIdentityManager.js'
|
||||
|
||||
describe('SAMLIdentityManager', function() {
|
||||
beforeEach(function() {
|
||||
this.Errors = {
|
||||
NotFoundError: sinon.stub(),
|
||||
SAMLIdentityExistsError: sinon.stub(),
|
||||
SAMLUserNotFoundError: sinon.stub()
|
||||
}
|
||||
this.user = {
|
||||
_id: 'user-id'
|
||||
}
|
||||
this.SAMLIdentityManager = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'../Errors/Errors': this.Errors,
|
||||
'../../models/User': {
|
||||
User: (this.User = {
|
||||
findOne: sinon.stub()
|
||||
})
|
||||
},
|
||||
'../User/UserGetter': (this.UserGetter = {
|
||||
getUser: sinon.stub(),
|
||||
promises: {
|
||||
getUser: sinon.stub().resolves()
|
||||
}
|
||||
}),
|
||||
'../User/UserUpdater': (this.UserUpdater = {
|
||||
addEmailAddress: sinon.stub()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
describe('getUser', function() {
|
||||
it('should throw an error if missing provider ID and/or external user ID', async function() {
|
||||
let error
|
||||
try {
|
||||
await this.SAMLIdentityManager.getUser(null, null)
|
||||
} catch (e) {
|
||||
error = e
|
||||
} finally {
|
||||
expect(error).to.exist
|
||||
}
|
||||
})
|
||||
})
|
||||
describe('linkAccounts', function() {
|
||||
it('should throw an error if missing data', async function() {
|
||||
let error
|
||||
try {
|
||||
await this.SAMLIdentityManager.linkAccounts(null, null, null, null)
|
||||
} catch (e) {
|
||||
error = e
|
||||
} finally {
|
||||
expect(error).to.exist
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user