X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fpleroma%2Fweb%2Fadmin_api%2Fcontrollers%2Fconfig_controller_test.exs;h=7c786c389c248f333263e9982e0fcf532ba69204;hb=3674179b26b3351e34f527b7e267a5ff0f551c2e;hp=c4d07d61c8a4fdf002e5e4f3475d23ccab272a7c;hpb=d2a03d3c86be86f2a131f7da0c62c9f46ca521a7;p=akkoma diff --git a/test/pleroma/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs index c4d07d61c..7c786c389 100644 --- a/test/pleroma/web/admin_api/controllers/config_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/config_controller_test.exs @@ -409,7 +409,7 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do end test "saving config which need pleroma reboot", %{conn: conn} do - clear_config([:chat, :enabled], true) + clear_config([:shout, :enabled], true) assert conn |> put_req_header("content-type", "application/json") @@ -417,7 +417,7 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do "/api/pleroma/admin/config", %{ configs: [ - %{group: ":pleroma", key: ":chat", value: [%{"tuple" => [":enabled", true]}]} + %{group: ":pleroma", key: ":shout", value: [%{"tuple" => [":enabled", true]}]} ] } ) @@ -426,7 +426,7 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do %{ "db" => [":enabled"], "group" => ":pleroma", - "key" => ":chat", + "key" => ":shout", "value" => [%{"tuple" => [":enabled", true]}] } ], @@ -454,7 +454,7 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do end test "update setting which need reboot, don't change reboot flag until reboot", %{conn: conn} do - clear_config([:chat, :enabled], true) + clear_config([:shout, :enabled], true) assert conn |> put_req_header("content-type", "application/json") @@ -462,7 +462,7 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do "/api/pleroma/admin/config", %{ configs: [ - %{group: ":pleroma", key: ":chat", value: [%{"tuple" => [":enabled", true]}]} + %{group: ":pleroma", key: ":shout", value: [%{"tuple" => [":enabled", true]}]} ] } ) @@ -471,7 +471,7 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do %{ "db" => [":enabled"], "group" => ":pleroma", - "key" => ":chat", + "key" => ":shout", "value" => [%{"tuple" => [":enabled", true]}] } ], @@ -1427,30 +1427,61 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do ] } - res = - assert conn - |> put_req_header("content-type", "application/json") - |> post("/api/pleroma/admin/config", %{"configs" => [params]}) - |> json_response_and_validate_schema(200) + assert conn + |> put_req_header("content-type", "application/json") + |> post("/api/pleroma/admin/config", %{"configs" => [params]}) + |> json_response_and_validate_schema(200) == + %{ + "configs" => [ + %{ + "db" => [":instance_thumbnail"], + "group" => ":pleroma", + "key" => ":instance", + "value" => params["value"] + } + ], + "need_reboot" => false + } - assert res == %{ - "configs" => [ - %{ - "db" => [":instance_thumbnail"], - "group" => ":pleroma", - "key" => ":instance", - "value" => params["value"] - } - ], - "need_reboot" => false - } + assert conn + |> get("/api/v1/instance") + |> json_response_and_validate_schema(200) + |> Map.take(["thumbnail"]) == + %{"thumbnail" => "https://example.com/media/new_thumbnail.jpg"} + end - _res = - assert conn - |> get("/api/v1/instance") - |> json_response_and_validate_schema(200) + test "Concurrent Limiter", %{conn: conn} do + clear_config([ConcurrentLimiter]) + + params = %{ + "group" => ":pleroma", + "key" => "ConcurrentLimiter", + "value" => [ + %{ + "tuple" => [ + "Pleroma.Web.RichMedia.Helpers", + [ + %{"tuple" => [":max_running", 6]}, + %{"tuple" => [":max_waiting", 6]} + ] + ] + }, + %{ + "tuple" => [ + "Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy", + [ + %{"tuple" => [":max_running", 7]}, + %{"tuple" => [":max_waiting", 7]} + ] + ] + } + ] + } - assert res = %{"thumbnail" => "https://example.com/media/new_thumbnail.jpg"} + assert conn + |> put_req_header("content-type", "application/json") + |> post("/api/pleroma/admin/config", %{"configs" => [params]}) + |> json_response_and_validate_schema(200) end end