diff options
author | Vitaly Takmazov | 2018-04-22 18:25:16 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-22 18:25:16 +0300 |
commit | e8041f3f4158a0cffd7403fec22272967475ddb7 (patch) | |
tree | da8175288f1215d9e1c7bda1f73e9fcc5f963868 /juick-server/src/test | |
parent | 58b625dc6a5c0276541d2ee76ae06312e9c3fb36 (diff) |
jdbc: do not show messages with banned tags in feeds
Diffstat (limited to 'juick-server/src/test')
-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))); + + } } |