diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2019-06-14 15:45:05 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2019-06-14 15:45:05 +0000 |
commit | c2ca1f22a25d22d6d863406ed05b08c643e5824c (patch) | |
tree | bf75fc306788d784d74fb6ca617f3ddd27b75fd2 /test/config | |
parent | b7fc722a2e9e93341229cb122aac605421782295 (diff) | |
download | pleroma-c2ca1f22a25d22d6d863406ed05b08c643e5824c.tar.gz |
it is changed in compile time
we can't change module attributes and endpoint settings in runtime
Diffstat (limited to 'test/config')
-rw-r--r-- | test/config/transfer_task_test.exs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/config/transfer_task_test.exs b/test/config/transfer_task_test.exs new file mode 100644 index 000000000..9b8a8dd45 --- /dev/null +++ b/test/config/transfer_task_test.exs @@ -0,0 +1,35 @@ +defmodule Pleroma.Config.TransferTaskTest do + use Pleroma.DataCase + + setup do + dynamic = Pleroma.Config.get([:instance, :dynamic_configuration]) + + Pleroma.Config.put([:instance, :dynamic_configuration], true) + + on_exit(fn -> + Pleroma.Config.put([:instance, :dynamic_configuration], dynamic) + end) + end + + test "transfer config values from db to env" do + refute Application.get_env(:pleroma, :test_key) + Pleroma.Web.AdminAPI.Config.create(%{key: "test_key", value: [live: 2, com: 3]}) + + Pleroma.Config.TransferTask.start_link() + + assert Application.get_env(:pleroma, :test_key) == [live: 2, com: 3] + + on_exit(fn -> + Application.delete_env(:pleroma, :test_key) + end) + end + + test "non existing atom" do + Pleroma.Web.AdminAPI.Config.create(%{key: "undefined_atom_key", value: [live: 2, com: 3]}) + + assert ExUnit.CaptureLog.capture_log(fn -> + Pleroma.Config.TransferTask.start_link() + end) =~ + "updating env causes error, key: \"undefined_atom_key\", error: %ArgumentError{message: \"argument error\"}" + end +end |