diff options
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 | 21 |
1 files changed, 21 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 e8111239..087acbc4 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 @@ -879,4 +879,25 @@ public class ServerTests { .andExpect(status().isOk()); assertThat(lastRead.apply(ugnich, mid), is(newfreefdrid)); } + @Test + public void feedsShouldNotContainMessagesWithBannedTags() { + Tag banned = tagService.getTag("banned", true); + int mid = messagesService.createMessage(ugnich.getUid(), "yo", "jpg", + Collections.singletonList(banned)); + privacyQueriesService.blacklistTag(freefd, banned); + assertTrue(messagesService.getMessages(messagesService.getAll(freefd.getUid(), 0)) + .stream().noneMatch(m -> m.getTags().contains(banned))); + assertFalse(messagesService.getMessages(messagesService.getAll(ugnich.getUid(), 0)) + .stream().noneMatch(m -> m.getTags().contains(banned))); + assertTrue(messagesService.getMessages(messagesService.getPhotos(freefd.getUid(), 0)) + .stream().noneMatch(m -> m.getTags().contains(banned))); + assertFalse(messagesService.getMessages(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)) + .stream().noneMatch(m -> m.getTags().contains(banned))); + assertFalse(messagesService.getMessages(messagesService.getPopular(ugnich.getUid(), 0)) + .stream().noneMatch(m -> m.getTags().contains(banned))); + + } } |