diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-01-17 11:45:44 +0300 |
---|---|---|
committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-01-17 11:45:44 +0300 |
commit | 60ba2339a244290f7353e8026032b1a5d185227c (patch) | |
tree | 9ae4ffdc87b7acd8c2ab093d6363545604a5501d /test/tasks | |
parent | 29155137fdae15fccfaa68fb9c954e98078ce0c4 (diff) | |
download | pleroma-60ba2339a244290f7353e8026032b1a5d185227c.tar.gz |
saving to DB only added by user settings
Diffstat (limited to 'test/tasks')
-rw-r--r-- | test/tasks/config_test.exs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/tasks/config_test.exs b/test/tasks/config_test.exs index 7759f0586..ff921ecfa 100644 --- a/test/tasks/config_test.exs +++ b/test/tasks/config_test.exs @@ -4,6 +4,9 @@ defmodule Mix.Tasks.Pleroma.ConfigTest do use Pleroma.DataCase + + import ExUnit.CaptureLog + alias Pleroma.ConfigDB alias Pleroma.Repo @@ -23,16 +26,17 @@ defmodule Mix.Tasks.Pleroma.ConfigTest do Pleroma.Config.put(:configurable_from_database, true) end + test "warning if file with custom settings doesn't exist" do + assert capture_log(fn -> Mix.Tasks.Pleroma.Config.run(["migrate_to_db"]) end) =~ + "to migrate settings, you must define custom settings in config/test.secret.exs" + end + test "settings are migrated to db" do initial = Application.get_env(:quack, :level) on_exit(fn -> Application.put_env(:quack, :level, initial) end) assert Repo.all(ConfigDB) == [] - Application.put_env(:pleroma, :first_setting, key: "value", key2: [Repo]) - Application.put_env(:pleroma, :second_setting, key: "value2", key2: ["Activity"]) - Application.put_env(:quack, :level, :info) - - Mix.Tasks.Pleroma.Config.run(["migrate_to_db"]) + Mix.Tasks.Pleroma.Config.migrate_to_db("test/fixtures/config/temp.secret.exs") config1 = ConfigDB.get_by_params(%{group: ":pleroma", key: ":first_setting"}) config2 = ConfigDB.get_by_params(%{group: ":pleroma", key: ":second_setting"}) |