use of org.springframework.security.test.context.support.WithAnonymousUser in project nixmash-blog by mintster.
the class GlobalControllerTests method googleAnalyticsAnonymousUserTest.
@Test
@WithAnonymousUser
public void googleAnalyticsAnonymousUserTest() throws Exception {
RequestBuilder request = get("/").with(csrf());
MvcResult result = mockMvc.perform(request).andReturn();
assertTrue(result.getResponse().getContentAsString().contains(TRACKING_ID));
}
use of org.springframework.security.test.context.support.WithAnonymousUser in project nixmash-blog by mintster.
the class UserPasswordControllerTests method resetPasswordFromEmail.
@Test
@WithAnonymousUser
public void resetPasswordFromEmail() throws Exception {
UserToken userToken = userService.createUserToken(erwin);
RequestBuilder request = post("/users/resetpassword").param("userId", "-400").param("verificationToken", userToken.getToken()).param("password", "password").param("repeatedPassword", "password").with(csrf());
mvc.perform(request).andExpect(model().attribute("feedbackMessage", containsString("login")));
}
use of org.springframework.security.test.context.support.WithAnonymousUser in project uhgroupings by uhawaii-system-its-ti-iam.
the class HomeControllerTest method groupingsViaAnonymous.
@Test
@WithAnonymousUser
public void groupingsViaAnonymous() throws Exception {
// Anonymous users not allowed into admin area.
ResultActions result = mockMvc.perform(get("/groupings")).andExpect(status().is3xxRedirection()).andExpect(redirectedUrlPattern(casLoginUrl + "**"));
assertNotNull(result);
}
use of org.springframework.security.test.context.support.WithAnonymousUser in project uhgroupings by uhawaii-system-its-ti-iam.
the class HomeControllerTest method adminViaAnonymous.
@Test
@WithAnonymousUser
public void adminViaAnonymous() throws Exception {
// Anonymous users not allowed into admin area.
MvcResult mvcResult = mockMvc.perform(get("/admin")).andExpect(status().is3xxRedirection()).andExpect(redirectedUrlPattern(casLoginUrl + "**")).andReturn();
assertNotNull(mvcResult);
}
use of org.springframework.security.test.context.support.WithAnonymousUser in project pivotal-cla by pivotalsoftware.
the class CclaControllerTests method view.
@Test
@WithAnonymousUser
public void view() {
when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
ViewCclaPage signPage = ViewCclaPage.go(getDriver(), cla.getName());
assertThat(signPage.getCorporate()).isEqualTo(cla.getCorporateContent().getHtml());
}
Aggregations