import Tesla.Mock
import Plug.Conn
+ import Pleroma.Tests.Helpers, only: [clear_config: 2]
+
setup do
mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
:ok
assert %{valid_signature: false} == conn.assigns
end
+ test "it considers a mapped identity to be invalid when the associated instance is blocked" do
+ clear_config([:activitypub, :authorized_fetch_mode], true)
+
+ clear_config([:mrf_simple, :reject], [
+ {"mastodon.example.org", "anime is banned"}
+ ])
+
+ on_exit(fn ->
+ Pleroma.Config.put([:activitypub, :authorized_fetch_mode], false)
+ Pleroma.Config.put([:mrf_simple, :reject], [])
+ end)
+
+ conn =
+ build_conn(:post, "/doesntmattter", %{"actor" => "http://mastodon.example.org/users/admin"})
+ |> set_signature("http://mastodon.example.org/users/admin")
+ |> MappedSignatureToIdentityPlug.call(%{})
+
+ assert %{valid_signature: false} == conn.assigns
+ end
+
@tag skip: "known breakage; the testsuite presently depends on it"
test "it considers a mapped identity to be invalid when the identity cannot be found" do
conn =