From ce1ed60dd2b70f1b11e72080333ed40e0c85349a Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sat, 27 Feb 2021 00:10:03 -0600 Subject: [PATCH] allow for configuration to override the favicon Closes #5 --- 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 bc8c3ba..7e8ee0a 100644 --- a/incorporealcms/config.py +++ b/incorporealcms/config.py @@ -54,3 +54,5 @@ class Config(object): DEFAULT_PAGE_STYLE = 'light' TITLE_SUFFIX = 'incorporeal.org' CONTACT_EMAIL = 'bss@incorporeal.org' + + # specify FAVICON in your instance config.py to override the suou icon diff --git a/incorporealcms/templates/base.html b/incorporealcms/templates/base.html index e15878f..8d5d67a 100644 --- a/incorporealcms/templates/base.html +++ b/incorporealcms/templates/base.html @@ -9,7 +9,7 @@ - +
{% block header %} diff --git a/tests/test_factory.py b/tests/test_factory.py index b0a2a3f..1a99425 100644 --- a/tests/test_factory.py +++ b/tests/test_factory.py @@ -58,3 +58,13 @@ def test_media_file_access(client): response = client.get('/media/favicon.png') assert response.status_code == 200 assert response.headers['content-type'] == 'image/png' + + +def test_favicon_override(): + """Test that a configuration with a specific favicon overrides the default.""" + instance_path = os.path.join(HERE, 'instance') + app = create_app(instance_path=instance_path, test_config={'FAVICON': '/media/foo.png'}) + client = app.test_client() + response = client.get('/no-title') + assert response.status_code == 200 + assert b'' in response.data