diff options
author | lain <lain@soykaf.club> | 2021-01-26 14:24:32 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2021-01-26 14:24:32 +0000 |
commit | 229acae6c3da541ebb0438cb7f310cdce1df92b3 (patch) | |
tree | 8b93f46ac090021e7e53db392ba54a3c48b31fda /test/support/helpers.ex | |
parent | 71166b30a42ad3a8988049992bcab93c7e2ed656 (diff) | |
parent | 250e2020987b1fc65251ba9564e41b38ba060391 (diff) | |
download | pleroma-229acae6c3da541ebb0438cb7f310cdce1df92b3.tar.gz |
Merge branch 'develop' into '2435-list-multiple-users'
# Conflicts:
# CHANGELOG.md
Diffstat (limited to 'test/support/helpers.ex')
-rw-r--r-- | test/support/helpers.ex | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/support/helpers.ex b/test/support/helpers.ex index 4353d5254..856a6a376 100644 --- a/test/support/helpers.ex +++ b/test/support/helpers.ex @@ -8,6 +8,8 @@ defmodule Pleroma.Tests.Helpers do """ alias Pleroma.Config + require Logger + defmacro clear_config(config_path) do quote do clear_config(unquote(config_path)) do @@ -18,6 +20,7 @@ defmodule Pleroma.Tests.Helpers do defmacro clear_config(config_path, do: yield) do quote do initial_setting = Config.fetch(unquote(config_path)) + unquote(yield) on_exit(fn -> @@ -35,6 +38,15 @@ defmodule Pleroma.Tests.Helpers do end defmacro clear_config(config_path, temp_setting) do + # NOTE: `clear_config([section, key], value)` != `clear_config([section], key: value)` (!) + # Displaying a warning to prevent unintentional clearing of all but one keys in section + if Keyword.keyword?(temp_setting) and length(temp_setting) == 1 do + Logger.warn( + "Please change to `clear_config([section]); clear_config([section, key], value)`: " <> + "#{inspect(config_path)}, #{inspect(temp_setting)}" + ) + end + quote do clear_config(unquote(config_path)) do Config.put(unquote(config_path), unquote(temp_setting)) |