Fix tests that relied on no base_url in the uploader
This commit is contained in:
parent
61621ebdbc
commit
f592090206
3 changed files with 13 additions and 8 deletions
|
@ -381,10 +381,9 @@ def check_uploader_base_url_is_not_base_domain() 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
|
||||
|
|
|
@ -291,7 +291,7 @@ test "check_http_adapter/0" 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 @@ test "check_uploader_base_url_set/0" 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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue