use of org.springframework.webflow.test.MockRequestContext in project cas by apereo.
the class TerminateSessionActionTests method verifyTerminateActionByCookie.
@Test
public void verifyTerminateActionByCookie() throws Exception {
val context = new MockRequestContext();
val request = new MockHttpServletRequest();
request.setCookies(new Cookie("TGC", "TGT-123456-something"));
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, new MockHttpServletResponse()));
assertEquals(CasWebflowConstants.TRANSITION_ID_SUCCESS, action.execute(context).getId());
assertNotNull(WebUtils.getLogoutRequests(context));
}
use of org.springframework.webflow.test.MockRequestContext in project cas by apereo.
the class TicketGrantingTicketCheckActionTests method verifyValidTicket.
@Test
public void verifyValidTicket() throws Exception {
val ctx = new MockRequestContext();
val ctxAuthN = CoreAuthenticationTestUtils.getAuthenticationResult(getAuthenticationSystemSupport());
val tgt = getCentralAuthenticationService().createTicketGrantingTicket(ctxAuthN);
WebUtils.putTicketGrantingTicketInScopes(ctx, tgt);
val action = new TicketGrantingTicketCheckAction(getCentralAuthenticationService());
val event = action.execute(ctx);
assertEquals(CasWebflowConstants.TRANSITION_ID_TICKET_GRANTING_TICKET_VALID, event.getId());
}
use of org.springframework.webflow.test.MockRequestContext in project cas by apereo.
the class TicketGrantingTicketCheckActionTests method verifyNullTicket.
@Test
public void verifyNullTicket() throws Exception {
val ctx = new MockRequestContext();
val action = new TicketGrantingTicketCheckAction(getCentralAuthenticationService());
val event = action.execute(ctx);
assertEquals(CasWebflowConstants.TRANSITION_ID_TICKET_GRANTING_TICKET_NOT_EXISTS, event.getId());
}
use of org.springframework.webflow.test.MockRequestContext in project cas by apereo.
the class TicketGrantingTicketCheckActionTests method verifyInvalidTicket.
@Test
public void verifyInvalidTicket() throws Exception {
val ctx = new MockRequestContext();
val tgt = new MockTicketGrantingTicket("user");
WebUtils.putTicketGrantingTicketInScopes(ctx, tgt);
val action = new TicketGrantingTicketCheckAction(getCentralAuthenticationService());
val event = action.execute(ctx);
assertEquals(CasWebflowConstants.TRANSITION_ID_TICKET_GRANTING_TICKET_INVALID, event.getId());
}
use of org.springframework.webflow.test.MockRequestContext in project cas by apereo.
the class RenderLoginActionTests method verifyNoRender.
@Test
public void verifyNoRender() throws Exception {
val context = new MockRequestContext();
val request = new MockHttpServletRequest();
val response = new MockHttpServletResponse();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, response));
RequestContextHolder.setRequestContext(context);
ExternalContextHolder.setExternalContext(context.getExternalContext());
val properties = new CasConfigurationProperties();
val action = new RenderLoginAction(getServicesManager(), properties, applicationContext);
assertNull(action.execute(context));
}
Aggregations