test: twitterapi: fix the test breakage for real
[akkoma] / test / web / twitter_api / util_controller_test.exs
index c099db00381acc2505dfcda138df631627fb34a8..8e152ecd4a3ca69e78816f2425b3cfa3f828e4f5 100644 (file)
@@ -33,7 +33,52 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
     end
   end
 
-  describe "GET /api/pleroma/frontent_configurations" do
+  describe "GET /api/statusnet/config.json" do
+    test "it returns the managed config", %{conn: conn} do
+      Pleroma.Config.put([:instance, :managed_config], false)
+      Pleroma.Config.put([:fe, :theme], "rei-ayanami-towel")
+
+      response =
+        conn
+        |> get("/api/statusnet/config.json")
+        |> json_response(:ok)
+
+      refute response["site"]["pleromafe"]
+
+      Pleroma.Config.put([:instance, :managed_config], true)
+
+      response =
+        conn
+        |> get("/api/statusnet/config.json")
+        |> json_response(:ok)
+
+      assert response["site"]["pleromafe"]
+    end
+
+    test "if :pleroma, :fe is false, it returns the new style config settings", %{conn: conn} do
+      Pleroma.Config.put([:instance, :managed_config], true)
+      Pleroma.Config.put([:fe, :theme], "rei-ayanami-towel")
+      Pleroma.Config.put([:frontend_configurations, :pleroma_fe], %{theme: "asuka-hospital"})
+
+      response =
+        conn
+        |> get("/api/statusnet/config.json")
+        |> json_response(:ok)
+
+      assert response["site"]["pleromafe"]["theme"] == "rei-ayanami-towel"
+
+      Pleroma.Config.put([:fe], false)
+
+      response =
+        conn
+        |> get("/api/statusnet/config.json")
+        |> json_response(:ok)
+
+      assert response["site"]["pleromafe"]["theme"] == "asuka-hospital"
+    end
+  end
+
+  describe "GET /api/pleroma/frontend_configurations" do
     test "returns everything in :pleroma, :frontend_configurations", %{conn: conn} do
       config = [
         frontend_a: %{