diff options
author | feld <feld@feld.me> | 2020-07-15 13:44:52 +0000 |
---|---|---|
committer | feld <feld@feld.me> | 2020-07-15 13:44:52 +0000 |
commit | a2f9bc77b6514327bee11bac3090d935f0e570b4 (patch) | |
tree | 17339b70cdb9b647fe773fe95dd1961f98096cee /test | |
parent | 040524c09fc9b7cdf2cadc4cc2d647433715381d (diff) | |
parent | 3f8bff8d6bc8603d42761166bc949d088552ba97 (diff) | |
download | pleroma-a2f9bc77b6514327bee11bac3090d935f0e570b4.tar.gz |
Merge branch 'issue/sign-authority' into 'develop'
Include port in host for signatures
See merge request pleroma/pleroma!2766
Diffstat (limited to 'test')
-rw-r--r-- | test/web/activity_pub/publisher_test.exs | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/test/web/activity_pub/publisher_test.exs b/test/web/activity_pub/publisher_test.exs index c2bc38d52..b9388b966 100644 --- a/test/web/activity_pub/publisher_test.exs +++ b/test/web/activity_pub/publisher_test.exs @@ -123,6 +123,39 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do end describe "publish_one/1" do + test "publish to url with with different ports" do + inbox80 = "http://42.site/users/nick1/inbox" + inbox42 = "http://42.site:42/users/nick1/inbox" + + mock(fn + %{method: :post, url: "http://42.site:42/users/nick1/inbox"} -> + {:ok, %Tesla.Env{status: 200, body: "port 42"}} + + %{method: :post, url: "http://42.site/users/nick1/inbox"} -> + {:ok, %Tesla.Env{status: 200, body: "port 80"}} + end) + + actor = insert(:user) + + assert {:ok, %{body: "port 42"}} = + Publisher.publish_one(%{ + inbox: inbox42, + json: "{}", + actor: actor, + id: 1, + unreachable_since: true + }) + + assert {:ok, %{body: "port 80"}} = + Publisher.publish_one(%{ + inbox: inbox80, + json: "{}", + actor: actor, + id: 1, + unreachable_since: true + }) + end + test_with_mock "calls `Instances.set_reachable` on successful federation if `unreachable_since` is not specified", Instances, [:passthrough], @@ -131,7 +164,6 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do inbox = "http://200.site/users/nick1/inbox" assert {:ok, _} = Publisher.publish_one(%{inbox: inbox, json: "{}", actor: actor, id: 1}) - assert called(Instances.set_reachable(inbox)) end |