diff options
author | 2018-03-02 14:54:23 +0300 | |
---|---|---|
committer | 2018-03-02 12:44:39 +0000 | |
commit | f17f861e292988327f5084e578f5a0e512033553 (patch) | |
tree | 8e8821fba6d86ee4f3be448193e0331f7d7b4764 /juick-www/src/test | |
parent | 15790c737b87b528f3a8eda4d4cb559220223bd6 (diff) |
www: blank redirect for js login
Diffstat (limited to 'juick-www/src/test')
-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")); + } } |