diff options
author | Wim Vanderbauwhede <wim.vanderbauwhede@mail.be> | 2019-02-14 16:41:40 +0000 |
---|---|---|
committer | Wim Vanderbauwhede <wim.vanderbauwhede@mail.be> | 2019-02-14 16:41:40 +0000 |
commit | 04b1c135543965860029557fc216eb38fd63b6c7 (patch) | |
tree | c1fb60376eeb35539704c23d282af7777895d4ea /test/web/twitter_api/util_controller_test.exs | |
parent | bf5b1c7f06c9f8882c40cf2385439bee3b74522c (diff) | |
parent | 1d17082ab2523eb75ee0ca4a49e45da0d0edabd7 (diff) | |
download | pleroma-04b1c135543965860029557fc216eb38fd63b6c7.tar.gz pleroma-04b1c135543965860029557fc216eb38fd63b6c7.zip |
Merge remote-tracking branch 'upstream/develop' into patch-image-description
Diffstat (limited to 'test/web/twitter_api/util_controller_test.exs')
-rw-r--r-- | test/web/twitter_api/util_controller_test.exs | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/test/web/twitter_api/util_controller_test.exs b/test/web/twitter_api/util_controller_test.exs index 73aa70bd5..007d7d8e6 100644 --- a/test/web/twitter_api/util_controller_test.exs +++ b/test/web/twitter_api/util_controller_test.exs @@ -32,4 +32,72 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do assert response == "job started" end end + + 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: %{ + x: 1, + y: 2 + }, + frontend_b: %{ + z: 3 + } + ] + + Pleroma.Config.put(:frontend_configurations, config) + + response = + conn + |> get("/api/pleroma/frontend_configurations") + |> json_response(:ok) + + assert response == Jason.encode!(config |> Enum.into(%{})) |> Jason.decode!() + end + end end |