mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
Fix tests for Add support for configuring a favicon and embed PWA manifest in server-generated-meta
This commit is contained in:
parent
5d3e145dc4
commit
2a58596aef
2 changed files with 19 additions and 24 deletions
|
@ -6,20 +6,6 @@ defmodule Pleroma.Web.FallbackTest do
|
||||||
use Pleroma.Web.ConnCase
|
use Pleroma.Web.ConnCase
|
||||||
import Pleroma.Factory
|
import Pleroma.Factory
|
||||||
|
|
||||||
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) =~ "<!--server-generated-meta-->"
|
|
||||||
end
|
|
||||||
|
|
||||||
test "GET /*path", %{conn: conn} do
|
|
||||||
assert conn
|
|
||||||
|> get("/foo")
|
|
||||||
|> html_response(200) =~ "<!--server-generated-meta-->"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
test "GET /*path adds a title", %{conn: conn} do
|
test "GET /*path adds a title", %{conn: conn} do
|
||||||
clear_config([:instance, :name], "a cool title")
|
clear_config([:instance, :name], "a cool title")
|
||||||
|
|
||||||
|
@ -29,21 +15,28 @@ defmodule Pleroma.Web.FallbackTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "preloaded data and metadata attached to" do
|
describe "preloaded data and metadata attached to" do
|
||||||
test "GET /:maybe_nickname_or_id", %{conn: conn} do
|
test "GET /:maybe_nickname_or_id with existing user", %{conn: conn} do
|
||||||
|
clear_config([:instance, :name], "a cool title")
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
|
resp = get(conn, "/#{user.nickname}")
|
||||||
|
|
||||||
|
assert html_response(resp, 200) =~ "<title>a cool title</title>"
|
||||||
|
refute html_response(resp, 200) =~ "<!--server-generated-meta-->"
|
||||||
|
assert html_response(resp, 200) =~ "initial-results"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "GET /:maybe_nickname_or_id with missing user", %{conn: conn} do
|
||||||
clear_config([:instance, :name], "a cool title")
|
clear_config([:instance, :name], "a cool title")
|
||||||
|
|
||||||
user = insert(:user)
|
resp = get(conn, "/foo")
|
||||||
user_missing = get(conn, "/foo")
|
|
||||||
user_present = get(conn, "/#{user.nickname}")
|
|
||||||
|
|
||||||
assert html_response(user_missing, 200) =~ "<!--server-generated-meta-->"
|
assert html_response(resp, 200) =~ "<title>a cool title</title>"
|
||||||
refute html_response(user_present, 200) =~ "<!--server-generated-meta-->"
|
refute html_response(resp, 200) =~ "initial-results"
|
||||||
assert html_response(user_present, 200) =~ "initial-results"
|
|
||||||
assert html_response(user_present, 200) =~ "<title>a cool title</title>"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "GET /*path", %{conn: conn} do
|
test "GET /*path", %{conn: conn} do
|
||||||
assert conn
|
refute conn
|
||||||
|> get("/foo")
|
|> get("/foo")
|
||||||
|> html_response(200) =~ "<!--server-generated-meta-->"
|
|> html_response(200) =~ "<!--server-generated-meta-->"
|
||||||
|
|
||||||
|
@ -65,10 +58,12 @@ defmodule Pleroma.Web.FallbackTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "GET /main/all", %{conn: conn} do
|
test "GET /main/all", %{conn: conn} do
|
||||||
|
clear_config([:instance, :name], "a cool title")
|
||||||
public_page = get(conn, "/main/all")
|
public_page = get(conn, "/main/all")
|
||||||
|
|
||||||
refute html_response(public_page, 200) =~ "<!--server-generated-meta-->"
|
refute html_response(public_page, 200) =~ "<!--server-generated-meta-->"
|
||||||
assert html_response(public_page, 200) =~ "initial-results"
|
assert html_response(public_page, 200) =~ "initial-results"
|
||||||
|
assert html_response(public_page, 200) =~ "<title>a cool title</title>"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do
|
||||||
|> get("/notice/#{like_activity.id}")
|
|> get("/notice/#{like_activity.id}")
|
||||||
|> response(200)
|
|> response(200)
|
||||||
|
|
||||||
assert resp =~ "<!--server-generated-meta-->"
|
refute resp =~ ~r(<meta content="[^"]*" property="og:url")
|
||||||
end
|
end
|
||||||
|
|
||||||
test "404s a private notice", %{conn: conn} do
|
test "404s a private notice", %{conn: conn} do
|
||||||
|
|
Loading…
Reference in a new issue