X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fpleroma%2Fweb%2Ffallback_test.exs;h=cf573cd00b35a844a77961154a6c591082b8459f;hb=ca70d42541d4a17d5015df011a92b4e8db18a18a;hp=a658658603fcb0efce803a0bf52b92f5a5285d31;hpb=7dffaef4799b0e867e91e19b76567c0e1a19bb43;p=akkoma diff --git a/test/pleroma/web/fallback_test.exs b/test/pleroma/web/fallback_test.exs index a65865860..cf573cd00 100644 --- a/test/pleroma/web/fallback_test.exs +++ b/test/pleroma/web/fallback_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.FallbackTest do @@ -20,15 +20,26 @@ defmodule Pleroma.Web.FallbackTest do end end + test "GET /*path adds a title", %{conn: conn} do + clear_config([:instance, :name], "a cool title") + + assert conn + |> get("/") + |> html_response(200) =~ "a cool title" + end + describe "preloaded data and metadata attached to" do test "GET /:maybe_nickname_or_id", %{conn: conn} do + clear_config([:instance, :name], "a cool title") + user = insert(:user) user_missing = get(conn, "/foo") user_present = get(conn, "/#{user.nickname}") - assert(html_response(user_missing, 200) =~ "") + assert html_response(user_missing, 200) =~ "" refute html_response(user_present, 200) =~ "" assert html_response(user_present, 200) =~ "initial-results" + assert html_response(user_present, 200) =~ "a cool title" end test "GET /*path", %{conn: conn} do @@ -44,10 +55,13 @@ defmodule Pleroma.Web.FallbackTest do describe "preloaded data is attached to" do test "GET /main/public", %{conn: conn} do + clear_config([:instance, :name], "a cool title") + public_page = get(conn, "/main/public") refute html_response(public_page, 200) =~ "" assert html_response(public_page, 200) =~ "initial-results" + assert html_response(public_page, 200) =~ "a cool title" end test "GET /main/all", %{conn: conn} do @@ -58,12 +72,6 @@ defmodule Pleroma.Web.FallbackTest do end end - test "GET /api*path", %{conn: conn} do - assert conn - |> get("/api/foo") - |> json_response(404) == %{"error" => "Not implemented"} - end - test "GET /pleroma/admin -> /pleroma/admin/", %{conn: conn} do assert redirected_to(get(conn, "/pleroma/admin")) =~ "/pleroma/admin/" end