HTTPSecurityPlug: Fix tests

This commit is contained in:
Lain Soykaf 2024-05-27 22:13:20 +04:00
parent c67b41415b
commit 81e44ced0c
3 changed files with 4 additions and 4 deletions

View File

@ -154,7 +154,7 @@ config :pleroma, Pleroma.Upload, config_impl: Pleroma.UnstubbedConfigMock
config :pleroma, Pleroma.ScheduledActivity, config_impl: Pleroma.UnstubbedConfigMock config :pleroma, Pleroma.ScheduledActivity, config_impl: Pleroma.UnstubbedConfigMock
config :pleroma, Pleroma.Web.RichMedia.Helpers, config_impl: Pleroma.StaticStubbedConfigMock config :pleroma, Pleroma.Web.RichMedia.Helpers, config_impl: Pleroma.StaticStubbedConfigMock
config :pleroma, Pleroma.Uploaders.IPFS, config_impl: Pleroma.UnstubbedConfigMock config :pleroma, Pleroma.Uploaders.IPFS, config_impl: Pleroma.UnstubbedConfigMock
config :pleroma, Pleroma.Web.Plugs.HTTPSecurityPlug, config_impl: Pleroma.UnstubbedConfigMock config :pleroma, Pleroma.Web.Plugs.HTTPSecurityPlug, config_impl: Pleroma.StaticStubbedConfigMock
peer_module = peer_module =
if String.to_integer(System.otp_release()) >= 25 do if String.to_integer(System.otp_release()) >= 25 do

View File

@ -116,7 +116,7 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlug do
end end
connect_src = connect_src =
if @config_impl.get(:env) == :dev do if @config_impl.get([:env]) == :dev do
[connect_src, " http://localhost:3035/"] [connect_src, " http://localhost:3035/"]
else else
connect_src connect_src
@ -124,7 +124,7 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlug do
script_src = script_src =
if @config_impl.get([:http_security, :allow_unsafe_eval]) do if @config_impl.get([:http_security, :allow_unsafe_eval]) do
if @config_impl.get(:env) == :dev do if @config_impl.get([:env]) == :dev do
"script-src 'self' 'unsafe-eval'" "script-src 'self' 'unsafe-eval'"
else else
"script-src 'self' 'wasm-unsafe-eval'" "script-src 'self' 'wasm-unsafe-eval'"

View File

@ -15,7 +15,7 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlugTest do
end end
defp mock_config(config, additional \\ %{}) do defp mock_config(config, additional \\ %{}) do
Pleroma.UnstubbedConfigMock Pleroma.StaticStubbedConfigMock
|> stub(:get, fn |> stub(:get, fn
[:http_security, key] -> config[key] [:http_security, key] -> config[key]
key -> additional[key] key -> additional[key]