use of org.springframework.security.test.context.support.WithAnonymousUser in project nixmash-blog by mintster.
the class UserPasswordControllerTests method anonymousUserCannotAccessResetPasswordPage.
@Test
@WithAnonymousUser
public void anonymousUserCannotAccessResetPasswordPage() throws Exception {
RequestBuilder request = get("/users/resetpassword").with(csrf());
mvc.perform(request).andExpect(status().is3xxRedirection()).andExpect(loginPage());
}
use of org.springframework.security.test.context.support.WithAnonymousUser in project nixmash-blog by mintster.
the class UserPasswordControllerTests method resetPasswordPageWithTokenReturnsChangePasswordView.
@Test
@WithAnonymousUser
public void resetPasswordPageWithTokenReturnsChangePasswordView() throws Exception {
RequestBuilder request = get("/users/resetpassword/" + UUID.randomUUID().toString()).with(csrf());
mvc.perform(request).andExpect(status().isOk()).andExpect(model().attributeExists("userPasswordDTO")).andExpect(view().name(USER_CHANGEPASSWORD_VIEW));
}
Aggregations