summaryrefslogtreecommitdiff
path: root/test/mix/tasks
diff options
context:
space:
mode:
authorAlex Gleason <alex@alexgleason.me>2021-05-14 09:09:32 -0500
committerAlex Gleason <alex@alexgleason.me>2021-05-14 09:09:32 -0500
commitbcf6efce15f76f4796ee51639ea0f8d0299efa0b (patch)
tree24b187685f1a72d699d34c48ba1d2202c353dd40 /test/mix/tasks
parent543e9402d64bce556f85294f91dc690c9acec51f (diff)
parent5a57b025c7745ebdc7ecf8c7d6b75bcc6770562a (diff)
downloadpleroma-bcf6efce15f76f4796ee51639ea0f8d0299efa0b.tar.gz
pleroma-bcf6efce15f76f4796ee51639ea0f8d0299efa0b.zip
Merge remote-tracking branch 'upstream/attachment-meta' into blurhash
Diffstat (limited to 'test/mix/tasks')
-rw-r--r--test/mix/tasks/pleroma/config_test.exs38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/mix/tasks/pleroma/config_test.exs b/test/mix/tasks/pleroma/config_test.exs
index 21f8f2286..3ed1e94b8 100644
--- a/test/mix/tasks/pleroma/config_test.exs
+++ b/test/mix/tasks/pleroma/config_test.exs
@@ -200,6 +200,44 @@ defmodule Mix.Tasks.Pleroma.ConfigTest do
end
end
+ describe "migrate_from_db/1" do
+ setup do: clear_config(:configurable_from_database, true)
+
+ setup do
+ insert_config_record(:pleroma, :setting_first, key: "value", key2: ["Activity"])
+ insert_config_record(:pleroma, :setting_second, key: "value2", key2: [Repo])
+ insert_config_record(:quack, :level, :info)
+
+ path = "test/instance_static"
+ file_path = Path.join(path, "temp.exported_from_db.secret.exs")
+
+ on_exit(fn -> File.rm!(file_path) end)
+
+ [file_path: file_path]
+ end
+
+ test "with path parameter", %{file_path: file_path} do
+ MixTask.run(["migrate_from_db", "--env", "temp", "--path", Path.dirname(file_path)])
+
+ file = File.read!(file_path)
+ assert file =~ "config :pleroma, :setting_first,"
+ assert file =~ "config :pleroma, :setting_second,"
+ assert file =~ "config :quack, :level, :info"
+ end
+
+ test "release", %{file_path: file_path} do
+ clear_config(:release, true)
+ clear_config(:config_path, file_path)
+
+ MixTask.run(["migrate_from_db", "--env", "temp"])
+
+ file = File.read!(file_path)
+ assert file =~ "config :pleroma, :setting_first,"
+ assert file =~ "config :pleroma, :setting_second,"
+ assert file =~ "config :quack, :level, :info"
+ end
+ end
+
describe "operations on database config" do
setup do: clear_config(:configurable_from_database, true)