aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-07-04 12:46:42 +0300
committerGravatar Vitaly Takmazov2018-07-04 12:46:42 +0300
commit593b0bff6ddd6ff3756d7ee46d44defb12b0e982 (patch)
treecc4843077cfbdc2df8b1d07d8232f158dd2e3450 /juick-server/src/test
parent2e6c77c1db5b1017c8701c3b016c62d3b100fd64 (diff)
do not show banned users in thread
Diffstat (limited to 'juick-server/src/test')
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java21
1 files changed, 20 insertions, 1 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 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<Message> 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));
+ }
}