X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fweb%2Fadmin_api%2Fadmin_api_controller_test.exs;h=02ffbfa0b056c3653a893f8bc2799846bf76bbda;hb=514c899275a32e6ef63305f9424c50344d41b12e;hp=81e346fb8910db71d870a9727683b1f5b7ae75da;hpb=b21e59da5f69505d276ddfa6b00c67a838dcc149;p=akkoma diff --git a/test/web/admin_api/admin_api_controller_test.exs b/test/web/admin_api/admin_api_controller_test.exs index 81e346fb8..02ffbfa0b 100644 --- a/test/web/admin_api/admin_api_controller_test.exs +++ b/test/web/admin_api/admin_api_controller_test.exs @@ -1899,13 +1899,6 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do "To use this endpoint you need to enable configuration from database." end - test "without any settings in db", %{conn: conn} do - conn = get(conn, "/api/pleroma/admin/config") - - assert json_response(conn, 400) == - "To use configuration from database migrate your settings to database." - end - test "with settings only in db", %{conn: conn} do config1 = insert(:config) config2 = insert(:config) @@ -2446,7 +2439,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do "value" => "Tesla.Adapter.Httpc", "db" => [":adapter"] } - ] + ], + "need_reboot" => true } end @@ -2533,7 +2527,6 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do %{"tuple" => [":seconds_valid", 60]}, %{"tuple" => [":path", ""]}, %{"tuple" => [":key1", nil]}, - %{"tuple" => [":partial_chain", "&:hackney_connect.partial_chain/1"]}, %{"tuple" => [":regex1", "~r/https:\/\/example.com/"]}, %{"tuple" => [":regex2", "~r/https:\/\/example.com/u"]}, %{"tuple" => [":regex3", "~r/https:\/\/example.com/i"]}, @@ -2563,7 +2556,6 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do %{"tuple" => [":seconds_valid", 60]}, %{"tuple" => [":path", ""]}, %{"tuple" => [":key1", nil]}, - %{"tuple" => [":partial_chain", "&:hackney_connect.partial_chain/1"]}, %{"tuple" => [":regex1", "~r/https:\\/\\/example.com/"]}, %{"tuple" => [":regex2", "~r/https:\\/\\/example.com/u"]}, %{"tuple" => [":regex3", "~r/https:\\/\\/example.com/i"]}, @@ -2576,7 +2568,6 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do ":seconds_valid", ":path", ":key1", - ":partial_chain", ":regex1", ":regex2", ":regex3", @@ -2590,7 +2581,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do "value" => "Tesla.Adapter.Httpc", "db" => [":adapter"] } - ] + ], + "need_reboot" => true } end @@ -2984,50 +2976,6 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do end end - describe "config mix tasks run" do - setup do - Mix.shell(Mix.Shell.Quiet) - - on_exit(fn -> - Mix.shell(Mix.Shell.IO) - end) - - :ok - end - - clear_config(:configurable_from_database) do - Pleroma.Config.put(:configurable_from_database, true) - end - - clear_config([:feed, :post_title]) do - Pleroma.Config.put([:feed, :post_title], %{max_length: 100, omission: "…"}) - end - - test "transfer settings to DB and to file", %{conn: conn} do - assert Repo.all(Pleroma.ConfigDB) == [] - Mix.Tasks.Pleroma.Config.migrate_to_db("test/fixtures/config/temp.secret.exs") - assert Repo.aggregate(Pleroma.ConfigDB, :count, :id) > 0 - - conn = get(conn, "/api/pleroma/admin/config/migrate_from_db") - - assert json_response(conn, 200) == %{} - assert Repo.all(Pleroma.ConfigDB) == [] - end - - test "returns error if configuration from database is off", %{conn: conn} do - initial = Pleroma.Config.get(:configurable_from_database) - on_exit(fn -> Pleroma.Config.put(:configurable_from_database, initial) end) - Pleroma.Config.put(:configurable_from_database, false) - - conn = get(conn, "/api/pleroma/admin/config/migrate_from_db") - - assert json_response(conn, 400) == - "To use this endpoint you need to enable configuration from database." - - assert Repo.all(Pleroma.ConfigDB) == [] - end - end - describe "GET /api/pleroma/admin/restart" do clear_config(:configurable_from_database) do Pleroma.Config.put(:configurable_from_database, true)