Merge branch 'removing-test-errors' into 'develop'
Removing test errors See merge request pleroma/pleroma!1296
This commit is contained in:
commit
49a49d3763
4 changed files with 38 additions and 4 deletions
|
@ -146,7 +146,7 @@ defmodule Pleroma.Web.Salmon do
|
||||||
do: Instances.set_reachable(url)
|
do: Instances.set_reachable(url)
|
||||||
|
|
||||||
Logger.debug(fn -> "Pushed to #{url}, code #{code}" end)
|
Logger.debug(fn -> "Pushed to #{url}, code #{code}" end)
|
||||||
:ok
|
{:ok, code}
|
||||||
else
|
else
|
||||||
e ->
|
e ->
|
||||||
unless params[:unreachable_since], do: Instances.set_reachable(url)
|
unless params[:unreachable_since], do: Instances.set_reachable(url)
|
||||||
|
|
|
@ -5,6 +5,7 @@ defmodule Pleroma.Object.ContainmentTest do
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
|
|
||||||
import Pleroma.Factory
|
import Pleroma.Factory
|
||||||
|
import ExUnit.CaptureLog
|
||||||
|
|
||||||
setup_all do
|
setup_all do
|
||||||
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||||
|
@ -57,7 +58,10 @@ defmodule Pleroma.Object.ContainmentTest do
|
||||||
follower_address: User.ap_followers(%User{nickname: "rye@niu.moe"})
|
follower_address: User.ap_followers(%User{nickname: "rye@niu.moe"})
|
||||||
})
|
})
|
||||||
|
|
||||||
{:error, _} = User.get_or_fetch_by_ap_id("https://n1u.moe/users/rye")
|
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, {:error, :error}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -802,6 +802,30 @@ defmodule HttpRequestMock do
|
||||||
}}
|
}}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def post("http://mastodon.example.org/inbox", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: ""
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def post("https://hubzilla.example.org/inbox", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: ""
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def post("http://gs.example.org/index.php/main/salmon/user/1", _, _, _) do
|
||||||
|
{:ok,
|
||||||
|
%Tesla.Env{
|
||||||
|
status: 200,
|
||||||
|
body: ""
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
def post("http://200.site" <> _, _, _, _) do
|
def post("http://200.site" <> _, _, _, _) do
|
||||||
{:ok,
|
{:ok,
|
||||||
%Tesla.Env{
|
%Tesla.Env{
|
||||||
|
|
|
@ -15,6 +15,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
||||||
alias Pleroma.Web.Websub.WebsubClientSubscription
|
alias Pleroma.Web.Websub.WebsubClientSubscription
|
||||||
|
|
||||||
import Pleroma.Factory
|
import Pleroma.Factory
|
||||||
|
import ExUnit.CaptureLog
|
||||||
alias Pleroma.Web.CommonAPI
|
alias Pleroma.Web.CommonAPI
|
||||||
|
|
||||||
setup_all do
|
setup_all do
|
||||||
|
@ -73,7 +74,9 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
||||||
data
|
data
|
||||||
|> Map.put("object", object)
|
|> Map.put("object", object)
|
||||||
|
|
||||||
{:ok, _returned_activity} = Transmogrifier.handle_incoming(data)
|
assert capture_log(fn ->
|
||||||
|
{:ok, _returned_activity} = Transmogrifier.handle_incoming(data)
|
||||||
|
end) =~ "[error] Couldn't fetch \"\"https://404.site/whatever\"\", error: nil"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it works for incoming notices" do
|
test "it works for incoming notices" do
|
||||||
|
@ -516,7 +519,10 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
||||||
data
|
data
|
||||||
|> Map.put("object", object)
|
|> Map.put("object", object)
|
||||||
|
|
||||||
:error = Transmogrifier.handle_incoming(data)
|
assert capture_log(fn ->
|
||||||
|
:error = Transmogrifier.handle_incoming(data)
|
||||||
|
end) =~
|
||||||
|
"[error] Could not decode user at fetch http://mastodon.example.org/users/gargron, {:error, {:error, :nxdomain}}"
|
||||||
|
|
||||||
assert Activity.get_by_id(activity.id)
|
assert Activity.get_by_id(activity.id)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue