aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test/java/com/juick/server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-08-12 19:12:58 +0300
committerGravatar Vitaly Takmazov2018-08-12 19:12:58 +0300
commitc0ac4aa5824b45ff9543f60c648625869b11b1a3 (patch)
tree6e5b5c2eb436b58f32a0a07964a24af9cff6de2f /juick-server/src/test/java/com/juick/server
parentbabb3a50a1c7e6101980a9577364b169b5c6654c (diff)
do not show banned users in my feed from recommendations
Diffstat (limited to 'juick-server/src/test/java/com/juick/server')
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java16
1 files changed, 13 insertions, 3 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 b4d91b79..1aff9ca3 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
@@ -176,6 +176,7 @@ public class ServerTests {
freefd = userService.getUserByUID(freefdId).orElseThrow(IllegalStateException::new);
int juickId = userService.createUser(juickName, juickPassword);
juick = userService.getUserByUID(juickId).orElseThrow(IllegalStateException::new);
+ subscriptionService.subscribeUser(freefd, ugnich);
isSetUp = true;
}
}
@@ -190,8 +191,6 @@ public class ServerTests {
public void getMyFeed() {
int mid0 = messagesService.createMessage(ugnich.getUid(), "test", null, null);
int mid2 = messagesService.createMessage(ugnich.getUid(), "test2", null, null);
- subscriptionService.subscribeUser(userService.getUserByUID(freefd.getUid()).orElse(AnonymousUser.INSTANCE),
- userService.getUserByUID(ugnich.getUid()).orElse(AnonymousUser.INSTANCE));
List<Integer> freefdFeed = messagesService.getMyFeed(freefd.getUid(), 0, false);
assertThat(freefdFeed.get(0), equalTo(mid2));
int tonyaid = userService.createUser("Tonya", "secret");
@@ -942,7 +941,18 @@ public class ServerTests {
.stream().noneMatch(m -> m.getTags().contains(banned)));
assertFalse(messagesService.getMessages(AnonymousUser.INSTANCE, messagesService.getPopular(ugnich.getUid(), 0))
.stream().noneMatch(m -> m.getTags().contains(banned)));
-
+ assertTrue(messagesService.getMessages(AnonymousUser.INSTANCE, messagesService.getMyFeed(freefd.getUid(), 0, true))
+ .stream().noneMatch(m -> m.getTags().contains(banned)));
+ int newUid = userService.createUser("newUser", "12345");
+ int newMid = messagesService.createMessage(newUid, "people", null, Collections.singletonList(banned));
+ messagesService.recommendMessage(newMid, ugnich.getUid());
+ assertTrue(messagesService.getMessages(AnonymousUser.INSTANCE, messagesService.getMyFeed(freefd.getUid(), 0, true))
+ .stream().noneMatch(m -> m.getTags().contains(banned)));
+ tagService.updateTags(newMid, Collections.singletonList(banned));
+ assertThat(messagesService.getMessage(newMid).getTags().size(), is(0));
+ privacyQueriesService.blacklistUser(freefd, userService.getUserByUID(newUid).orElse(AnonymousUser.INSTANCE));
+ assertTrue(messagesService.getMessages(AnonymousUser.INSTANCE, messagesService.getMyFeed(freefd.getUid(), 0, true))
+ .stream().noneMatch(m -> m.getMid() == newMid));
}
@Test
public void tagsShouldBeDeserializedFromXml() throws JAXBException {