1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Config.TransferTaskTest do
10 clear_config(:configurable_from_database) do
11 Pleroma.Config.put(:configurable_from_database, true)
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)
17 refute Application.get_env(:quack, :test_key)
22 value: [live: 2, com: 3]
28 value: [live: 15, com: 35]
34 value: [:test_value1, :test_value2]
37 Pleroma.Config.TransferTask.start_link([])
39 assert Application.get_env(:pleroma, :test_key) == [live: 2, com: 3]
40 assert Application.get_env(:idna, :test_key) == [live: 15, com: 35]
41 assert Application.get_env(:quack, :test_key) == [:test_value1, :test_value2]
44 Application.delete_env(:pleroma, :test_key)
45 Application.delete_env(:idna, :test_key)
46 Application.delete_env(:quack, :test_key)
50 test "non existing atom" do
53 key: ":undefined_atom_key",
54 value: [live: 2, com: 3]
57 assert ExUnit.CaptureLog.capture_log(fn ->
58 Pleroma.Config.TransferTask.start_link([])
60 "updating env causes error, key: \":undefined_atom_key\", error: %ArgumentError{message: \"argument error\"}"