allow overriding the "incorporeal.org" in <title>

I'm not going to be able to use this software on incorporeal.org for a
bit, so plan B
This commit is contained in:
Brian S. Stephan 2020-03-07 19:43:24 -06:00
parent ab009e4f59
commit 337001a939
3 changed files with 13 additions and 1 deletions

View File

@ -31,3 +31,5 @@ class Config(object):
},
},
}
TITLE_SUFFIX = 'incorporeal.org'

View File

@ -1,5 +1,5 @@
<!doctype html>
<title>{{ title }}{% if title %} - {% endif %}incorporeal.org</title>
<title>{{ title }}{% if title %} - {% endif %}{{ config.TITLE_SUFFIX }}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
<link rel="icon" href="{{ url_for('static', filename='img/favicon.png') }}">
<section class="content">

View File

@ -11,3 +11,13 @@ def test_config():
instance_path = os.path.join(HERE, 'instance')
assert not create_app(instance_path=instance_path).testing
assert create_app(instance_path=instance_path, test_config={"TESTING": True}).testing
def test_title_override():
"""Test that a configuration with a specific title overrides the default."""
instance_path = os.path.join(HERE, 'instance')
app = create_app(instance_path=instance_path, test_config={'TITLE_SUFFIX': 'suou.net'})
client = app.test_client()
response = client.get('/no-title')
assert response.status_code == 200
assert b'<title>suou.net</title>' in response.data