aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/test/java/com')
-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 {