X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Ffallback_test.exs;h=a658658603fcb0efce803a0bf52b92f5a5285d31;hb=f67c967c4a614262a6409f94ad74754b09dc0e64;hp=c13db9526467ad9c13843ef969b7d730d404095a;hpb=cc6c0b4ba6762e6a9b0a90c3dcda3f95283eb22a;p=akkoma
diff --git a/test/web/fallback_test.exs b/test/web/fallback_test.exs
index c13db9526..a65865860 100644
--- a/test/web/fallback_test.exs
+++ b/test/web/fallback_test.exs
@@ -1,27 +1,61 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.FallbackTest do
use Pleroma.Web.ConnCase
import Pleroma.Factory
- test "GET /registration/:token", %{conn: conn} do
- assert conn
- |> get("/registration/foo")
- |> html_response(200) =~ ""
+ describe "neither preloaded data nor metadata attached to" do
+ test "GET /registration/:token", %{conn: conn} do
+ response = get(conn, "/registration/foo")
+
+ assert html_response(response, 200) =~ ""
+ end
+
+ test "GET /*path", %{conn: conn} do
+ assert conn
+ |> get("/foo")
+ |> html_response(200) =~ ""
+ end
end
- test "GET /:maybe_nickname_or_id", %{conn: conn} do
- user = insert(:user)
+ describe "preloaded data and metadata attached to" do
+ test "GET /:maybe_nickname_or_id", %{conn: conn} do
+ user = insert(:user)
+ user_missing = get(conn, "/foo")
+ user_present = get(conn, "/#{user.nickname}")
- assert conn
- |> get("/foo")
- |> html_response(200) =~ ""
+ assert(html_response(user_missing, 200) =~ "")
+ refute html_response(user_present, 200) =~ ""
+ assert html_response(user_present, 200) =~ "initial-results"
+ end
- refute conn
- |> get("/" <> user.nickname)
- |> html_response(200) =~ ""
+ test "GET /*path", %{conn: conn} do
+ assert conn
+ |> get("/foo")
+ |> html_response(200) =~ ""
+
+ refute conn
+ |> get("/foo/bar")
+ |> html_response(200) =~ ""
+ end
+ end
+
+ describe "preloaded data is attached to" do
+ test "GET /main/public", %{conn: conn} do
+ public_page = get(conn, "/main/public")
+
+ refute html_response(public_page, 200) =~ ""
+ assert html_response(public_page, 200) =~ "initial-results"
+ end
+
+ test "GET /main/all", %{conn: conn} do
+ public_page = get(conn, "/main/all")
+
+ refute html_response(public_page, 200) =~ ""
+ assert html_response(public_page, 200) =~ "initial-results"
+ end
end
test "GET /api*path", %{conn: conn} do
@@ -34,16 +68,6 @@ defmodule Pleroma.Web.FallbackTest do
assert redirected_to(get(conn, "/pleroma/admin")) =~ "/pleroma/admin/"
end
- test "GET /*path", %{conn: conn} do
- assert conn
- |> get("/foo")
- |> html_response(200) =~ ""
-
- assert conn
- |> get("/foo/bar")
- |> html_response(200) =~ ""
- end
-
test "OPTIONS /*path", %{conn: conn} do
assert conn
|> options("/foo")