From 337001a9392272cf9de0642e5b22e319d8a4af22 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sat, 7 Mar 2020 19:43:24 -0600 Subject: [PATCH] allow overriding the "incorporeal.org" in I'm not going to be able to use this software on incorporeal.org for a bit, so plan B --- incorporealcms/config.py | 2 ++ incorporealcms/templates/base.html | 2 +- tests/test_factory.py | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/incorporealcms/config.py b/incorporealcms/config.py index f20dc81..64d7f13 100644 --- a/incorporealcms/config.py +++ b/incorporealcms/config.py @@ -31,3 +31,5 @@ class Config(object): }, }, } + + TITLE_SUFFIX = 'incorporeal.org' diff --git a/incorporealcms/templates/base.html b/incorporealcms/templates/base.html index dddc9dc..95e5756 100644 --- a/incorporealcms/templates/base.html +++ b/incorporealcms/templates/base.html @@ -1,5 +1,5 @@ <!doctype html> -<title>{{ title }}{% if title %} - {% endif %}incorporeal.org +{{ title }}{% if title %} - {% endif %}{{ config.TITLE_SUFFIX }}
diff --git a/tests/test_factory.py b/tests/test_factory.py index 92ba443..97f728d 100644 --- a/tests/test_factory.py +++ b/tests/test_factory.py @@ -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'suou.net' in response.data