From f17f861e292988327f5084e578f5a0e512033553 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 2 Mar 2018 14:54:23 +0300 Subject: www: blank redirect for js login --- juick-www/src/test/java/com/juick/www/WebAppTests.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'juick-www/src/test/java/com/juick') diff --git a/juick-www/src/test/java/com/juick/www/WebAppTests.java b/juick-www/src/test/java/com/juick/www/WebAppTests.java index 9d822d77c..57094c37a 100644 --- a/juick-www/src/test/java/com/juick/www/WebAppTests.java +++ b/juick-www/src/test/java/com/juick/www/WebAppTests.java @@ -384,4 +384,17 @@ public class WebAppTests { assertThat(discussionsOld.querySelectorAll("article") .get(0).getAttributes().getNamedItem("data-mid").getNodeValue(), is(String.valueOf(mid))); } + @Test + public void redirectParamShouldCorrectlyRedirectLoggedUser() throws Exception { + MvcResult formLoginResult = mockMvc.perform(post("/login") + .param("username", ugnichName) + .param("password", ugnichPassword)).andReturn(); + Cookie rememberMeFromForm = formLoginResult.getResponse().getCookie("juick-remember-me"); + mockMvc.perform(get("/login").cookie(rememberMeFromForm)) + .andExpect(status().is3xxRedirection()) + .andExpect(redirectedUrl("/")); + mockMvc.perform(get("/login?redirect=false").cookie(rememberMeFromForm)) + .andExpect(status().is3xxRedirection()) + .andExpect(redirectedUrl("/login/success")); + } } -- cgit v1.2.3