diff options
author | Vitaly Takmazov | 2018-03-28 22:28:33 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-03-28 22:31:43 +0300 |
commit | f6eb11a23ab645b187c5911ec762a3d6ca58140c (patch) | |
tree | 54f79790dc11a4e94487a5fce671f0514c092ccb /juick-server/src/test | |
parent | a41684e44da0021e2f8e653db28f1535e3941eb7 (diff) |
move like API to server
Diffstat (limited to 'juick-server/src/test')
-rw-r--r-- | juick-server/src/test/java/com/juick/server/tests/ServerTests.java | 14 |
1 files changed, 12 insertions, 2 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 52504f4a..c9556a98 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 @@ -41,7 +41,6 @@ import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoCon import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.http.MediaType; import org.springframework.jdbc.core.JdbcTemplate; @@ -465,7 +464,7 @@ public class ServerTests { .param("mid", "1").param("uid", String.valueOf(ugnich.getUid()))).andExpect(status().isUnauthorized()); } @Test - public void topTest() throws Exception { + public void topTest() { int topmid = messagesService.createMessage(ugnich.getUid(), "top message", null, null); IntStream.rangeClosed(6, 12).forEach(i -> { messagesService.createReply(topmid, 0, i, "yo", null); @@ -654,4 +653,15 @@ public class ServerTests { Assert.assertThat(count, equalTo(0L)); mockMvc.perform(get("/ws/_all")).andExpect(status().isBadRequest()); } + + @Test + public void likesTests() throws Exception { + int mid = messagesService.createMessage(ugnich.getUid(), "to be liked", null, null); + String freefdHash = userService.getHashByUID(freefd.getUid()); + int freefdMid = messagesService.createMessage(freefd.getUid(), "to be not liked", null, null); + mockMvc.perform(post("/like?mid=" + mid + "&hash=" + freefdHash)) + .andExpect(status().isOk()); + mockMvc.perform(post("/like?mid=" + freefdMid + "&hash=" + freefdHash)) + .andExpect(status().isForbidden()); + } } |