mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2025-04-24 13:57:23 -04:00
Fix tests
This commit is contained in:
parent
a0d217154c
commit
110d30ccd3
7 changed files with 15 additions and 7 deletions
|
@ -546,6 +546,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
{:ok, activity} <- ActivityPub.unfollow(follower, followed, id, false) do
|
||||
User.unfollow(follower, followed)
|
||||
{:ok, activity}
|
||||
else
|
||||
_ -> {:error, :invalid_undo}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -559,6 +561,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
when type in ["Like", "EmojiReact", "Announce", "Block"] do
|
||||
with {:ok, activity, _} <- Pipeline.common_pipeline(data, local: false) do
|
||||
{:ok, activity}
|
||||
else
|
||||
_ -> {:error, :invalid_undo}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -575,6 +579,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
activity
|
||||
|> Map.put("object", data)
|
||||
|> handle_incoming(options)
|
||||
else
|
||||
_ -> {:error, :invalid_undo}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -591,6 +597,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
{:ok, %User{} = target_user} <- User.get_or_fetch_by_ap_id(target_actor),
|
||||
true <- origin_actor in target_user.also_known_as do
|
||||
ActivityPub.move(origin_user, target_user, false)
|
||||
else
|
||||
_ -> {:error, :invalid_move}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ defmodule Pleroma.Object.ContainmentTest do
|
|||
assert capture_log(fn ->
|
||||
{:error, _} = User.get_or_fetch_by_ap_id("https://n1u.moe/users/rye")
|
||||
end) =~
|
||||
"[error] Could not decode user at fetch https://n1u.moe/users/rye"
|
||||
"[debug] Could not decode user at fetch https://n1u.moe/users/rye"
|
||||
end
|
||||
|
||||
test "contain_origin_from_id() gracefully handles cases where no ID is present" do
|
||||
|
|
|
@ -115,7 +115,7 @@ defmodule Pleroma.ReverseProxyTest do
|
|||
assert capture_log(fn ->
|
||||
ReverseProxy.call(conn, "/huge-file", max_body_length: 4)
|
||||
end) =~
|
||||
"[error] Elixir.Pleroma.ReverseProxy: request to \"/huge-file\" failed: :body_too_large"
|
||||
"[debug] Elixir.Pleroma.ReverseProxy: request to \"/huge-file\" failed: :body_too_large"
|
||||
|
||||
assert {:ok, true} == Cachex.get(:failed_proxy_url_cache, "/huge-file")
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ defmodule Pleroma.SignatureTest do
|
|||
test "it returns error when not found user" do
|
||||
assert capture_log(fn ->
|
||||
{:error, _} = Signature.refetch_public_key(make_fake_conn("https://test-ap_id"))
|
||||
end) =~ "[error] Could not decode user"
|
||||
end) =~ "[debug] Could not decode user"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.AntiLinkSpamPolicyTest do
|
|||
|
||||
assert capture_log(fn ->
|
||||
{:reject, _} = AntiLinkSpamPolicy.filter(message)
|
||||
end) =~ "[error] Could not decode user at fetch http://invalid.actor"
|
||||
end) =~ "[debug] Could not decode user at fetch http://invalid.actor"
|
||||
end
|
||||
|
||||
test "it rejects posts with links" do
|
||||
|
@ -173,7 +173,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.AntiLinkSpamPolicyTest do
|
|||
|
||||
assert capture_log(fn ->
|
||||
{:reject, _} = AntiLinkSpamPolicy.filter(message)
|
||||
end) =~ "[error] Could not decode user at fetch http://invalid.actor"
|
||||
end) =~ "[debug] Could not decode user at fetch http://invalid.actor"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.UndoHandlingTest do
|
|||
|> Jason.decode!()
|
||||
|> Map.put("object", activity.data["object"])
|
||||
|
||||
assert Transmogrifier.handle_incoming(data) == :error
|
||||
assert Transmogrifier.handle_incoming(data) == {:error, :invalid_undo}
|
||||
end
|
||||
|
||||
test "it works for incoming unlikes with an existing like activity" do
|
||||
|
|
|
@ -95,7 +95,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
"target" => new_user.ap_id
|
||||
}
|
||||
|
||||
assert :error = Transmogrifier.handle_incoming(message)
|
||||
assert {:error, :invalid_move} = Transmogrifier.handle_incoming(message)
|
||||
|
||||
{:ok, _new_user} = User.update_and_set_cache(new_user, %{also_known_as: [old_user.ap_id]})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue