From 162262eb58c4642b7ffb9ed41bc760e0f009d6a6 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 3 Aug 2018 12:38:18 +0300 Subject: replies counter in feeds reflect banned comments --- .../test/java/com/juick/server/tests/ServerTests.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'juick-server/src/test/java/com/juick') 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 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 nonblmsgs = messagesService.getMessages(ugnich, Collections.singletonList(mid)); + assertThat(nonblmsgs.get(0).getReplies(), is(5)); } @Test public void cmykJpegShouldBeProcessedCorrectly() throws Exception { -- cgit v1.2.3