aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/test/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-03-02 14:54:23 +0300
committerGravatar Vitaly Takmazov2018-03-02 12:44:39 +0000
commitf17f861e292988327f5084e578f5a0e512033553 (patch)
tree8e8821fba6d86ee4f3be448193e0331f7d7b4764 /juick-www/src/test/java/com
parent15790c737b87b528f3a8eda4d4cb559220223bd6 (diff)
www: blank redirect for js login
Diffstat (limited to 'juick-www/src/test/java/com')
-rw-r--r--juick-www/src/test/java/com/juick/www/WebAppTests.java13
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"));
+ }
}