use of uk.gov.ida.hub.policy.domain.state.SessionStartedState in project verify-hub by alphagov.
the class SessionRepositoryTest method stateTransitionAction_shouldUpdateDatastore.
@Test
public void stateTransitionAction_shouldUpdateDatastore() {
SessionStartedState sessionStartedState = aSessionStartedState().withSessionExpiryTimestamp(defaultSessionExpiry).build();
SessionId sessionId = sessionRepository.createSession(sessionStartedState);
sessionRepository.getStateController(sessionId, SessionStartedState.class);
verify(controllerFactory).build(eq(sessionStartedState), stateTransitionActionArgumentCaptor.capture());
TestState state = new TestState();
stateTransitionActionArgumentCaptor.getValue().transitionTo(state);
assertThat(dataStore.get(sessionId)).isEqualTo((State) state);
}
use of uk.gov.ida.hub.policy.domain.state.SessionStartedState 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);
}
Aggregations