diff options
author | Vitaly Takmazov | 2018-02-05 14:55:50 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-02-05 14:55:50 +0300 |
commit | 8aa11c92f36a5fd2fbed24e8423c8b9e14efda5f (patch) | |
tree | a4afa29f2a0a4ba009709102c79339b9c788c5fc /juick-www/src/test | |
parent | fa070e8e63fb25dabddc97a6c1c6b72c2b46b66f (diff) |
www: fb and vk logins using hash redirects
Diffstat (limited to 'juick-www/src/test')
-rw-r--r-- | juick-www/src/test/java/com/juick/www/WebAppTests.java | 14 |
1 files changed, 8 insertions, 6 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 c663ff6d..ef33506c 100644 --- a/juick-www/src/test/java/com/juick/www/WebAppTests.java +++ b/juick-www/src/test/java/com/juick/www/WebAppTests.java @@ -75,14 +75,12 @@ import java.util.stream.IntStream; import java.util.stream.StreamSupport; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.startsWith; +import static org.hamcrest.Matchers.*; import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Created by vitalyster on 12.01.2017. @@ -316,7 +314,11 @@ public class WebAppTests { .param("username", ugnichName) .param("password", ugnichPassword)).andReturn(); Cookie rememberMeFromForm = formLoginResult.getResponse().getCookie("juick-remember-me"); - mockMvc.perform(get("/?show=my").cookie(rememberMeFromForm)).andExpect(status().isOk()); - mockMvc.perform(get("/?show=my").cookie(rememberMeFromHash)).andExpect(status().isOk()); + mockMvc.perform(get("/?show=my").cookie(rememberMeFromForm)).andExpect(status().isOk()) + .andExpect(model().attribute("visitor", hasProperty("authHash", equalTo(hash)))) + .andExpect(content().string(containsString(hash))); + mockMvc.perform(get("/?show=my").cookie(rememberMeFromHash)).andExpect(status().isOk()) + .andExpect(model().attribute("visitor", hasProperty("authHash", equalTo(hash)))) + .andExpect(content().string(containsString(hash))); } } |