logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

instance_test.exs (1406B)


  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. defmodule Pleroma.Web.Preload.Providers.InstanceTest do
  5. use Pleroma.DataCase
  6. alias Pleroma.Web.Preload.Providers.Instance
  7. setup do: {:ok, Instance.generate_terms(nil)}
  8. test "it renders the info", %{"/api/v1/instance" => info} do
  9. assert %{
  10. description: description,
  11. email: "admin@example.com",
  12. registrations: true
  13. } = info
  14. assert String.equivalent?(description, "Pleroma: An efficient and flexible fediverse server")
  15. end
  16. test "it renders the panel", %{"/instance/panel.html" => panel} do
  17. assert String.contains?(
  18. panel,
  19. "<p>Welcome to <a href=\"https://pleroma.social\" target=\"_blank\">Pleroma!</a></p>"
  20. )
  21. end
  22. test "it works with overrides" do
  23. clear_config([:instance, :static_dir], "test/fixtures/preload_static")
  24. %{"/instance/panel.html" => panel} = Instance.generate_terms(nil)
  25. assert String.contains?(
  26. panel,
  27. "HEY!"
  28. )
  29. end
  30. test "it renders the node_info", %{"/nodeinfo/2.0.json" => nodeinfo} do
  31. %{
  32. metadata: metadata,
  33. version: "2.0"
  34. } = nodeinfo
  35. assert metadata.private == false
  36. assert metadata.suggestions == %{enabled: false}
  37. end
  38. end