diff options
Diffstat (limited to 'juick-www/src/test/java/com/juick')
-rw-r--r-- | juick-www/src/test/java/com/juick/www/WebAppTests.java | 13 |
1 files changed, 13 insertions, 0 deletions
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 9d822d77..57094c37 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")); + } } |