diff options
author | href <href@random.sh> | 2018-11-06 19:34:57 +0100 |
---|---|---|
committer | href <href@random.sh> | 2018-11-06 19:41:15 +0100 |
commit | 5bb88fd1749931e755157760ec833c5d50ebb8c8 (patch) | |
tree | a43e1d2cb7812bd8df741203126e1ca12052c058 /test | |
parent | 25512aa29cae22b73ee45a22954693c1a130ea3e (diff) | |
download | pleroma-5bb88fd1749931e755157760ec833c5d50ebb8c8.tar.gz pleroma-5bb88fd1749931e755157760ec833c5d50ebb8c8.zip |
Runtime configuration
Related to #85
Everything should now be configured at runtime, with the exception of
the `Pleroma.HTML` scrubbers (the scrubbers used can be
changed at runtime, but their configuration is compile-time) because
it's building a module with a macro.
Diffstat (limited to 'test')
-rw-r--r-- | test/config_test.exs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/config_test.exs b/test/config_test.exs index 32d5cc90c..0124544c8 100644 --- a/test/config_test.exs +++ b/test/config_test.exs @@ -4,6 +4,7 @@ defmodule Pleroma.ConfigTest do test "get/1 with an atom" do assert Pleroma.Config.get(:instance) == Application.get_env(:pleroma, :instance) assert Pleroma.Config.get(:azertyuiop) == nil + assert Pleroma.Config.get(:azertyuiop, true) == true end test "get/1 with a list of keys" do @@ -20,6 +21,22 @@ defmodule Pleroma.ConfigTest do ) assert Pleroma.Config.get([:azerty, :uiop]) == nil + assert Pleroma.Config.get([:azerty, :uiop], true) == true + end + + test "get!/1" do + assert Pleroma.Config.get!(:instance) == Application.get_env(:pleroma, :instance) + + assert Pleroma.Config.get!([:instance, :public]) == + Keyword.get(Application.get_env(:pleroma, :instance), :public) + + assert_raise(Pleroma.Config.Error, fn -> + Pleroma.Config.get!(:azertyuiop) + end) + + assert_raise(Pleroma.Config.Error, fn -> + Pleroma.Config.get!([:azerty, :uiop]) + end) end test "put/2 with a key" do |