Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into no-async-clear-config

This commit is contained in:
Lain Soykaf 2023-12-12 10:55:19 +04:00
commit 18ab36d70c
16 changed files with 105 additions and 18 deletions

View file

@ -43,10 +43,7 @@ defmodule Pleroma.SignatureTest do
end
test "it returns error when not found user" do
assert capture_log(fn ->
assert Signature.fetch_public_key(make_fake_conn("https://test-ap-id")) ==
{:error, :error}
end) =~ "[error] Could not decode user"
assert Signature.fetch_public_key(make_fake_conn("https://test-ap-id")) == {:error, :error}
end
test "it returns error if public key is nil" do

View file

@ -1951,8 +1951,8 @@ defmodule Pleroma.UserTest do
end
end
test "get_public_key_for_ap_id fetches a user that's not in the db" do
assert {:ok, _key} = User.get_public_key_for_ap_id("http://mastodon.example.org/users/admin")
test "get_public_key_for_ap_id returns correctly for user that's not in the db" do
assert :error = User.get_public_key_for_ap_id("http://mastodon.example.org/users/admin")
end
describe "per-user rich-text filtering" do

View file

@ -89,6 +89,7 @@ defmodule Pleroma.Web.Plugs.FrontendStaticPlugTest do
"api",
"main",
"ostatus_subscribe",
"authorize_interaction",
"oauth",
"objects",
"activities",

View file

@ -460,4 +460,38 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowControllerTest do
assert avatar_url == "#{Pleroma.Web.Endpoint.url()}/localuser/avatar.png"
end
end
describe "GET /authorize_interaction - authorize_interaction/2" do
test "redirects to /ostatus_subscribe", %{conn: conn} do
Tesla.Mock.mock(fn
%{method: :get, url: "https://mastodon.social/users/emelie"} ->
%Tesla.Env{
status: 200,
headers: [{"content-type", "application/activity+json"}],
body: File.read!("test/fixtures/tesla_mock/emelie.json")
}
%{method: :get, url: "https://mastodon.social/users/emelie/collections/featured"} ->
%Tesla.Env{
status: 200,
headers: [{"content-type", "application/activity+json"}],
body:
File.read!("test/fixtures/users_mock/masto_featured.json")
|> String.replace("{{domain}}", "mastodon.social")
|> String.replace("{{nickname}}", "emelie")
}
end)
conn =
conn
|> get(
remote_follow_path(conn, :authorize_interaction, %{
uri: "https://mastodon.social/users/emelie"
})
)
assert redirected_to(conn) ==
remote_follow_path(conn, :follow, %{acct: "https://mastodon.social/users/emelie"})
end
end
end