mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 13:19:16 +02:00
Fix #1107: Fix HTML <title> not including instance name in some situations
This commit is contained in:
parent
90427331e6
commit
0ee0db7ea5
4 changed files with 20 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
import html
|
||||
import time
|
||||
import pytest
|
||||
|
||||
from django.http import HttpResponse
|
||||
from django.urls import reverse
|
||||
|
||||
|
@ -55,10 +55,12 @@ def test_should_fallback(path, expected, mocker):
|
|||
|
||||
|
||||
def test_serve_spa_from_cache(mocker, settings, preferences, no_api_auth):
|
||||
|
||||
preferences["instance__name"] = 'Best Funkwhale "pod"'
|
||||
request = mocker.Mock(path="/")
|
||||
get_spa_html = mocker.patch.object(
|
||||
middleware, "get_spa_html", return_value="<html><head></head></html>"
|
||||
middleware,
|
||||
"get_spa_html",
|
||||
return_value="<html><head><title>Funkwhale</title></head></html>",
|
||||
)
|
||||
mocker.patch.object(
|
||||
middleware,
|
||||
|
@ -84,7 +86,8 @@ def test_serve_spa_from_cache(mocker, settings, preferences, no_api_auth):
|
|||
|
||||
assert response.status_code == 200
|
||||
expected = [
|
||||
"<html><head>",
|
||||
"<html><head>"
|
||||
"<title>{}</title>".format(html.escape(preferences["instance__name"])),
|
||||
'<meta content="custom title" property="og:title" />',
|
||||
'<meta content="custom description" property="og:description" />',
|
||||
'<meta content="default site name" property="og:site_name" />',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue