diff options
author | 2018-08-29 17:28:11 +0300 | |
---|---|---|
committer | 2018-08-29 17:28:11 +0300 | |
commit | 70963f3c8a616039a442362e778825f4fe85e4c5 (patch) | |
tree | 7a85efc93ce242ba196a49195cc55f36a86ce1c9 /juick-server/src/test/java/com/juick/server/tests/ServerTests.java | |
parent | bdf6c8ff1eb67d320684df025632ebf72966db37 (diff) |
shadow banned users from recommendations list
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.java | 17 |
1 files changed, 17 insertions, 0 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 95f459b4..70555fca 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 @@ -35,6 +35,7 @@ import com.juick.service.*; import com.juick.util.DateFormattersHolder; import com.juick.util.MessageUtils; import org.apache.commons.codec.CharEncoding; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.junit.After; @@ -1286,4 +1287,20 @@ public class ServerTests { mockMvc.perform(get("/auth").with(httpBasic(userName, userPassword))).andExpect(status().isUnauthorized()); } + @Test + public void bannedUserShouldBeShadowedFromRecommendationsList() throws IOException { + int ermineId = userService.createUser("ermine", "secret"); + int monstreekId = userService.createUser("monstreek", "secret"); + int pogoId = userService.createUser("pogo", "secret"); + int fmapId = userService.createUser("fmap", "secret"); + int mid = messagesService.createMessage(monstreekId, "KURWA", null, null); + assertThat(messagesService.recommendMessage(mid, ermineId), is(MessagesService.RecommendStatus.Added)); + assertThat(messagesService.recommendMessage(mid, fmapId), is(MessagesService.RecommendStatus.Added)); + assertThat(messagesService.recommendMessage(mid, pogoId), is(MessagesService.RecommendStatus.Added)); + assertThat(messagesService.getMessage(mid).getLikes(), is(3)); + assertThat(CollectionUtils.isEqualCollection(messagesService.getMessageRecommendations(mid), Arrays.asList("fmap", "ermine", "pogo")), is(true)); + privacyQueriesService.blacklistUser(userService.getUserByName("monstreek"), userService.getUserByName("pogo")); + assertThat(messagesService.getMessage(mid).getLikes(), is(3)); + assertThat(CollectionUtils.isEqualCollection(messagesService.getMessageRecommendations(mid), Arrays.asList("fmap", "ermine")), is(true)); + } } |