Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.1KB

  1. defmodule Pleroma.Web.NodeInfoTest do
  2. use Pleroma.Web.ConnCase
  3. import Pleroma.Factory
  4. test "nodeinfo shows staff accounts", %{conn: conn} do
  5. user = insert(:user, %{local: true, info: %{is_moderator: true}})
  6. conn =
  7. conn
  8. |> get("/nodeinfo/2.0.json")
  9. assert result = json_response(conn, 200)
  10. assert user.ap_id in result["metadata"]["staffAccounts"]
  11. end
  12. test "returns 404 when federation is disabled", %{conn: conn} do
  13. instance =
  14. Application.get_env(:pleroma, :instance)
  15. |> Keyword.put(:federating, false)
  16. Application.put_env(:pleroma, :instance, instance)
  17. conn
  18. |> get("/.well-known/nodeinfo")
  19. |> json_response(404)
  20. conn
  21. |> get("/nodeinfo/2.0.json")
  22. |> json_response(404)
  23. instance =
  24. Application.get_env(:pleroma, :instance)
  25. |> Keyword.put(:federating, true)
  26. Application.put_env(:pleroma, :instance, instance)
  27. end
  28. test "returns 200 when federation is enabled", %{conn: conn} do
  29. conn
  30. |> get("/.well-known/nodeinfo")
  31. |> json_response(200)
  32. conn
  33. |> get("/nodeinfo/2.0.json")
  34. |> json_response(200)
  35. end
  36. end