[CSTPER-144] Fixed issue with authorization request encountered while logging-in with external idp

This commit is contained in:
Giuseppe Digilio
2020-10-06 17:09:04 +02:00
parent ddb7d5181f
commit 73a9fe16c5
8 changed files with 195 additions and 36 deletions

View File

@@ -512,7 +512,7 @@ describe('authReducer', () => {
loading: false,
authMethods: []
};
const action = new RetrieveAuthMethodsAction(new AuthStatus());
const action = new RetrieveAuthMethodsAction(new AuthStatus(), true);
const newState = authReducer(initialState, action);
state = {
authenticated: false,
@@ -536,7 +536,7 @@ describe('authReducer', () => {
new AuthMethod(AuthMethodType.Password),
new AuthMethod(AuthMethodType.Shibboleth, 'location')
];
const action = new RetrieveAuthMethodsSuccessAction(authMethods);
const action = new RetrieveAuthMethodsSuccessAction(authMethods, false);
const newState = authReducer(initialState, action);
state = {
authenticated: false,
@@ -548,7 +548,31 @@ describe('authReducer', () => {
expect(newState).toEqual(state);
});
it('should properly set the state, in response to a RETRIEVE_AUTH_METHODS_ERROR action', () => {
it('should properly set the state, in response to a RETRIEVE_AUTH_METHODS_SUCCESS action with blocking as true', () => {
initialState = {
authenticated: false,
loaded: false,
blocking: true,
loading: true,
authMethods: []
};
const authMethods = [
new AuthMethod(AuthMethodType.Password),
new AuthMethod(AuthMethodType.Shibboleth, 'location')
];
const action = new RetrieveAuthMethodsSuccessAction(authMethods, true);
const newState = authReducer(initialState, action);
state = {
authenticated: false,
loaded: false,
blocking: true,
loading: false,
authMethods: authMethods
};
expect(newState).toEqual(state);
});
it('should properly set the state, in response to a RETRIEVE_AUTH_METHODS_ERROR action ', () => {
initialState = {
authenticated: false,
loaded: false,
@@ -557,7 +581,7 @@ describe('authReducer', () => {
authMethods: []
};
const action = new RetrieveAuthMethodsErrorAction();
const action = new RetrieveAuthMethodsErrorAction(false);
const newState = authReducer(initialState, action);
state = {
authenticated: false,
@@ -568,4 +592,25 @@ describe('authReducer', () => {
};
expect(newState).toEqual(state);
});
it('should properly set the state, in response to a RETRIEVE_AUTH_METHODS_ERROR action with blocking as true', () => {
initialState = {
authenticated: false,
loaded: false,
blocking: true,
loading: true,
authMethods: []
};
const action = new RetrieveAuthMethodsErrorAction(true);
const newState = authReducer(initialState, action);
state = {
authenticated: false,
loaded: false,
blocking: true,
loading: false,
authMethods: [new AuthMethod(AuthMethodType.Password)]
};
expect(newState).toEqual(state);
});
});