fix for int and modules
[akkoma] / test / web / admin_api / admin_api_controller_test.exs
index 18f64f2b717f41c5c1e2d1bdd356a807c77b0789..17a872b217f77d2d3c58ad5dcc2f61daea0f03a4 100644 (file)
@@ -1334,7 +1334,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
     setup %{conn: conn} do
       admin = insert(:user, info: %{is_admin: true})
 
-      temp_file = "config/test.migrated.secret.exs"
+      temp_file = "config/test.exported_from_db.secret.exs"
 
       on_exit(fn ->
         Application.delete_env(:pleroma, :key1)
@@ -1463,5 +1463,34 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
       assert Application.get_env(:pleroma, :keyaa1) == "another_value"
       refute Application.get_env(:pleroma, :keyaa2)
     end
+
+    test "common config example", %{conn: conn} do
+      conn =
+        post(conn, "/api/pleroma/admin/config", %{
+          configs: [
+            %{
+              "key" => "Pleroma.Captcha",
+              "value" => %{
+                "enabled" => ":false",
+                "method" => "Pleroma.Captcha.Kocaptcha",
+                "seconds_valid" => "i:60"
+              }
+            }
+          ]
+        })
+
+      assert json_response(conn, 200) == %{
+               "configs" => [
+                 %{
+                   "key" => "Pleroma.Captcha",
+                   "value" => [
+                     %{"enabled" => false},
+                     %{"method" => "Pleroma.Captcha.Kocaptcha"},
+                     %{"seconds_valid" => 60}
+                   ]
+                 }
+               ]
+             }
+    end
   end
 end