1 defmodule Pleroma.Config.TransferTaskTest do
5 dynamic = Pleroma.Config.get([:instance, :dynamic_configuration])
7 Pleroma.Config.put([:instance, :dynamic_configuration], true)
10 Pleroma.Config.put([:instance, :dynamic_configuration], dynamic)
14 test "transfer config values from db to env" do
15 refute Application.get_env(:pleroma, :test_key)
16 refute Application.get_env(:idna, :test_key)
18 Pleroma.Web.AdminAPI.Config.create(%{
21 value: [live: 2, com: 3]
24 Pleroma.Web.AdminAPI.Config.create(%{
27 value: [live: 15, com: 35]
30 Pleroma.Config.TransferTask.start_link()
32 assert Application.get_env(:pleroma, :test_key) == [live: 2, com: 3]
33 assert Application.get_env(:idna, :test_key) == [live: 15, com: 35]
36 Application.delete_env(:pleroma, :test_key)
37 Application.delete_env(:idna, :test_key)
41 test "non existing atom" do
42 Pleroma.Web.AdminAPI.Config.create(%{
44 key: "undefined_atom_key",
45 value: [live: 2, com: 3]
48 assert ExUnit.CaptureLog.capture_log(fn ->
49 Pleroma.Config.TransferTask.start_link()
51 "updating env causes error, key: \"undefined_atom_key\", error: %ArgumentError{message: \"argument error\"}"