summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-11-13 18:42:35 +0100
committerlain <lain@soykaf.club>2020-11-13 18:42:35 +0100
commit5759dbff471d3093c5c20f9a5602422f225ec709 (patch)
treef44575d1801e217f088421377c0b0a995a3d7d87
parent157e32a39c2da6b907cc86a1c3295cbbec5ffc10 (diff)
AP Controller test: Add test for issue #22982298-weird-follow-issue
-rw-r--r--test/pleroma/web/activity_pub/activity_pub_controller_test.exs35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs
index b696a24f4..627563cf2 100644
--- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs
+++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs
@@ -551,6 +551,41 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
assert Activity.get_by_ap_id(data["id"])
end
+ test "it works with this thing", %{conn: conn} do
+ user = insert(:user)
+
+ data = %{
+ "@context": "https://www.w3.org/ns/activitystreams",
+ id: "https://p.farhan.codes/activities/4367d2a7-b6ed-424e-8bd1-e7f053af4f5c",
+ object: user.ap_id,
+ type: "Follow",
+ actor: "https://p.farhan.codes/users/farhan"
+ }
+
+ remote_user = File.read!("test/fixtures/farhan.json")
+
+ Tesla.Mock.mock(fn
+ %{method: :get, url: "https://p.farhan.codes/users/farhan"} ->
+ %Tesla.Env{
+ status: 200,
+ body: remote_user,
+ headers: [{"content-type", "application/activity+json"}]
+ }
+ end)
+
+ conn =
+ conn
+ |> assign(:valid_signature, true)
+ |> put_req_header("content-type", "application/activity+json")
+ |> post("/users/#{user.nickname}/inbox", data)
+
+ assert "ok" == json_response(conn, 200)
+
+ ObanHelpers.perform(all_enqueued(worker: ReceiverWorker))
+
+ assert Activity.get_by_ap_id(data[:id])
+ end
+
test "it accepts messages with to as string instead of array", %{conn: conn, data: data} do
user = insert(:user)