Search in sources :

Example 51 with StateController

use of uk.gov.ida.hub.policy.domain.StateController in project verify-hub by alphagov.

the class StateControllerFactoryTest method build_shouldCreateASuccessfulMatchController.

@Test
public void build_shouldCreateASuccessfulMatchController() {
    StateController controller = factory.build(aSuccessfulMatchState().build(), stateTransitionAction);
    assertThat(controller).isInstanceOf(SuccessfulMatchStateController.class);
}
Also used : StateController(uk.gov.ida.hub.policy.domain.StateController) Test(org.junit.Test)

Example 52 with StateController

use of uk.gov.ida.hub.policy.domain.StateController in project verify-hub by alphagov.

the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInSessionStartedState.

@Test
public void shouldReturnErrorResponseWhenAskedAndInSessionStartedState() {
    SessionStartedState state = SessionStartedStateBuilder.aSessionStartedState().build();
    StateController stateController = new SessionStartedStateController(state, hubEventLogger, stateTransitionAction, transactionsConfigProxy, responseFromHubFactory, identityProvidersConfigProxy);
    when(sessionRepository.getStateController(sessionId, ErrorResponsePreparedState.class)).thenReturn(stateController);
    ResponseFromHub responseFromHub = authnRequestFromTransactionHandler.getErrorResponseFromHub(sessionId);
    assertThat(responseFromHub.getStatus()).isEqualTo(TransactionIdaStatus.NoAuthenticationContext);
}
Also used : StateController(uk.gov.ida.hub.policy.domain.StateController) SessionStartedState(uk.gov.ida.hub.policy.domain.state.SessionStartedState) ResponseFromHub(uk.gov.ida.hub.policy.domain.ResponseFromHub) Test(org.junit.Test)

Example 53 with StateController

use of uk.gov.ida.hub.policy.domain.StateController in project verify-hub by alphagov.

the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInAwaitingCycle3DataState.

@Test
public void shouldReturnErrorResponseWhenAskedAndInAwaitingCycle3DataState() {
    AwaitingCycle3DataState state = AwaitingCycle3DataStateBuilder.anAwaitingCycle3DataState().build();
    StateController stateController = new AwaitingCycle3DataStateController(state, hubEventLogger, stateTransitionAction, transactionsConfigProxy, responseFromHubFactory, policyConfiguration, assertionRestrictionFactory, matchingServiceConfigProxy);
    when(sessionRepository.getStateController(sessionId, ErrorResponsePreparedState.class)).thenReturn(stateController);
    ResponseFromHub responseFromHub = authnRequestFromTransactionHandler.getErrorResponseFromHub(sessionId);
    assertThat(responseFromHub.getStatus()).isEqualTo(TransactionIdaStatus.NoAuthenticationContext);
}
Also used : AwaitingCycle3DataState(uk.gov.ida.hub.policy.domain.state.AwaitingCycle3DataState) StateController(uk.gov.ida.hub.policy.domain.StateController) ResponseFromHub(uk.gov.ida.hub.policy.domain.ResponseFromHub) Test(org.junit.Test)

Example 54 with StateController

use of uk.gov.ida.hub.policy.domain.StateController in project verify-hub by alphagov.

the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInSuccessfulMatchState.

@Test
public void shouldReturnErrorResponseWhenAskedAndInSuccessfulMatchState() {
    SuccessfulMatchState state = SuccessfulMatchStateBuilder.aSuccessfulMatchState().build();
    StateController stateController = new SuccessfulMatchStateController(state, responseFromHubFactory, identityProvidersConfigProxy);
    when(sessionRepository.getStateController(sessionId, ErrorResponsePreparedState.class)).thenReturn(stateController);
    ResponseFromHub responseFromHub = authnRequestFromTransactionHandler.getErrorResponseFromHub(sessionId);
    assertThat(responseFromHub.getStatus()).isEqualTo(TransactionIdaStatus.NoAuthenticationContext);
}
Also used : StateController(uk.gov.ida.hub.policy.domain.StateController) SuccessfulMatchState(uk.gov.ida.hub.policy.domain.state.SuccessfulMatchState) ResponseFromHub(uk.gov.ida.hub.policy.domain.ResponseFromHub) Test(org.junit.Test)

Example 55 with StateController

use of uk.gov.ida.hub.policy.domain.StateController in project verify-hub by alphagov.

the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInAuthnFailedErrorState.

@Test
public void shouldReturnErrorResponseWhenAskedAndInAuthnFailedErrorState() {
    AuthnFailedErrorState state = AuthnFailedErrorStateBuilder.anAuthnFailedErrorState().build();
    StateController stateController = new AuthnFailedErrorStateController(state, responseFromHubFactory, stateTransitionAction, transactionsConfigProxy, identityProvidersConfigProxy, hubEventLogger);
    when(sessionRepository.getStateController(sessionId, ErrorResponsePreparedState.class)).thenReturn(stateController);
    ResponseFromHub responseFromHub = authnRequestFromTransactionHandler.getErrorResponseFromHub(sessionId);
    assertThat(responseFromHub.getStatus()).isEqualTo(TransactionIdaStatus.NoAuthenticationContext);
}
Also used : StateController(uk.gov.ida.hub.policy.domain.StateController) AuthnFailedErrorState(uk.gov.ida.hub.policy.domain.state.AuthnFailedErrorState) ResponseFromHub(uk.gov.ida.hub.policy.domain.ResponseFromHub) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)59 StateController (uk.gov.ida.hub.policy.domain.StateController)59 ResponseFromHub (uk.gov.ida.hub.policy.domain.ResponseFromHub)16 AuthnFailedErrorState (uk.gov.ida.hub.policy.domain.state.AuthnFailedErrorState)1 AwaitingCycle3DataState (uk.gov.ida.hub.policy.domain.state.AwaitingCycle3DataState)1 Cycle0And1MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.Cycle0And1MatchRequestSentState)1 Cycle3DataInputCancelledState (uk.gov.ida.hub.policy.domain.state.Cycle3DataInputCancelledState)1 Cycle3MatchRequestSentState (uk.gov.ida.hub.policy.domain.state.Cycle3MatchRequestSentState)1 FraudEventDetectedState (uk.gov.ida.hub.policy.domain.state.FraudEventDetectedState)1 IdpSelectedState (uk.gov.ida.hub.policy.domain.state.IdpSelectedState)1 MatchingServiceRequestErrorState (uk.gov.ida.hub.policy.domain.state.MatchingServiceRequestErrorState)1 NoMatchState (uk.gov.ida.hub.policy.domain.state.NoMatchState)1 RequesterErrorState (uk.gov.ida.hub.policy.domain.state.RequesterErrorState)1 SessionStartedState (uk.gov.ida.hub.policy.domain.state.SessionStartedState)1 SuccessfulMatchState (uk.gov.ida.hub.policy.domain.state.SuccessfulMatchState)1 TimeoutState (uk.gov.ida.hub.policy.domain.state.TimeoutState)1 UserAccountCreatedState (uk.gov.ida.hub.policy.domain.state.UserAccountCreatedState)1 UserAccountCreationFailedState (uk.gov.ida.hub.policy.domain.state.UserAccountCreationFailedState)1 UserAccountCreationRequestSentState (uk.gov.ida.hub.policy.domain.state.UserAccountCreationRequestSentState)1