diff options
author | Vitaly Takmazov | 2018-08-03 12:38:18 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-08-03 12:38:18 +0300 |
commit | 162262eb58c4642b7ffb9ed41bc760e0f009d6a6 (patch) | |
tree | b72b3b1807c561c61c3c40c27f07ba3e012acd73 /juick-server/src/test | |
parent | 798e8da8737c4fe5fee8dfaa7f98bfa13e2d91da (diff) |
replies counter in feeds reflect banned comments
Diffstat (limited to 'juick-server/src/test')
-rw-r--r-- | juick-server/src/test/java/com/juick/server/tests/ServerTests.java | 18 |
1 files changed, 11 insertions, 7 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 c0141b2c..b468daff 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 @@ -878,7 +878,7 @@ public class ServerTests { Message msg4 = messagesService.getMessage(mid1); assertThat(msg4.getLikes(), is(0)); - assertThat(messagesService.getMessages(Collections.singletonList(mid1)).get(0).getLikes(), is(0)); + assertThat(messagesService.getMessages(AnonymousUser.INSTANCE, Collections.singletonList(mid1)).get(0).getLikes(), is(0)); Assert.assertEquals(1, msg4.getReactions().stream().filter(r -> r.getId() == 2) .findFirst().orElseThrow(IllegalStateException::new).getCount()); mockMvc.perform(post("/react?mid=" + mid1 + "&hash=" + freefdHash+ "&reactionId=1")) @@ -931,18 +931,18 @@ public class ServerTests { int mid = messagesService.createMessage(ugnich.getUid(), "yo", "jpg", Collections.singletonList(banned)); privacyQueriesService.blacklistTag(freefd, banned); - assertTrue(messagesService.getMessages(messagesService.getAll(freefd.getUid(), 0)) + assertTrue(messagesService.getMessages(AnonymousUser.INSTANCE, messagesService.getAll(freefd.getUid(), 0)) .stream().noneMatch(m -> m.getTags().contains(banned))); - assertFalse(messagesService.getMessages(messagesService.getAll(ugnich.getUid(), 0)) + assertFalse(messagesService.getMessages(AnonymousUser.INSTANCE, messagesService.getAll(ugnich.getUid(), 0)) .stream().noneMatch(m -> m.getTags().contains(banned))); - assertTrue(messagesService.getMessages(messagesService.getPhotos(freefd.getUid(), 0)) + assertTrue(messagesService.getMessages(AnonymousUser.INSTANCE, messagesService.getPhotos(freefd.getUid(), 0)) .stream().noneMatch(m -> m.getTags().contains(banned))); - assertFalse(messagesService.getMessages(messagesService.getPhotos(ugnich.getUid(), 0)) + assertFalse(messagesService.getMessages(AnonymousUser.INSTANCE, messagesService.getPhotos(ugnich.getUid(), 0)) .stream().noneMatch(m -> m.getTags().contains(banned))); jdbcTemplate.update("UPDATE messages SET popular=1 WHERE message_id=?", mid); - assertTrue(messagesService.getMessages(messagesService.getPopular(freefd.getUid(), 0)) + assertTrue(messagesService.getMessages(AnonymousUser.INSTANCE, messagesService.getPopular(freefd.getUid(), 0)) .stream().noneMatch(m -> m.getTags().contains(banned))); - assertFalse(messagesService.getMessages(messagesService.getPopular(ugnich.getUid(), 0)) + assertFalse(messagesService.getMessages(AnonymousUser.INSTANCE, messagesService.getPopular(ugnich.getUid(), 0)) .stream().noneMatch(m -> m.getTags().contains(banned))); } @@ -1066,9 +1066,13 @@ public class ServerTests { reply = messagesService.getReply(mid, 5); assertThat(userService.isReplyToBL(ugnich, reply), is(true)); assertThat(replies.size(), is(1)); + List<Message> msgs = messagesService.getMessages(ugnich, Collections.singletonList(mid)); + assertThat(msgs.get(0).getReplies(), is(1)); commandsManager.processCommand(ugnich, "BL @freefd", emptyUri); messagesService.setRead(ugnich, mid); assertThat(messagesService.getReplies(ugnich, mid).size(), is(5)); + List<Message> nonblmsgs = messagesService.getMessages(ugnich, Collections.singletonList(mid)); + assertThat(nonblmsgs.get(0).getReplies(), is(5)); } @Test public void cmykJpegShouldBeProcessedCorrectly() throws Exception { |