diff options
| author | rinpatch <rinpatch@sdf.org> | 2020-03-15 21:54:24 +0000 |
|---|---|---|
| committer | rinpatch <rinpatch@sdf.org> | 2020-03-15 21:54:24 +0000 |
| commit | bb49d8f5a0dbbad65a8f65a28cc2d0847b518067 (patch) | |
| tree | 938fb7fd74053a816c21948b28d5f6cfb7443f37 /test/web/activity_pub/activity_pub_controller_test.exs | |
| parent | e8493431bfc16977e43715bf8bdb09ac46580028 (diff) | |
| parent | 8d15d6c3ab9aecb82ba5126bb5efef20b3dfef41 (diff) | |
| download | pleroma-bb49d8f5a0dbbad65a8f65a28cc2d0847b518067.tar.gz pleroma-bb49d8f5a0dbbad65a8f65a28cc2d0847b518067.zip | |
Merge branch 'release/2.0.1' into 'stable'
2.0.1 release
See merge request pleroma/pleroma!2298
Diffstat (limited to 'test/web/activity_pub/activity_pub_controller_test.exs')
| -rw-r--r-- | test/web/activity_pub/activity_pub_controller_test.exs | 38 |
1 files changed, 38 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 9151034da..b2352538a 100644 --- a/test/web/activity_pub/activity_pub_controller_test.exs +++ b/test/web/activity_pub/activity_pub_controller_test.exs @@ -341,6 +341,44 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do assert "ok" == json_response(conn, 200) assert Instances.reachable?(sender_url) end + + test "accept follow activity", %{conn: conn} do + Pleroma.Config.put([:instance, :federating], true) + relay = Relay.get_actor() + + assert {:ok, %Activity{} = activity} = Relay.follow("https://relay.mastodon.host/actor") + + followed_relay = Pleroma.User.get_by_ap_id("https://relay.mastodon.host/actor") + relay = refresh_record(relay) + + accept = + File.read!("test/fixtures/relay/accept-follow.json") + |> String.replace("{{ap_id}}", relay.ap_id) + |> String.replace("{{activity_id}}", activity.data["id"]) + + assert "ok" == + conn + |> assign(:valid_signature, true) + |> put_req_header("content-type", "application/activity+json") + |> post("/inbox", accept) + |> json_response(200) + + ObanHelpers.perform(all_enqueued(worker: ReceiverWorker)) + + assert Pleroma.FollowingRelationship.following?( + relay, + followed_relay + ) + + Mix.shell(Mix.Shell.Process) + + on_exit(fn -> + Mix.shell(Mix.Shell.IO) + end) + + :ok = Mix.Tasks.Pleroma.Relay.run(["list"]) + assert_receive {:mix_shell, :info, ["relay.mastodon.host"]} + end end describe "/users/:nickname/inbox" do |
