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.

57 lines
1.5KB

  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.FallbackTest do
  5. use Pleroma.Web.ConnCase
  6. import Pleroma.Factory
  7. test "GET /registration/:token", %{conn: conn} do
  8. assert conn
  9. |> get("/registration/foo")
  10. |> html_response(200) =~ "<!--server-generated-meta-->"
  11. end
  12. test "GET /:maybe_nickname_or_id", %{conn: conn} do
  13. user = insert(:user)
  14. assert conn
  15. |> get("/foo")
  16. |> html_response(200) =~ "<!--server-generated-meta-->"
  17. refute conn
  18. |> get("/" <> user.nickname)
  19. |> html_response(200) =~ "<!--server-generated-meta-->"
  20. end
  21. test "GET /api*path", %{conn: conn} do
  22. assert conn
  23. |> get("/api/foo")
  24. |> json_response(404) == %{"error" => "Not implemented"}
  25. end
  26. test "GET /pleroma/admin -> /pleroma/admin/", %{conn: conn} do
  27. assert redirected_to(get(conn, "/pleroma/admin")) =~ "/pleroma/admin/"
  28. end
  29. test "GET /*path", %{conn: conn} do
  30. assert conn
  31. |> get("/foo")
  32. |> html_response(200) =~ "<!--server-generated-meta-->"
  33. assert conn
  34. |> get("/foo/bar")
  35. |> html_response(200) =~ "<!--server-generated-meta-->"
  36. end
  37. test "OPTIONS /*path", %{conn: conn} do
  38. assert conn
  39. |> options("/foo")
  40. |> response(204) == ""
  41. assert conn
  42. |> options("/foo/bar")
  43. |> response(204) == ""
  44. end
  45. end