summaryrefslogtreecommitdiff
path: root/test/web/activity_pub/activity_pub_controller_test.exs
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2019-04-22 13:08:30 +0700
committerEgor Kislitsyn <egor@kislitsyn.com>2019-04-22 13:08:30 +0700
commite8c2f9a73a37636a9a8ed5c2998617b841f482da (patch)
tree4b194e631d2bbb58b8522c3d74a0b0c2ea09fedd /test/web/activity_pub/activity_pub_controller_test.exs
parent38926a063a39c4d4387049f5d364f72a9f8bd2de (diff)
parent7fcbda702e76b6390076c28832f5aea80086d15a (diff)
downloadpleroma-e8c2f9a73a37636a9a8ed5c2998617b841f482da.tar.gz
pleroma-e8c2f9a73a37636a9a8ed5c2998617b841f482da.zip
Merge remote-tracking branch 'pleroma/develop' into feature/disable-account
Diffstat (limited to 'test/web/activity_pub/activity_pub_controller_test.exs')
-rw-r--r--test/web/activity_pub/activity_pub_controller_test.exs30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/web/activity_pub/activity_pub_controller_test.exs b/test/web/activity_pub/activity_pub_controller_test.exs
index 8dd8e7e0a..7b1c60f15 100644
--- a/test/web/activity_pub/activity_pub_controller_test.exs
+++ b/test/web/activity_pub/activity_pub_controller_test.exs
@@ -253,6 +253,36 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
assert Activity.get_by_ap_id(data["id"])
end
+ test "it accepts messages from actors that are followed by the user", %{conn: conn} do
+ recipient = insert(:user)
+ actor = insert(:user, %{ap_id: "http://mastodon.example.org/users/actor"})
+
+ {:ok, recipient} = User.follow(recipient, actor)
+
+ data =
+ File.read!("test/fixtures/mastodon-post-activity.json")
+ |> Poison.decode!()
+
+ object =
+ data["object"]
+ |> Map.put("attributedTo", actor.ap_id)
+
+ data =
+ data
+ |> Map.put("actor", actor.ap_id)
+ |> Map.put("object", object)
+
+ conn =
+ conn
+ |> assign(:valid_signature, true)
+ |> put_req_header("content-type", "application/activity+json")
+ |> post("/users/#{recipient.nickname}/inbox", data)
+
+ assert "ok" == json_response(conn, 200)
+ :timer.sleep(500)
+ assert Activity.get_by_ap_id(data["id"])
+ end
+
test "it rejects reads from other users", %{conn: conn} do
user = insert(:user)
otheruser = insert(:user)