aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test/java/com/juick/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/test/java/com/juick/server/tests')
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java55
1 files changed, 0 insertions, 55 deletions
diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
index f1e3a58e..7e5acf1a 100644
--- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
@@ -1492,61 +1492,6 @@ public class ServerTests {
startsWith(StringEscapeUtils.escapeHtml4(MessageUtils.getMessageHashTags(message))));
}
@Test
- public void postMessageTests() throws Exception {
- mockMvc.perform(post("/post2").param("body", "yo"))
- .andExpect(status().is3xxRedirection()).andExpect(redirectedUrl("http://localhost/login"));
- MvcResult loginResult = mockMvc.perform(post("/login")
- .param("username", ugnichName)
- .param("password", ugnichPassword)).andReturn();
- String msgText = "yoppppl";
- mockMvc.perform(post("/post2")
- .cookie(loginResult.getResponse().getCookies())
- .param("body", msgText)).andExpect(status().isFound());
- Message lastMessage = messagesService.getMessage(messagesService.getMyFeed(ugnich.getUid(), 0, false).get(0));
- assertThat(lastMessage.getText(), equalTo(msgText));
- mockMvc.perform(post("/post2")
- .cookie(loginResult.getResponse().getCookies())
- .param("img", "http://static.juick.com/settings/facebook.png")).andExpect(status().isFound());
- lastMessage = messagesService.getMessage(messagesService.getMyFeed(ugnich.getUid(), 0, false).get(0));
- assertThat(lastMessage.getAttachmentType(), equalTo("png"));
- mockMvc.perform(post("/post2")
- .cookie(loginResult.getResponse().getCookies())
- .param("img", "bad_url")).andExpect(status().isBadRequest());
- FileInputStream fi = new FileInputStream(new ClassPathResource("static/tagscloud.png").getFile());
- MockMultipartFile file = new MockMultipartFile("attach", fi);
- mockMvc.perform(multipart("/post2")
- .file(file)
- .cookie(loginResult.getResponse().getCookies())).andExpect(status().isFound());
- int mid = messagesService.createMessage(ugnich.getUid(), "dummy message", null, null);
- mockMvc.perform(post("/comment")
- .param("mid", String.valueOf(mid))
- .param("body", "yo")).andExpect(redirectedUrl("http://localhost/login"));
- mockMvc.perform(post("/comment")
- .cookie(loginResult.getResponse().getCookies())
- .param("wrong_param", "yo")).andExpect(status().isBadRequest());
- mockMvc.perform(post("/comment")
- .cookie(loginResult.getResponse().getCookies())
- .param("mid", String.valueOf(mid))
- .param("wrong_param", "yo")).andExpect(status().isBadRequest());
- mockMvc.perform(post("/comment")
- .cookie(loginResult.getResponse().getCookies())
- .param("mid", String.valueOf(mid))
- .param("img", "http://static.juick.com/settings/facebook.png")).andExpect(status().isFound());
- mockMvc.perform(multipart("/comment")
- .file(file)
- .cookie(loginResult.getResponse().getCookies())
- .param("mid", String.valueOf(mid))).andExpect(status().isFound());
- mockMvc.perform(post("/comment")
- .cookie(loginResult.getResponse().getCookies())
- .param("mid", String.valueOf(mid))
- .param("body", "yo")).andExpect(redirectedUrl(String.format("/%s/%d#%d", ugnichName, mid, 3)));
- mockMvc.perform(post("/post2")
- .cookie(loginResult.getResponse().getCookies())
- .param("body", String.format("D #%d/%d", mid, 3)))
- .andExpect(status().isFound());
- assertThat(messagesService.getReplies(ugnich, mid).size(), equalTo(2));
- }
- @Test
public void hashLoginShouldNotUseSession() throws Exception {
String hash = userService.getHashByUID(ugnich.getUid());
MvcResult hashLoginResult = mockMvc.perform(get("/?show=my&hash=" + hash))