diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-10-23 17:22:42 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-10-23 17:22:42 +0300 |
commit | 8cc809e44e3a899f93061c4c5f68d9736d79d79e (patch) | |
tree | 8193991e2a2b705a60d847a626d22abaf756d7f1 /test/web/activity_pub/transmogrifier_test.exs | |
parent | 11cd9944258bfc2123b821b21321e12097d0f19b (diff) | |
parent | 54077677eaad44ea355c7f0db7ea5e94183d5a30 (diff) | |
download | pleroma-8cc809e44e3a899f93061c4c5f68d9736d79d79e.tar.gz pleroma-8cc809e44e3a899f93061c4c5f68d9736d79d79e.zip |
Merge remote-tracking branch 'remotes/upstream/develop' into 1304-user-info-deprecation
# Conflicts:
# lib/pleroma/notification.ex
Diffstat (limited to 'test/web/activity_pub/transmogrifier_test.exs')
-rw-r--r-- | test/web/activity_pub/transmogrifier_test.exs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index 3330c3e9d..ae56f8494 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -1106,6 +1106,50 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do assert activity.data["actor"] == other_user.ap_id assert activity.data["cc"] == [user.ap_id] end + + test "it correctly processes messages with non-array to field" do + user = insert(:user) + + message = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "to" => "https://www.w3.org/ns/activitystreams#Public", + "type" => "Create", + "object" => %{ + "content" => "blah blah blah", + "type" => "Note", + "attributedTo" => user.ap_id, + "inReplyTo" => nil + }, + "actor" => user.ap_id + } + + assert {:ok, activity} = Transmogrifier.handle_incoming(message) + + assert ["https://www.w3.org/ns/activitystreams#Public"] == activity.data["to"] + end + + test "it correctly processes messages with non-array cc field" do + user = insert(:user) + + message = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "to" => user.follower_address, + "cc" => "https://www.w3.org/ns/activitystreams#Public", + "type" => "Create", + "object" => %{ + "content" => "blah blah blah", + "type" => "Note", + "attributedTo" => user.ap_id, + "inReplyTo" => nil + }, + "actor" => user.ap_id + } + + assert {:ok, activity} = Transmogrifier.handle_incoming(message) + + assert ["https://www.w3.org/ns/activitystreams#Public"] == activity.data["cc"] + assert [user.follower_address] == activity.data["to"] + end end describe "prepare outgoing" do |