Enable capture_log globally

This commit is contained in:
Mark Felder 2024-06-18 10:50:31 -04:00
parent cbf8f8ac0d
commit 3aed111a42
20 changed files with 1 additions and 34 deletions

View File

@ -51,7 +51,6 @@ defmodule Mix.Tasks.Pleroma.ConfigTest do
clear_config(:configurable_from_database, true) clear_config(:configurable_from_database, true)
end end
@tag capture_log: true
test "config migration refused when deprecated settings are found" do test "config migration refused when deprecated settings are found" do
clear_config([:media_proxy, :whitelist], ["domain_without_scheme.com"]) clear_config([:media_proxy, :whitelist], ["domain_without_scheme.com"])
assert config_records() == [] assert config_records() == []

View File

@ -84,7 +84,6 @@ defmodule Pleroma.Object.FetcherTest do
:ok :ok
end end
@tag capture_log: true
test "it works when fetching the OP actor errors out" do test "it works when fetching the OP actor errors out" do
# Here we simulate a case where the author of the OP can't be read # Here we simulate a case where the author of the OP can't be read
assert {:ok, _} = assert {:ok, _} =

View File

@ -19,7 +19,6 @@ defmodule Pleroma.User.BackupAsyncTest do
%{backup: backup} %{backup: backup}
end end
@tag capture_log: true
test "it handles unrecoverable exceptions", %{backup: backup} do test "it handles unrecoverable exceptions", %{backup: backup} do
ProcessorMock ProcessorMock
|> expect(:do_process, fn _, _ -> |> expect(:do_process, fn _, _ ->
@ -34,7 +33,6 @@ defmodule Pleroma.User.BackupAsyncTest do
assert backup.state == :failed assert backup.state == :failed
end end
@tag capture_log: true
test "it handles timeouts", %{backup: backup} do test "it handles timeouts", %{backup: backup} do
ProcessorMock ProcessorMock
|> expect(:do_process, fn _, _ -> |> expect(:do_process, fn _, _ ->

View File

@ -926,7 +926,6 @@ defmodule Pleroma.UserTest do
assert user == fetched_user assert user == fetched_user
end end
@tag capture_log: true
test "returns nil if no user could be fetched" do test "returns nil if no user could be fetched" do
{:error, fetched_user} = User.get_or_fetch_by_nickname("nonexistent@social.heldscal.la") {:error, fetched_user} = User.get_or_fetch_by_nickname("nonexistent@social.heldscal.la")
assert fetched_user == "not found nonexistent@social.heldscal.la" assert fetched_user == "not found nonexistent@social.heldscal.la"
@ -983,7 +982,6 @@ defmodule Pleroma.UserTest do
assert orig_user.nickname == "#{orig_user.id}.admin@mastodon.example.org" assert orig_user.nickname == "#{orig_user.id}.admin@mastodon.example.org"
end end
@tag capture_log: true
test "it returns the old user if stale, but unfetchable" do test "it returns the old user if stale, but unfetchable" do
a_week_ago = NaiveDateTime.add(NaiveDateTime.utc_now(), -604_800) a_week_ago = NaiveDateTime.add(NaiveDateTime.utc_now(), -604_800)

View File

@ -573,7 +573,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
assert Activity.get_by_ap_id(data["id"]) assert Activity.get_by_ap_id(data["id"])
end end
@tag capture_log: true
test "it inserts an incoming activity into the database" <> test "it inserts an incoming activity into the database" <>
"even if we can't fetch the user but have it in our db", "even if we can't fetch the user but have it in our db",
%{conn: conn} do %{conn: conn} do
@ -657,7 +656,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
assert_receive {:mix_shell, :info, ["https://relay.mastodon.host/actor"]} assert_receive {:mix_shell, :info, ["https://relay.mastodon.host/actor"]}
end end
@tag capture_log: true
test "without valid signature, " <> test "without valid signature, " <>
"it only accepts Create activities and requires enabled federation", "it only accepts Create activities and requires enabled federation",
%{conn: conn} do %{conn: conn} do
@ -1080,7 +1078,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
assert Instances.reachable?(sender_host) assert Instances.reachable?(sender_host)
end end
@tag capture_log: true
test "it removes all follower collections but actor's", %{conn: conn} do test "it removes all follower collections but actor's", %{conn: conn} do
[actor, recipient] = insert_pair(:user) [actor, recipient] = insert_pair(:user)
@ -1143,7 +1140,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
assert json_response(ret_conn, 200) assert json_response(ret_conn, 200)
end end
@tag capture_log: true
test "forwarded report", %{conn: conn} do test "forwarded report", %{conn: conn} do
admin = insert(:user, is_admin: true) admin = insert(:user, is_admin: true)
actor = insert(:user, local: false) actor = insert(:user, local: false)
@ -1219,7 +1215,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do
) )
end end
@tag capture_log: true
test "forwarded report from mastodon", %{conn: conn} do test "forwarded report from mastodon", %{conn: conn} do
admin = insert(:user, is_admin: true) admin = insert(:user, is_admin: true)
actor = insert(:user, local: false) actor = insert(:user, local: false)

View File

@ -2705,7 +2705,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
assert user.name == " " assert user.name == " "
end end
@tag capture_log: true
test "pin_data_from_featured_collection will ignore unsupported values" do test "pin_data_from_featured_collection will ignore unsupported values" do
assert %{} == assert %{} ==
ActivityPub.pin_data_from_featured_collection(%{ ActivityPub.pin_data_from_featured_collection(%{

View File

@ -65,7 +65,6 @@ defmodule Pleroma.Web.ActivityPub.MRFTest do
refute MRF.subdomain_match?(regexes, "example.com") refute MRF.subdomain_match?(regexes, "example.com")
end end
@tag capture_log: true
test "logs sensible error on accidental wildcard" do test "logs sensible error on accidental wildcard" do
assert_raise Regex.CompileError, fn -> assert_raise Regex.CompileError, fn ->
assert capture_log(MRF.subdomains_regex(["*unsafe.tld"])) =~ assert capture_log(MRF.subdomains_regex(["*unsafe.tld"])) =~

View File

@ -216,7 +216,6 @@ defmodule Pleroma.Web.ActivityPub.PublisherTest do
refute called(Instances.set_reachable(inbox)) refute called(Instances.set_reachable(inbox))
end end
@tag capture_log: true
test_with_mock "calls `Instances.set_unreachable` on target inbox on non-2xx HTTP response code", test_with_mock "calls `Instances.set_unreachable` on target inbox on non-2xx HTTP response code",
Instances, Instances,
[:passthrough], [:passthrough],

View File

@ -113,7 +113,6 @@ defmodule Pleroma.Web.ActivityPub.RelayTest do
assert Relay.publish(activity) == {:error, "Not implemented"} assert Relay.publish(activity) == {:error, "Not implemented"}
end end
@tag capture_log: true
test "returns error when activity not public" do test "returns error when activity not public" do
activity = insert(:direct_note_activity) activity = insert(:direct_note_activity)
assert Relay.publish(activity) == {:error, false} assert Relay.publish(activity) == {:error, false}

View File

@ -83,7 +83,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AnnounceHandlingTest do
assert(Activity.get_create_by_object_ap_id(data["object"])) assert(Activity.get_create_by_object_ap_id(data["object"]))
end end
@tag capture_log: true
test "it works for incoming announces with an existing activity" do test "it works for incoming announces with an existing activity" do
user = insert(:user) user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{status: "hey"}) {:ok, activity} = CommonAPI.post(user, %{status: "hey"})
@ -136,7 +135,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AnnounceHandlingTest do
assert object.data["content"] == "this is a private toot" assert object.data["content"] == "this is a private toot"
end end
@tag capture_log: true
test "it rejects incoming announces with an inlined activity from another origin" do test "it rejects incoming announces with an inlined activity from another origin" do
Tesla.Mock.mock(fn Tesla.Mock.mock(fn
%{method: :get} -> %Tesla.Env{status: 404, body: ""} %{method: :get} -> %Tesla.Env{status: 404, body: ""}

View File

@ -86,7 +86,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.DeleteHandlingTest do
assert match?({:error, _}, Transmogrifier.handle_incoming(data)) assert match?({:error, _}, Transmogrifier.handle_incoming(data))
end end
@tag capture_log: true
test "it works for incoming user deletes" do test "it works for incoming user deletes" do
%{ap_id: ap_id} = insert(:user, ap_id: "http://mastodon.example.org/users/admin") %{ap_id: ap_id} = insert(:user, ap_id: "http://mastodon.example.org/users/admin")

View File

@ -56,7 +56,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
assert activity == returned_activity assert activity == returned_activity
end end
@tag capture_log: true
test "it fetches reply-to activities if we don't have them" do test "it fetches reply-to activities if we don't have them" do
data = data =
File.read!("test/fixtures/mastodon-post-activity.json") File.read!("test/fixtures/mastodon-post-activity.json")
@ -104,7 +103,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
end end
end end
@tag capture_log: true
test "it does not crash if the object in inReplyTo can't be fetched" do test "it does not crash if the object in inReplyTo can't be fetched" do
data = data =
File.read!("test/fixtures/mastodon-post-activity.json") File.read!("test/fixtures/mastodon-post-activity.json")
@ -551,7 +549,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
assert modified_object["inReplyTo"] == [] assert modified_object["inReplyTo"] == []
end end
@tag capture_log: true
test "returns modified object when allowed incoming reply", %{data: data} do test "returns modified object when allowed incoming reply", %{data: data} do
object_with_reply = object_with_reply =
Map.put( Map.put(
@ -737,7 +734,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
assert modified.data["context"] == object.data["id"] assert modified.data["context"] == object.data["id"]
end end
@tag capture_log: true
test "the reply note uses its parent's ID when context is missing and reply is unreachable" do test "the reply note uses its parent's ID when context is missing and reply is unreachable" do
insert(:user, ap_id: "https://mk.absturztau.be/users/8ozbzjs3o8") insert(:user, ap_id: "https://mk.absturztau.be/users/8ozbzjs3o8")

View File

@ -536,7 +536,6 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
end) =~ "Unsupported URI scheme" end) =~ "Unsupported URI scheme"
end end
@tag capture_log: true
test "returns {:ok, %Object{}} for success case" do test "returns {:ok, %Object{}} for success case" do
assert {:ok, %Object{}} = assert {:ok, %Object{}} =
Transmogrifier.get_obj_helper( Transmogrifier.get_obj_helper(

View File

@ -194,7 +194,6 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do
setup do: clear_config(:configurable_from_database, true) setup do: clear_config(:configurable_from_database, true)
@tag capture_log: true
test "create new config setting in db", %{conn: conn} do test "create new config setting in db", %{conn: conn} do
ueberauth = Application.get_env(:ueberauth, Ueberauth) ueberauth = Application.get_env(:ueberauth, Ueberauth)
on_exit(fn -> Application.put_env(:ueberauth, Ueberauth, ueberauth) end) on_exit(fn -> Application.put_env(:ueberauth, Ueberauth, ueberauth) end)
@ -316,7 +315,6 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do
assert Application.get_env(:idna, :key5) == {"string", Pleroma.Captcha.NotReal, []} assert Application.get_env(:idna, :key5) == {"string", Pleroma.Captcha.NotReal, []}
end end
@tag capture_log: true
test "save configs setting without explicit key", %{conn: conn} do test "save configs setting without explicit key", %{conn: conn} do
adapter = Application.get_env(:http, :adapter) adapter = Application.get_env(:http, :adapter)
send_user_agent = Application.get_env(:http, :send_user_agent) send_user_agent = Application.get_env(:http, :send_user_agent)
@ -1229,7 +1227,6 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do
assert ":proxy_url" in db assert ":proxy_url" in db
end end
@tag capture_log: true
test "doesn't set keys not in the whitelist", %{conn: conn} do test "doesn't set keys not in the whitelist", %{conn: conn} do
clear_config(:database_config_whitelist, [ clear_config(:database_config_whitelist, [
{:pleroma, :key1}, {:pleroma, :key1},

View File

@ -130,7 +130,6 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do
assert [] = results["statuses"] assert [] = results["statuses"]
end end
@tag capture_log: true
test "constructs hashtags from search query", %{conn: conn} do test "constructs hashtags from search query", %{conn: conn} do
results = results =
conn conn

View File

@ -152,7 +152,6 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
end end
describe "public" do describe "public" do
@tag capture_log: true
test "the public timeline", %{conn: conn} do test "the public timeline", %{conn: conn} do
user = insert(:user) user = insert(:user)
@ -791,7 +790,6 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do
describe "hashtag" do describe "hashtag" do
setup do: oauth_access(["n/a"]) setup do: oauth_access(["n/a"])
@tag capture_log: true
test "hashtag timeline", %{conn: conn} do test "hashtag timeline", %{conn: conn} do
following = insert(:user) following = insert(:user)

View File

@ -201,7 +201,6 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
assert_schema(status, "Status", Pleroma.Web.ApiSpec.spec()) assert_schema(status, "Status", Pleroma.Web.ApiSpec.spec())
end end
@tag capture_log: true
test "returns a temporary ap_id based user for activities missing db users" do test "returns a temporary ap_id based user for activities missing db users" do
user = insert(:user) user = insert(:user)

View File

@ -71,7 +71,6 @@ defmodule Pleroma.Web.Push.ImplTest do
assert Impl.perform(notif) == {:ok, [:ok, :ok]} assert Impl.perform(notif) == {:ok, [:ok, :ok]}
end end
@tag capture_log: true
test "returns error if notif does not match " do test "returns error if notif does not match " do
assert Impl.perform(%{}) == {:error, :unknown_type} assert Impl.perform(%{}) == {:error, :unknown_type}
end end
@ -80,7 +79,6 @@ defmodule Pleroma.Web.Push.ImplTest do
assert Impl.push_message(@message, @sub, @api_key, %Subscription{}) == :ok assert Impl.push_message(@message, @sub, @api_key, %Subscription{}) == :ok
end end
@tag capture_log: true
test "fail message sending" do test "fail message sending" do
assert Impl.push_message( assert Impl.push_message(
@message, @message,

View File

@ -213,7 +213,6 @@ defmodule Pleroma.Web.WebFingerTest do
end end
end end
@tag capture_log: true
test "prevents forgeries" do test "prevents forgeries" do
Tesla.Mock.mock(fn Tesla.Mock.mock(fn
%{url: "https://fba.ryona.agency/.well-known/webfinger?resource=acct:graf@fba.ryona.agency"} -> %{url: "https://fba.ryona.agency/.well-known/webfinger?resource=acct:graf@fba.ryona.agency"} ->

View File

@ -4,7 +4,7 @@
Code.put_compiler_option(:warnings_as_errors, true) Code.put_compiler_option(:warnings_as_errors, true)
ExUnit.configure(max_cases: System.schedulers_online()) ExUnit.configure(capture_log: true, max_cases: System.schedulers_online())
ExUnit.start(exclude: [:federated, :erratic]) ExUnit.start(exclude: [:federated, :erratic])