From 4a7a34ae8c2ad12b2b9903c1d70bfe85d10af49e Mon Sep 17 00:00:00 2001 From: lain Date: Fri, 26 Jun 2020 14:47:38 +0200 Subject: [PATCH] Preloading: Return correct data for statusnet stuff. --- lib/pleroma/web/preload/status_net.ex | 9 +++++---- test/web/preload/status_net_test.exs | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/preload/status_net.ex b/lib/pleroma/web/preload/status_net.ex index 367442d5c..810ad512b 100644 --- a/lib/pleroma/web/preload/status_net.ex +++ b/lib/pleroma/web/preload/status_net.ex @@ -4,7 +4,7 @@ defmodule Pleroma.Web.Preload.Providers.StatusNet do alias Pleroma.Web.Preload.Providers.Provider - alias Pleroma.Web.TwitterAPI.UtilView + alias Pleroma.Web.TwitterAPI.UtilController @behaviour Provider @config_url :"/api/statusnet/config.json" @@ -16,9 +16,10 @@ defmodule Pleroma.Web.Preload.Providers.StatusNet do end defp build_config_tag(acc) do - instance = Pleroma.Config.get(:instance) - info_data = UtilView.status_net_config(instance) + resp = + Plug.Test.conn(:get, @config_url |> to_string()) + |> UtilController.config(nil) - Map.put(acc, @config_url, info_data) + Map.put(acc, @config_url, resp.resp_body) end end diff --git a/test/web/preload/status_net_test.exs b/test/web/preload/status_net_test.exs index ab6823a7e..2cdc82930 100644 --- a/test/web/preload/status_net_test.exs +++ b/test/web/preload/status_net_test.exs @@ -9,6 +9,7 @@ defmodule Pleroma.Web.Preload.Providers.StatusNetTest do setup do: {:ok, StatusNet.generate_terms(nil)} test "it renders the info", %{"/api/statusnet/config.json": info} do - assert info =~ "Pleroma" + assert {:ok, res} = Jason.decode(info) + assert res["site"] end end -- 2.45.2