Use ModerationLog instead of Logger
[akkoma] / test / pleroma / web / preload / providers / instance_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.Preload.Providers.InstanceTest do
6 use Pleroma.DataCase
7 alias Pleroma.Web.Preload.Providers.Instance
8
9 setup do: {:ok, Instance.generate_terms(nil)}
10
11 test "it renders the info", %{"/api/v1/instance" => info} do
12 assert %{
13 description: description,
14 email: "admin@example.com",
15 registrations: true
16 } = info
17
18 assert String.equivalent?(description, "Pleroma: An efficient and flexible fediverse server")
19 end
20
21 test "it renders the panel", %{"/instance/panel.html" => panel} do
22 assert String.contains?(
23 panel,
24 "<p>Welcome to <a href=\"https://pleroma.social\" target=\"_blank\">Pleroma!</a></p>"
25 )
26 end
27
28 test "it works with overrides" do
29 clear_config([:instance, :static_dir], "test/fixtures/preload_static")
30
31 %{"/instance/panel.html" => panel} = Instance.generate_terms(nil)
32
33 assert String.contains?(
34 panel,
35 "HEY!"
36 )
37 end
38
39 test "it renders the node_info", %{"/nodeinfo/2.0.json" => nodeinfo} do
40 %{
41 metadata: metadata,
42 version: "2.0"
43 } = nodeinfo
44
45 assert metadata.private == false
46 assert metadata.suggestions == %{enabled: false}
47 end
48
49 test "it renders the frontend configurations", %{
50 "/api/pleroma/frontend_configurations" => fe_configs
51 } do
52 assert %{
53 pleroma_fe: %{background: "/images/city.jpg", logo: "/static/logo.png"}
54 } = fe_configs
55 end
56 end