Initial test validating the AdminAPI issue
authorMark Felder <feld@feld.me>
Tue, 13 Apr 2021 16:15:52 +0000 (11:15 -0500)
committerMark Felder <feld@feld.me>
Tue, 13 Apr 2021 19:39:28 +0000 (14:39 -0500)
test/pleroma/web/admin_api/controllers/config_controller_test.exs

index c4d07d61c8a4fdf002e5e4f3475d23ccab272a7c..d26fd3150c49a27a41717bf044a20999c35df784 100644 (file)
@@ -1452,6 +1452,41 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do
 
       assert res = %{"thumbnail" => "https://example.com/media/new_thumbnail.jpg"}
     end
+
+    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]}
+              ]
+            ]
+          }
+        ]
+      }
+
+      _res =
+        assert conn
+               |> put_req_header("content-type", "application/json")
+               |> post("/api/pleroma/admin/config", %{"configs" => [params]})
+               |> json_response_and_validate_schema(200)
+    end
   end
 
   describe "GET /api/pleroma/admin/config/descriptions" do