From f592090206501ba91b370c80a2bf1c5ea540072a Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Tue, 2 Apr 2024 11:23:57 +0100 Subject: [PATCH] Fix tests that relied on no base_url in the uploader --- lib/pleroma/config/deprecation_warnings.ex | 7 +++---- test/pleroma/config/deprecation_warnings_test.exs | 12 ++++++++---- test/pleroma/web/plugs/http_security_plug_test.exs | 2 ++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/pleroma/config/deprecation_warnings.ex b/lib/pleroma/config/deprecation_warnings.ex index d7c64ea2a..d07f3dfe8 100644 --- a/lib/pleroma/config/deprecation_warnings.ex +++ b/lib/pleroma/config/deprecation_warnings.ex @@ -381,10 +381,9 @@ defmodule Pleroma.Config.DeprecationWarnings do It is HIGHLY recommended that you migrate your media uploads to a subdomain at your earliest convenience """) - - :error - else - :ok end + + # This isn't actually an error condition, just a warning + :ok end end diff --git a/test/pleroma/config/deprecation_warnings_test.exs b/test/pleroma/config/deprecation_warnings_test.exs index 7e2e04e6a..4b90a4c24 100644 --- a/test/pleroma/config/deprecation_warnings_test.exs +++ b/test/pleroma/config/deprecation_warnings_test.exs @@ -291,7 +291,7 @@ defmodule Pleroma.Config.DeprecationWarningsTest do end test "check_uploader_base_url_set/0" do - clear_config([Pleroma.Upload], base_url: nil) + clear_config([Pleroma.Upload, :base_url], nil) # we need to capture the error assert_raise ArgumentError, fn -> @@ -300,24 +300,28 @@ defmodule Pleroma.Config.DeprecationWarningsTest do end) =~ "Your config does not specify a base_url for uploads!" end - clear_config([Pleroma.Upload], base_url: "https://example.com") + clear_config([Pleroma.Upload, :base_url], "https://example.com") refute capture_log(fn -> DeprecationWarnings.check_uploader_base_url_set() end) =~ "Your config does not specify a base_url for uploads!" + + clear_config([Pleroma.Upload, :base_url]) end test "check_uploader_base_url_is_not_base_domain/0" do - clear_config([Pleroma.Upload], base_url: "http://localhost") + clear_config([Pleroma.Upload, :base_url], "http://localhost") assert capture_log(fn -> DeprecationWarnings.check_uploader_base_url_is_not_base_domain() end) =~ "Your Akkoma Host and your Upload base_url's host are the same!" - clear_config([Pleroma.Upload], base_url: "https://media.localhost") + clear_config([Pleroma.Upload, :base_url], "https://media.localhost") refute capture_log(fn -> DeprecationWarnings.check_uploader_base_url_is_not_base_domain() end) =~ "Your Akkoma Host and your Upload base_url's host are the same!" + + clear_config([Pleroma.Upload, :base_url]) end end diff --git a/test/pleroma/web/plugs/http_security_plug_test.exs b/test/pleroma/web/plugs/http_security_plug_test.exs index 3c029b9b2..bd8207ae0 100644 --- a/test/pleroma/web/plugs/http_security_plug_test.exs +++ b/test/pleroma/web/plugs/http_security_plug_test.exs @@ -7,6 +7,8 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlugTest do alias Plug.Conn + setup_all do: clear_config([Pleroma.Upload, :base_url], nil) + describe "http security enabled" do setup do: clear_config([:http_security, :enabled], true)