projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'fix/mediaproxy-bypass-emoji' into 'develop'
[akkoma]
/
test
/
web
/
media_proxy
/
media_proxy_test.exs
diff --git
a/test/web/media_proxy/media_proxy_test.exs
b/test/web/media_proxy/media_proxy_test.exs
index 0c94755df348a1c352f02f81fcc6b35cca2f820c..69d2a71a68d2e3a727a9b0e90c58dadb108c75be 100644
(file)
--- a/
test/web/media_proxy/media_proxy_test.exs
+++ b/
test/web/media_proxy/media_proxy_test.exs
@@
-1,17
+1,15
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-20
18
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-20
20
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MediaProxyTest do
use ExUnit.Case
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MediaProxyTest do
use ExUnit.Case
+ use Pleroma.Tests.Helpers
import Pleroma.Web.MediaProxy
alias Pleroma.Web.MediaProxy.MediaProxyController
import Pleroma.Web.MediaProxy
alias Pleroma.Web.MediaProxy.MediaProxyController
- setup do
- enabled = Pleroma.Config.get([:media_proxy, :enabled])
- on_exit(fn -> Pleroma.Config.put([:media_proxy, :enabled], enabled) end)
- :ok
- end
+ setup do: clear_config([:media_proxy, :enabled])
+ setup do: clear_config(Pleroma.Upload)
describe "when enabled" do
setup do
describe "when enabled" do
setup do
@@
-126,15
+124,7
@@
defmodule Pleroma.Web.MediaProxyTest do
end
test "uses the configured base_url" do
end
test "uses the configured base_url" do
- base_url = Pleroma.Config.get([:media_proxy, :base_url])
-
- if base_url do
- on_exit(fn ->
- Pleroma.Config.put([:media_proxy, :base_url], base_url)
- end)
- end
-
- Pleroma.Config.put([:media_proxy, :base_url], "https://cache.pleroma.social")
+ clear_config([:media_proxy, :base_url], "https://cache.pleroma.social")
url = "https://pleroma.soykaf.com/static/logo.png"
encoded = url(url)
url = "https://pleroma.soykaf.com/static/logo.png"
encoded = url(url)
@@
-215,8
+205,8
@@
defmodule Pleroma.Web.MediaProxyTest do
end
test "does not change whitelisted urls" do
end
test "does not change whitelisted urls" do
-
Pleroma.Config.put
([:media_proxy, :whitelist], ["mycdn.akamai.com"])
-
Pleroma.Config.put
([:media_proxy, :base_url], "https://cache.pleroma.social")
+
clear_config
([:media_proxy, :whitelist], ["mycdn.akamai.com"])
+
clear_config
([:media_proxy, :base_url], "https://cache.pleroma.social")
media_url = "https://mycdn.akamai.com"
media_url = "https://mycdn.akamai.com"
@@
-227,7
+217,6
@@
defmodule Pleroma.Web.MediaProxyTest do
end
test "ensure Pleroma.Upload base_url is always whitelisted" do
end
test "ensure Pleroma.Upload base_url is always whitelisted" do
- upload_config = Pleroma.Config.get([Pleroma.Upload])
media_url = "https://media.pleroma.social"
Pleroma.Config.put([Pleroma.Upload, :base_url], media_url)
media_url = "https://media.pleroma.social"
Pleroma.Config.put([Pleroma.Upload, :base_url], media_url)
@@
-235,8
+224,6
@@
defmodule Pleroma.Web.MediaProxyTest do
encoded = url(url)
assert String.starts_with?(encoded, media_url)
encoded = url(url)
assert String.starts_with?(encoded, media_url)
-
- Pleroma.Config.put([Pleroma.Upload], upload_config)
end
end
end
end
end
end