Search in sources :

Example 1 with StateController

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

the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndUserAccountCreationFailedState.

@Test
public void shouldReturnErrorResponseWhenAskedAndUserAccountCreationFailedState() {
    UserAccountCreationFailedState state = UserAccountCreationFailedStateBuilder.aUserAccountCreationFailedState().build();
    StateController stateController = new UserAccountCreationFailedStateController(state, responseFromHubFactory);
    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) UserAccountCreationFailedState(uk.gov.ida.hub.policy.domain.state.UserAccountCreationFailedState) ResponseFromHub(uk.gov.ida.hub.policy.domain.ResponseFromHub) Test(org.junit.Test)

Example 2 with StateController

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

the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInTimeoutState.

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

Example 3 with StateController

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

the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInMatchingServiceRequestErrorState.

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

Example 4 with StateController

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

the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInIdpSelectedState.

@Test
public void shouldReturnErrorResponseWhenAskedAndInIdpSelectedState() {
    IdpSelectedState state = IdpSelectedStateBuilder.anIdpSelectedState().build();
    StateController stateController = new IdpSelectedStateController(state, hubEventLogger, stateTransitionAction, identityProvidersConfigProxy, 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 : IdpSelectedState(uk.gov.ida.hub.policy.domain.state.IdpSelectedState) StateController(uk.gov.ida.hub.policy.domain.StateController) ResponseFromHub(uk.gov.ida.hub.policy.domain.ResponseFromHub) Test(org.junit.Test)

Example 5 with StateController

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

the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInCycle3MatchRequestSentState.

@Test
public void shouldReturnErrorResponseWhenAskedAndInCycle3MatchRequestSentState() {
    Cycle3MatchRequestSentState state = Cycle3MatchRequestSentStateBuilder.aCycle3MatchRequestSentState().build();
    StateController stateController = new Cycle3MatchRequestSentStateController(state, hubEventLogger, stateTransitionAction, policyConfiguration, levelOfAssuranceValidator, responseFromHubFactory, transactionsConfigProxy, matchingServiceConfigProxy, assertionRestrictionFactory, attributeQueryService);
    when(sessionRepository.getStateController(sessionId, ErrorResponsePreparedState.class)).thenReturn(stateController);
    ResponseFromHub responseFromHub = authnRequestFromTransactionHandler.getErrorResponseFromHub(sessionId);
    assertThat(responseFromHub.getStatus()).isEqualTo(TransactionIdaStatus.NoAuthenticationContext);
}
Also used : Cycle3MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.Cycle3MatchRequestSentState) StateController(uk.gov.ida.hub.policy.domain.StateController) 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