aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2024-03-13 02:20:33 +0300
committerGravatar Vitaly Takmazov2024-03-13 02:20:33 +0300
commite43b64a9ea8bf80ec62cd59ad4eed19b112f5093 (patch)
treece32df17b96e5e1965d795e15b74b19f0f43d9c5 /src/test
parent46db0df06eacbc7c7812918683089835e29ae56c (diff)
ActivityPub: handle Flag with multiple objects
TODO: refactor Activity to handle multiple objects
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java7
-rw-r--r--src/test/resources/flag.json2
2 files changed, 7 insertions, 2 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index 0724eb4f..b97ae8a3 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -217,6 +217,8 @@ public class ServerTests {
private Resource nojfif;
@Value("classpath:hubzilla_activity.json")
private Resource hubzillaActivity;
+ @Value("classpath:flag.json")
+ private Resource mastodonFlag;
@Value("classpath:hubzilla_follow.json")
private Resource hubzillaFollow;
@Value("classpath:to_as_string.json")
@@ -2275,7 +2277,7 @@ public class ServerTests {
}
@Test
- public void hubzillaAndHonkActorAndFriendicaUpdate() throws Exception {
+ public void hubzillaAndHonkActorAndFriendicaUpdateAndMastodonFlag() throws Exception {
String activity = IOUtils.toString(hubzillaActivity.getInputStream(), StandardCharsets.UTF_8);
Create create = jsonMapper.readValue(activity, Create.class);
String followData = IOUtils.toString(hubzillaFollow.getInputStream(), StandardCharsets.UTF_8);
@@ -2286,6 +2288,9 @@ public class ServerTests {
assertThat(hfollow.getTo().get(0), is("https://juick.com/u/vt"));
String updateString = IOUtils.toString(friendicaUpdate.getInputStream(), StandardCharsets.UTF_8);
Update update = jsonMapper.readValue(updateString, Update.class);
+ String flagString = IOUtils.toString(mastodonFlag.getInputStream(), StandardCharsets.UTF_8);
+ Flag flag = (Flag) jsonMapper.readValue(flagString, Context.class);
+ assertThat(flag.getObject().size(), is(3));
}
@Test
diff --git a/src/test/resources/flag.json b/src/test/resources/flag.json
index c3363f01..9598d9d9 100644
--- a/src/test/resources/flag.json
+++ b/src/test/resources/flag.json
@@ -1 +1 @@
-{"@context":"https://www.w3.org/ns/activitystreams","id":"https://localhost/32ac2d3e-c75c-46c1-b0a7-d9fac0986b9a","type":"Flag","actor":"https://example.com/actor","content":"","object":["https://juick.com/u/rtfmpls","https://juick.com/n/2998271-0"]} \ No newline at end of file
+{"@context":"https://www.w3.org/ns/activitystreams","id":"https://mastodon.social/bece4612-4dc7-4efd-871f-e388c393f239","type":"Flag","actor":"https://mastodon.social/actor","content":"","object":["https://juick.com/u/Monstreek","https://juick.com/n/3053193-14","https://juick.com/n/3053193-10"]} \ No newline at end of file