aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test/java/com/juick/server/tests/ServerTests.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/test/java/com/juick/server/tests/ServerTests.java')
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java14
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());
+ }
}