use of org.springframework.webflow.test.MockRequestContext in project cas by apereo.
the class InitialFlowSetupActionCookieTests method verifySettingContextPath.
@Test
public void verifySettingContextPath() {
final MockHttpServletRequest request = new MockHttpServletRequest();
request.setContextPath(CONST_CONTEXT_PATH);
final MockRequestContext context = new MockRequestContext();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, new MockHttpServletResponse()));
this.action.doExecute(context);
assertEquals(CONST_CONTEXT_PATH + '/', this.warnCookieGenerator.getCookiePath());
assertEquals(CONST_CONTEXT_PATH + '/', this.tgtCookieGenerator.getCookiePath());
}
use of org.springframework.webflow.test.MockRequestContext in project cas by apereo.
the class InitialFlowSetupActionSsoTests method disableFlowIfNoService.
@Test
public void disableFlowIfNoService() throws Exception {
final MockRequestContext context = new MockRequestContext();
final MockHttpServletRequest request = new MockHttpServletRequest();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, new MockHttpServletResponse()));
this.thrown.expect(NoSuchFlowExecutionException.class);
this.action.execute(context);
}
use of org.springframework.webflow.test.MockRequestContext in project cas by apereo.
the class ServiceAuthorizationCheckTests method unauthorizedServiceProvided.
@Test
public void unauthorizedServiceProvided() throws Exception {
final MockRequestContext mockRequestContext = new MockRequestContext();
mockRequestContext.getFlowScope().put("service", this.unauthorizedService);
this.thrown.expect(UnauthorizedServiceException.class);
this.serviceAuthorizationCheck.doExecute(mockRequestContext);
fail("Should have thrown UnauthorizedServiceException");
}
use of org.springframework.webflow.test.MockRequestContext in project cas by apereo.
the class TicketGrantingTicketCheckActionTests method verifyValidTicket.
@Test
public void verifyValidTicket() throws Exception {
final MockRequestContext ctx = new MockRequestContext();
final AuthenticationResult ctxAuthN = CoreAuthenticationTestUtils.getAuthenticationResult(getAuthenticationSystemSupport());
final TicketGrantingTicket tgt = this.getCentralAuthenticationService().createTicketGrantingTicket(ctxAuthN);
WebUtils.putTicketGrantingTicketInScopes(ctx, tgt);
final TicketGrantingTicketCheckAction action = new TicketGrantingTicketCheckAction(this.getCentralAuthenticationService());
final Event event = action.doExecute(ctx);
assertEquals(TicketGrantingTicketCheckAction.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 {
final MockRequestContext ctx = new MockRequestContext();
final TicketGrantingTicketCheckAction action = new TicketGrantingTicketCheckAction(this.getCentralAuthenticationService());
final Event event = action.doExecute(ctx);
assertEquals(TicketGrantingTicketCheckAction.NOT_EXISTS, event.getId());
}
Aggregations