Preloading: Return correct data for statusnet stuff.
This commit is contained in:
parent
6db9f7cdb3
commit
4a7a34ae8c
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
defmodule Pleroma.Web.Preload.Providers.StatusNet do
|
defmodule Pleroma.Web.Preload.Providers.StatusNet do
|
||||||
alias Pleroma.Web.Preload.Providers.Provider
|
alias Pleroma.Web.Preload.Providers.Provider
|
||||||
alias Pleroma.Web.TwitterAPI.UtilView
|
alias Pleroma.Web.TwitterAPI.UtilController
|
||||||
|
|
||||||
@behaviour Provider
|
@behaviour Provider
|
||||||
@config_url :"/api/statusnet/config.json"
|
@config_url :"/api/statusnet/config.json"
|
||||||
|
@ -16,9 +16,10 @@ def generate_terms(_params) do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp build_config_tag(acc) do
|
defp build_config_tag(acc) do
|
||||||
instance = Pleroma.Config.get(:instance)
|
resp =
|
||||||
info_data = UtilView.status_net_config(instance)
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,6 +9,7 @@ defmodule Pleroma.Web.Preload.Providers.StatusNetTest do
|
||||||
setup do: {:ok, StatusNet.generate_terms(nil)}
|
setup do: {:ok, StatusNet.generate_terms(nil)}
|
||||||
|
|
||||||
test "it renders the info", %{"/api/statusnet/config.json": info} do
|
test "it renders the info", %{"/api/statusnet/config.json": info} do
|
||||||
assert info =~ "<name>Pleroma</name>"
|
assert {:ok, res} = Jason.decode(info)
|
||||||
|
assert res["site"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue