summaryrefslogtreecommitdiff
path: root/test/web
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2020-05-26 15:57:01 +0000
committerrinpatch <rinpatch@sdf.org>2020-05-26 15:57:01 +0000
commit3601c0015cd9537c75c476943d148a1063c237b8 (patch)
treee0842b37d9922ca7714a45100f3a640265fe5ccd /test/web
parent5ad28ff405d0d5efc794e0e1f20091164ca82ea8 (diff)
parentf20dff451e7abf343906b4e74f5d47b6207a3580 (diff)
downloadpleroma-3601c0015cd9537c75c476943d148a1063c237b8.tar.gz
pleroma-3601c0015cd9537c75c476943d148a1063c237b8.zip
Merge branch '1808-pleroma-sucks' into 'develop'
Resolve "Don't fail message ingestions when we can't update a user" Closes #1808 See merge request pleroma/pleroma!2576
Diffstat (limited to 'test/web')
-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 dd2a48a61..24edab41a 100644
--- a/test/web/activity_pub/activity_pub_controller_test.exs
+++ b/test/web/activity_pub/activity_pub_controller_test.exs
@@ -451,6 +451,36 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
assert Activity.get_by_ap_id(data["id"])
end
+ @tag capture_log: true
+ test "it inserts an incoming activity into the database" <>
+ "even if we can't fetch the user but have it in our db",
+ %{conn: conn} do
+ user =
+ insert(:user,
+ ap_id: "https://mastodon.example.org/users/raymoo",
+ ap_enabled: true,
+ local: false,
+ last_refreshed_at: nil
+ )
+
+ data =
+ File.read!("test/fixtures/mastodon-post-activity.json")
+ |> Poison.decode!()
+ |> Map.put("actor", user.ap_id)
+ |> put_in(["object", "attridbutedTo"], user.ap_id)
+
+ conn =
+ conn
+ |> assign(:valid_signature, true)
+ |> put_req_header("content-type", "application/activity+json")
+ |> post("/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 clears `unreachable` federation status of the sender", %{conn: conn} do
data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()