From 593b0bff6ddd6ff3756d7ee46d44defb12b0e982 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 4 Jul 2018 12:46:42 +0300 Subject: do not show banned users in thread --- .../java/com/juick/server/tests/ServerTests.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'juick-server/src/test/java/com') 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 c43ed9bd..af5b20ec 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 @@ -670,7 +670,6 @@ public class ServerTests { @Test public void protocolTests() throws Exception { - URI emptyUri = URI.create(StringUtils.EMPTY); int uid = userService.createUser("me", "secret"); User user = userService.getUserByUID(uid).orElse(AnonymousUser.INSTANCE); Tag yo = tagService.getTag("yo", true); @@ -1047,4 +1046,24 @@ public class ServerTests { .with(httpBasic(ugnichName, ugnichPassword))) .andExpect(jsonPath("$.hash", is(hash))); } + @Test + public void feedsShouldNotContainBannedUsers() throws Exception { + commandsManager.processCommand(ugnich, "BL @freefd", emptyUri); + CommandResult result = commandsManager.processCommand(ugnich, "freefd - dick", emptyUri); + int mid = result.getNewMessage().get().getMid(); + commandsManager.processCommand(freefd, String.format("#%d ugnich - dick too", mid), emptyUri); + commandsManager.processCommand(juick, String.format("#%d/1 ban for a hour!", mid), emptyUri); + commandsManager.processCommand(juick, String.format("#%d freefd is here but it is hidden from you", mid), emptyUri); + assertThat(messagesService.getMessage(mid).getReplies(), is(3)); + List replies = messagesService.getReplies(ugnich, mid); + assertThat(replies.size(), is(1)); + commandsManager.processCommand(freefd, String.format("#%d/3 hahaha!", mid), emptyUri); + assertThat(messagesService.getMessage(mid).getReplies(), is(4)); + replies = messagesService.getReplies(ugnich, mid); + assertThat(replies.size(), is(1)); + commandsManager.processCommand(juick, String.format("#%d/4 mmm?!", mid), emptyUri); + assertThat(messagesService.getMessage(mid).getReplies(), is(5)); + replies = messagesService.getReplies(ugnich, mid); + assertThat(replies.size(), is(1)); + } } -- cgit v1.2.3