From 3aed111a42472018f01899714305d4f3a5cbc911 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 18 Jun 2024 10:50:31 -0400 Subject: [PATCH] Enable capture_log globally --- test/mix/tasks/pleroma/config_test.exs | 1 - test/pleroma/object/fetcher_test.exs | 1 - test/pleroma/user/backup_async_test.exs | 2 -- test/pleroma/user_test.exs | 2 -- .../web/activity_pub/activity_pub_controller_test.exs | 5 ----- test/pleroma/web/activity_pub/activity_pub_test.exs | 1 - test/pleroma/web/activity_pub/mrf_test.exs | 1 - test/pleroma/web/activity_pub/publisher_test.exs | 1 - test/pleroma/web/activity_pub/relay_test.exs | 1 - .../activity_pub/transmogrifier/announce_handling_test.exs | 2 -- .../web/activity_pub/transmogrifier/delete_handling_test.exs | 1 - .../web/activity_pub/transmogrifier/note_handling_test.exs | 4 ---- test/pleroma/web/activity_pub/transmogrifier_test.exs | 1 - .../web/admin_api/controllers/config_controller_test.exs | 3 --- .../web/mastodon_api/controllers/search_controller_test.exs | 1 - .../mastodon_api/controllers/timeline_controller_test.exs | 2 -- test/pleroma/web/mastodon_api/views/status_view_test.exs | 1 - test/pleroma/web/push/impl_test.exs | 2 -- test/pleroma/web/web_finger_test.exs | 1 - test/test_helper.exs | 2 +- 20 files changed, 1 insertion(+), 34 deletions(-) diff --git a/test/mix/tasks/pleroma/config_test.exs b/test/mix/tasks/pleroma/config_test.exs index 7b2134129..942cfa83d 100644 --- a/test/mix/tasks/pleroma/config_test.exs +++ b/test/mix/tasks/pleroma/config_test.exs @@ -51,7 +51,6 @@ test "error if file with custom settings doesn't exist" do clear_config(:configurable_from_database, true) end - @tag capture_log: true test "config migration refused when deprecated settings are found" do clear_config([:media_proxy, :whitelist], ["domain_without_scheme.com"]) assert config_records() == [] diff --git a/test/pleroma/object/fetcher_test.exs b/test/pleroma/object/fetcher_test.exs index 6f21452a7..6704c18db 100644 --- a/test/pleroma/object/fetcher_test.exs +++ b/test/pleroma/object/fetcher_test.exs @@ -84,7 +84,6 @@ defmodule Pleroma.Object.FetcherTest do :ok end - @tag capture_log: true 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 assert {:ok, _} = diff --git a/test/pleroma/user/backup_async_test.exs b/test/pleroma/user/backup_async_test.exs index 76716d684..b0e9413be 100644 --- a/test/pleroma/user/backup_async_test.exs +++ b/test/pleroma/user/backup_async_test.exs @@ -19,7 +19,6 @@ defmodule Pleroma.User.BackupAsyncTest do %{backup: backup} end - @tag capture_log: true test "it handles unrecoverable exceptions", %{backup: backup} do ProcessorMock |> expect(:do_process, fn _, _ -> @@ -34,7 +33,6 @@ test "it handles unrecoverable exceptions", %{backup: backup} do assert backup.state == :failed end - @tag capture_log: true test "it handles timeouts", %{backup: backup} do ProcessorMock |> expect(:do_process, fn _, _ -> diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index 5b7a65658..99ab90134 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -926,7 +926,6 @@ test "gets an existing user by fully qualified nickname, case insensitive" do assert user == fetched_user end - @tag capture_log: true test "returns nil if no user could be fetched" do {:error, fetched_user} = User.get_or_fetch_by_nickname("nonexistent@social.heldscal.la") assert fetched_user == "not found nonexistent@social.heldscal.la" @@ -983,7 +982,6 @@ test "if nicknames clash, the old user gets a prefix with the old id to the nick assert orig_user.nickname == "#{orig_user.id}.admin@mastodon.example.org" end - @tag capture_log: true test "it returns the old user if stale, but unfetchable" do a_week_ago = NaiveDateTime.add(NaiveDateTime.utc_now(), -604_800) diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index ec4c04c62..043efeda1 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -573,7 +573,6 @@ test "it inserts an incoming activity into the database", %{conn: conn} do assert Activity.get_by_ap_id(data["id"]) end - @tag capture_log: true test "it inserts an incoming activity into the database" <> "even if we can't fetch the user but have it in our db", %{conn: conn} do @@ -657,7 +656,6 @@ test "accept follow activity", %{conn: conn} do assert_receive {:mix_shell, :info, ["https://relay.mastodon.host/actor"]} end - @tag capture_log: true test "without valid signature, " <> "it only accepts Create activities and requires enabled federation", %{conn: conn} do @@ -1080,7 +1078,6 @@ test "it clears `unreachable` federation status of the sender", %{conn: conn, da assert Instances.reachable?(sender_host) end - @tag capture_log: true test "it removes all follower collections but actor's", %{conn: conn} do [actor, recipient] = insert_pair(:user) @@ -1143,7 +1140,6 @@ test "it requires authentication", %{conn: conn} do assert json_response(ret_conn, 200) end - @tag capture_log: true test "forwarded report", %{conn: conn} do admin = insert(:user, is_admin: true) actor = insert(:user, local: false) @@ -1219,7 +1215,6 @@ test "forwarded report", %{conn: conn} do ) end - @tag capture_log: true test "forwarded report from mastodon", %{conn: conn} do admin = insert(:user, is_admin: true) actor = insert(:user, local: false) diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index d278125ee..c3c59df35 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -2705,7 +2705,6 @@ test "allow fetching of accounts with an empty string name field" do assert user.name == " " end - @tag capture_log: true test "pin_data_from_featured_collection will ignore unsupported values" do assert %{} == ActivityPub.pin_data_from_featured_collection(%{ diff --git a/test/pleroma/web/activity_pub/mrf_test.exs b/test/pleroma/web/activity_pub/mrf_test.exs index 3ead73792..25548e3da 100644 --- a/test/pleroma/web/activity_pub/mrf_test.exs +++ b/test/pleroma/web/activity_pub/mrf_test.exs @@ -65,7 +65,6 @@ test "matches are case-insensitive" do refute MRF.subdomain_match?(regexes, "example.com") end - @tag capture_log: true test "logs sensible error on accidental wildcard" do assert_raise Regex.CompileError, fn -> assert capture_log(MRF.subdomains_regex(["*unsafe.tld"])) =~ diff --git a/test/pleroma/web/activity_pub/publisher_test.exs b/test/pleroma/web/activity_pub/publisher_test.exs index 870f1f77a..150b7bb59 100644 --- a/test/pleroma/web/activity_pub/publisher_test.exs +++ b/test/pleroma/web/activity_pub/publisher_test.exs @@ -216,7 +216,6 @@ test "publish to url with with different ports" do refute called(Instances.set_reachable(inbox)) end - @tag capture_log: true test_with_mock "calls `Instances.set_unreachable` on target inbox on non-2xx HTTP response code", Instances, [:passthrough], diff --git a/test/pleroma/web/activity_pub/relay_test.exs b/test/pleroma/web/activity_pub/relay_test.exs index ec9b0f09a..5867246d7 100644 --- a/test/pleroma/web/activity_pub/relay_test.exs +++ b/test/pleroma/web/activity_pub/relay_test.exs @@ -113,7 +113,6 @@ test "returns error when activity not `Create` type" do assert Relay.publish(activity) == {:error, "Not implemented"} end - @tag capture_log: true test "returns error when activity not public" do activity = insert(:direct_note_activity) assert Relay.publish(activity) == {:error, false} diff --git a/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs index 9521cc0ab..f55f42c10 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs @@ -83,7 +83,6 @@ test "it works for incoming announces, fetching the announced object" do assert(Activity.get_create_by_object_ap_id(data["object"])) end - @tag capture_log: true test "it works for incoming announces with an existing activity" do user = insert(:user) {:ok, activity} = CommonAPI.post(user, %{status: "hey"}) @@ -136,7 +135,6 @@ test "it works for incoming announces with an inlined activity" do assert object.data["content"] == "this is a private toot" end - @tag capture_log: true test "it rejects incoming announces with an inlined activity from another origin" do Tesla.Mock.mock(fn %{method: :get} -> %Tesla.Env{status: 404, body: ""} diff --git a/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs index 4a7ff5158..300151fb2 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs @@ -86,7 +86,6 @@ test "it fails for incoming deletes with spoofed origin" do assert match?({:error, _}, Transmogrifier.handle_incoming(data)) end - @tag capture_log: true test "it works for incoming user deletes" do %{ap_id: ap_id} = insert(:user, ap_id: "http://mastodon.example.org/users/admin") diff --git a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs index 2507fa2b0..ed71dcb90 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs @@ -56,7 +56,6 @@ test "it ignores an incoming notice if we already have it" do assert activity == returned_activity end - @tag capture_log: true test "it fetches reply-to activities if we don't have them" do data = File.read!("test/fixtures/mastodon-post-activity.json") @@ -104,7 +103,6 @@ test "it does not fetch reply-to activities beyond max replies depth limit" do end end - @tag capture_log: true test "it does not crash if the object in inReplyTo can't be fetched" do data = File.read!("test/fixtures/mastodon-post-activity.json") @@ -551,7 +549,6 @@ test "returns object with inReplyTo when denied incoming reply", %{data: data} d assert modified_object["inReplyTo"] == [] end - @tag capture_log: true test "returns modified object when allowed incoming reply", %{data: data} do object_with_reply = Map.put( @@ -737,7 +734,6 @@ test "the standalone note uses its own ID when context is missing" do assert modified.data["context"] == object.data["id"] end - @tag capture_log: true 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") diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index a49e459a6..2fb0cd079 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -536,7 +536,6 @@ test "returns nil when cannot normalize object" do end) =~ "Unsupported URI scheme" end - @tag capture_log: true test "returns {:ok, %Object{}} for success case" do assert {:ok, %Object{}} = Transmogrifier.get_obj_helper( diff --git a/test/pleroma/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs index 734aca752..7b65600de 100644 --- a/test/pleroma/web/admin_api/controllers/config_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/config_controller_test.exs @@ -194,7 +194,6 @@ test "POST /api/pleroma/admin/config with configdb disabled", %{conn: conn} do setup do: clear_config(:configurable_from_database, true) - @tag capture_log: true test "create new config setting in db", %{conn: conn} do ueberauth = Application.get_env(:ueberauth, Ueberauth) on_exit(fn -> Application.put_env(:ueberauth, Ueberauth, ueberauth) end) @@ -316,7 +315,6 @@ test "create new config setting in db", %{conn: conn} do assert Application.get_env(:idna, :key5) == {"string", Pleroma.Captcha.NotReal, []} end - @tag capture_log: true test "save configs setting without explicit key", %{conn: conn} do adapter = Application.get_env(:http, :adapter) send_user_agent = Application.get_env(:http, :send_user_agent) @@ -1229,7 +1227,6 @@ test "proxy tuple ip", %{conn: conn} do assert ":proxy_url" in db end - @tag capture_log: true test "doesn't set keys not in the whitelist", %{conn: conn} do clear_config(:database_config_whitelist, [ {:pleroma, :key1}, diff --git a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs index ad4144da4..d38767c96 100644 --- a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs @@ -130,7 +130,6 @@ test "search local-only status as an anonymous user" do assert [] = results["statuses"] end - @tag capture_log: true test "constructs hashtags from search query", %{conn: conn} do results = conn diff --git a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs index c120dd53c..4d646509c 100644 --- a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs @@ -152,7 +152,6 @@ test "filtering", %{conn: conn, user: user} do end describe "public" do - @tag capture_log: true test "the public timeline", %{conn: conn} do user = insert(:user) @@ -791,7 +790,6 @@ test "filtering", %{user: user, conn: conn} do describe "hashtag" do setup do: oauth_access(["n/a"]) - @tag capture_log: true test "hashtag timeline", %{conn: conn} do following = insert(:user) diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs index b341e43d4..f42d9d1c6 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -201,7 +201,6 @@ test "returns the direct conversation id when given the `direct_conversation_id` assert_schema(status, "Status", Pleroma.Web.ApiSpec.spec()) end - @tag capture_log: true test "returns a temporary ap_id based user for activities missing db users" do user = insert(:user) diff --git a/test/pleroma/web/push/impl_test.exs b/test/pleroma/web/push/impl_test.exs index 24bdf37b6..d98bd1040 100644 --- a/test/pleroma/web/push/impl_test.exs +++ b/test/pleroma/web/push/impl_test.exs @@ -71,7 +71,6 @@ test "performs sending notifications" do assert Impl.perform(notif) == {:ok, [:ok, :ok]} end - @tag capture_log: true test "returns error if notif does not match " do assert Impl.perform(%{}) == {:error, :unknown_type} end @@ -80,7 +79,6 @@ test "successful message sending" do assert Impl.push_message(@message, @sub, @api_key, %Subscription{}) == :ok end - @tag capture_log: true test "fail message sending" do assert Impl.push_message( @message, diff --git a/test/pleroma/web/web_finger_test.exs b/test/pleroma/web/web_finger_test.exs index 8a550a6ba..aefe7b0c2 100644 --- a/test/pleroma/web/web_finger_test.exs +++ b/test/pleroma/web/web_finger_test.exs @@ -213,7 +213,6 @@ test "prevents spoofing" do end end - @tag capture_log: true test "prevents forgeries" do Tesla.Mock.mock(fn %{url: "https://fba.ryona.agency/.well-known/webfinger?resource=acct:graf@fba.ryona.agency"} -> diff --git a/test/test_helper.exs b/test/test_helper.exs index a117584ae..4033631eb 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -4,7 +4,7 @@ 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])