aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com/juick/server/tests
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-12-08 14:26:43 +0300
committerGravatar Vitaly Takmazov2023-12-08 14:26:43 +0300
commit70810eb92ff7810eb0df133d157078064d666a33 (patch)
tree34cdd37cecc600751862a0c8229ec5650b0ff80b /src/test/java/com/juick/server/tests
parent45733cbe5a0d247c017c37a82be24efc7d7b9db7 (diff)
Do not count recommendations from banned users
* Previosly only own message recommendations were filtered, now all message recommendations filter banned users
Diffstat (limited to 'src/test/java/com/juick/server/tests')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index 9a46f691..81718cab 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -1580,27 +1580,25 @@ public class ServerTests {
User monstreek = userService.createUser("monstreek", "secret").orElseThrow(IllegalStateException::new);
User pogo = userService.createUser("pogo", "secret").orElseThrow(IllegalStateException::new);
User fmap = userService.createUser("fmap", "secret").orElseThrow(IllegalStateException::new);
- int mid = messagesService.createMessage(monstreek.getUid(), "KURWA", null, Set.of());
+ int mid = messagesService.createMessage(fmap.getUid(), "KURWA", null, Set.of());
assertThat(messagesService.recommendMessage(mid, ermine.getUid()),
is(MessagesService.RecommendStatus.Added));
- assertThat(messagesService.recommendMessage(mid, fmap.getUid()),
- is(MessagesService.RecommendStatus.Added));
assertThat(messagesService.recommendMessage(mid, pogo.getUid()),
is(MessagesService.RecommendStatus.Added));
jdbcTemplate.update("INSERT INTO favorites(user_id, user_uri, message_id, like_id, ts) "
+ "values (0, 'http://example.com/u/test', ?, 1, ?)", mid, Date.from(Instant.now()));
- assertThat(messagesService.getMessage(mid).get().getRecommendations().size(), is(4));
+ assertThat(messagesService.getMessage(mid).get().getRecommendations().size(), is(3));
assertThat(CollectionUtils.isEqualCollection(
- messagesService.getMessagesRecommendations(Collections.singletonList(mid)).stream()
+ messagesService.getMessagesRecommendations(monstreek.getUid(), Collections.singletonList(mid)).stream()
.map(Pair::getRight).map(User::getName).toList(),
- Arrays.asList("fmap", "ermine", "pogo", "Anonymous")), is(true));
+ Arrays.asList("ermine", "pogo", "Anonymous")), is(true));
privacyQueriesService.blacklistUser(userService.getUserByName("monstreek"),
userService.getUserByName("pogo"));
assertThat(messagesService.getMessage(mid).get().getRecommendations().size(), is(3));
assertThat(CollectionUtils.isEqualCollection(
- messagesService.getMessagesRecommendations(Collections.singletonList(mid)).stream()
+ messagesService.getMessagesRecommendations(monstreek.getUid(), Collections.singletonList(mid)).stream()
.map(Pair::getRight).map(User::getName).toList(),
- Arrays.asList("fmap", "ermine", "Anonymous")), is(true));
+ Arrays.asList("ermine", "Anonymous")), is(true));
jdbcTemplate.execute("DELETE FROM favorites");
}