use of uk.gov.ida.hub.policy.domain.state.UserAccountCreatedState in project verify-hub by alphagov.
the class ErrorStateControllerTests method shouldReturnErrorResponseWhenAskedAndInUserAccountCreatedState.
@Test
public void shouldReturnErrorResponseWhenAskedAndInUserAccountCreatedState() {
UserAccountCreatedState state = UserAccountCreatedStateBuilder.aUserAccountCreatedState().build();
StateController stateController = new UserAccountCreatedStateController(state, identityProvidersConfigProxy, responseFromHubFactory);
when(sessionRepository.getStateController(sessionId, ErrorResponsePreparedState.class)).thenReturn(stateController);
ResponseFromHub responseFromHub = authnRequestFromTransactionHandler.getErrorResponseFromHub(sessionId);
assertThat(responseFromHub.getStatus()).isEqualTo(TransactionIdaStatus.NoAuthenticationContext);
}
use of uk.gov.ida.hub.policy.domain.state.UserAccountCreatedState in project verify-hub by alphagov.
the class UserAccountCreatedStateControllerTest method getPreparedResponse_shouldThrowWhenIdpIsDisabled.
@Test(expected = IdpDisabledException.class)
public void getPreparedResponse_shouldThrowWhenIdpIsDisabled() {
UserAccountCreatedState state = aUserAccountCreatedState().withIdentityProviderEntityId("disabled-entity-id").build();
UserAccountCreatedStateController controller = new UserAccountCreatedStateController(state, identityProvidersConfigProxy, null);
when(identityProvidersConfigProxy.getEnabledIdentityProviders(Matchers.any(String.class), Matchers.anyBoolean(), Matchers.any(LevelOfAssurance.class))).thenReturn(emptyList());
controller.getPreparedResponse();
}
use of uk.gov.ida.hub.policy.domain.state.UserAccountCreatedState in project verify-hub by alphagov.
the class UserAccountCreationRequestSentStateControllerTest method getNextState_shouldMaintainRelayState.
@Test
public void getNextState_shouldMaintainRelayState() {
final String relayState = "4x100m";
UserAccountCreationRequestSentState state = aUserAccountCreationRequestSentState().withRelayState(relayState).build();
UserAccountCreationRequestSentStateController controller = new UserAccountCreationRequestSentStateController(state, null, hubEventLogger, null, levelOfAssuranceValidator, null, null);
UserAccountCreatedFromMatchingService userAccountCreatedFromMatchingService = new UserAccountCreatedFromMatchingService("issuer-id", "", "", Optional.absent());
final State newState = controller.getNextStateForUserAccountCreated(userAccountCreatedFromMatchingService);
assertThat(newState).isInstanceOf(UserAccountCreatedState.class);
final UserAccountCreatedState userAccountCreatedState = (UserAccountCreatedState) newState;
assertThat(userAccountCreatedState.getRelayState()).isNotNull();
assertThat(userAccountCreatedState.getRelayState().isPresent()).isTrue();
assertThat(userAccountCreatedState.getRelayState().get()).isEqualTo(relayState);
}
Aggregations