MediaProxyTest: Fix test
This commit is contained in:
parent
5a95847c5d
commit
5530c7dca4
@ -7,9 +7,19 @@ defmodule Pleroma.Web.MediaProxyTest do
|
|||||||
use Pleroma.Tests.Helpers
|
use Pleroma.Tests.Helpers
|
||||||
|
|
||||||
alias Pleroma.Config
|
alias Pleroma.Config
|
||||||
|
alias Pleroma.UnstubbedConfigMock, as: ConfigMock
|
||||||
alias Pleroma.Web.Endpoint
|
alias Pleroma.Web.Endpoint
|
||||||
alias Pleroma.Web.MediaProxy
|
alias Pleroma.Web.MediaProxy
|
||||||
|
|
||||||
|
import Mox
|
||||||
|
|
||||||
|
setup do
|
||||||
|
ConfigMock
|
||||||
|
|> stub_with(Pleroma.Test.StaticConfig)
|
||||||
|
|
||||||
|
:ok
|
||||||
|
end
|
||||||
|
|
||||||
defp decode_result(encoded) do
|
defp decode_result(encoded) do
|
||||||
{:ok, decoded} = MediaProxy.decode_url(encoded)
|
{:ok, decoded} = MediaProxy.decode_url(encoded)
|
||||||
decoded
|
decoded
|
||||||
@ -222,7 +232,12 @@ defmodule Pleroma.Web.MediaProxyTest do
|
|||||||
|
|
||||||
test "ensure Pleroma.Upload base_url is always whitelisted" do
|
test "ensure Pleroma.Upload base_url is always whitelisted" do
|
||||||
media_url = "https://media.pleroma.social"
|
media_url = "https://media.pleroma.social"
|
||||||
clear_config([Pleroma.Upload, :base_url], media_url)
|
|
||||||
|
ConfigMock
|
||||||
|
|> stub(:get, fn
|
||||||
|
[Pleroma.Upload, :base_url] -> media_url
|
||||||
|
path -> Pleroma.Test.StaticConfig.get(path)
|
||||||
|
end)
|
||||||
|
|
||||||
url = "#{media_url}/static/logo.png"
|
url = "#{media_url}/static/logo.png"
|
||||||
encoded = MediaProxy.url(url)
|
encoded = MediaProxy.url(url)
|
||||||
|
Loading…
Reference in New Issue
Block a user