projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert "add _discoverable_ keyword into ActivityPub @context"
[akkoma]
/
test
/
tasks
/
config_test.exs
diff --git
a/test/tasks/config_test.exs
b/test/tasks/config_test.exs
index 83a363356c302c922b03969d0ab794a823946f1e..9cd47380ca9a4e20b6472c8a1f1d28e76fa67d76 100644
(file)
--- a/
test/tasks/config_test.exs
+++ b/
test/tasks/config_test.exs
@@
-1,3
+1,7
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Mix.Tasks.Pleroma.ConfigTest do
use Pleroma.DataCase
alias Pleroma.Repo
defmodule Mix.Tasks.Pleroma.ConfigTest do
use Pleroma.DataCase
alias Pleroma.Repo
@@
-7,21
+11,20
@@
defmodule Mix.Tasks.Pleroma.ConfigTest do
Mix.shell(Mix.Shell.Process)
temp_file = "config/temp.exported_from_db.secret.exs"
Mix.shell(Mix.Shell.Process)
temp_file = "config/temp.exported_from_db.secret.exs"
- dynamic = Pleroma.Config.get([:instance, :dynamic_configuration])
-
- Pleroma.Config.put([:instance, :dynamic_configuration], true)
-
on_exit(fn ->
Mix.shell(Mix.Shell.IO)
Application.delete_env(:pleroma, :first_setting)
Application.delete_env(:pleroma, :second_setting)
on_exit(fn ->
Mix.shell(Mix.Shell.IO)
Application.delete_env(:pleroma, :first_setting)
Application.delete_env(:pleroma, :second_setting)
- Pleroma.Config.put([:instance, :dynamic_configuration], dynamic)
:ok = File.rm(temp_file)
end)
{:ok, temp_file: temp_file}
end
:ok = File.rm(temp_file)
end)
{:ok, temp_file: temp_file}
end
+ clear_config_all([:instance, :dynamic_configuration]) do
+ Pleroma.Config.put([:instance, :dynamic_configuration], true)
+ end
+
test "settings are migrated to db" do
assert Repo.all(Config) == []
test "settings are migrated to db" do
assert Repo.all(Config) == []
@@
-30,8
+33,8
@@
defmodule Mix.Tasks.Pleroma.ConfigTest do
Mix.Tasks.Pleroma.Config.run(["migrate_to_db"])
Mix.Tasks.Pleroma.Config.run(["migrate_to_db"])
- first_db = Config.get_by_params(%{group: "pleroma", key: "first_setting"})
- second_db = Config.get_by_params(%{group: "pleroma", key: "second_setting"})
+ first_db = Config.get_by_params(%{group: "pleroma", key: "
:
first_setting"})
+ second_db = Config.get_by_params(%{group: "pleroma", key: "
:
second_setting"})
refute Config.get_by_params(%{group: "pleroma", key: "Pleroma.Repo"})
assert Config.from_binary(first_db.value) == [key: "value", key2: [Pleroma.Repo]]
refute Config.get_by_params(%{group: "pleroma", key: "Pleroma.Repo"})
assert Config.from_binary(first_db.value) == [key: "value", key2: [Pleroma.Repo]]
@@
-41,13
+44,13
@@
defmodule Mix.Tasks.Pleroma.ConfigTest do
test "settings are migrated to file and deleted from db", %{temp_file: temp_file} do
Config.create(%{
group: "pleroma",
test "settings are migrated to file and deleted from db", %{temp_file: temp_file} do
Config.create(%{
group: "pleroma",
- key: "setting_first",
+ key: "
:
setting_first",
value: [key: "value", key2: [Pleroma.Activity]]
})
Config.create(%{
group: "pleroma",
value: [key: "value", key2: [Pleroma.Activity]]
})
Config.create(%{
group: "pleroma",
- key: "setting_second",
+ key: "
:
setting_second",
value: [key: "valu2", key2: [Pleroma.Repo]]
})
value: [key: "valu2", key2: [Pleroma.Repo]]
})
@@
-57,7
+60,7
@@
defmodule Mix.Tasks.Pleroma.ConfigTest do
assert File.exists?(temp_file)
{:ok, file} = File.read(temp_file)
assert File.exists?(temp_file)
{:ok, file} = File.read(temp_file)
- assert file =~ "config :pleroma,
setting_first:
"
- assert file =~ "config :pleroma,
setting_second:
"
+ assert file =~ "config :pleroma,
:setting_first,
"
+ assert file =~ "config :pleroma,
:setting_second,
"
end
end
end
end