Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 337001a939 | |||
| ab009e4f59 |
@@ -17,12 +17,11 @@ def create_app(instance_path=None, test_config=None):
|
||||
# if it doesn't already exist, create the instance folder
|
||||
os.makedirs(app.instance_path, exist_ok=True)
|
||||
|
||||
if test_config is None:
|
||||
# load defaults from config provided with the application
|
||||
app.config.from_object('incorporealcms.config.Config')
|
||||
# load specific instance configurations
|
||||
app.config.from_pyfile('config.py', silent=True)
|
||||
else:
|
||||
# load defaults from config provided with the application
|
||||
app.config.from_object('incorporealcms.config.Config')
|
||||
# load specific instance configurations
|
||||
app.config.from_pyfile('config.py', silent=True)
|
||||
if test_config:
|
||||
app.config.from_mapping(test_config)
|
||||
|
||||
dictConfig(app.config['LOGGING'])
|
||||
|
||||
@@ -31,3 +31,5 @@ class Config(object):
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
TITLE_SUFFIX = 'incorporeal.org'
|
||||
|
||||
@@ -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">
|
||||
|
||||
2
setup.py
2
setup.py
@@ -15,7 +15,7 @@ def extract_requires():
|
||||
|
||||
setup(
|
||||
name='incorporeal-cms',
|
||||
description='Flask project for running https://incorporeal.org.',
|
||||
description='Flask project for running https://suou.net (and eventually others).',
|
||||
url='https://git.incorporeal.org/bss/incorporeal-cms',
|
||||
license='GPL3',
|
||||
author='Brian S. Stephan',
|
||||
|
||||
23
tests/test_factory.py
Normal file
23
tests/test_factory.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""Test basic configuration stuff."""
|
||||
import os
|
||||
|
||||
from incorporealcms import create_app
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
def test_config():
|
||||
"""Test create_app without passing 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
|
||||
Reference in New Issue
Block a user