Brian S. Stephan
2634c144a7
this is for miscellaneous files that should be served directly rather than being a page route
30 lines
1019 B
Python
30 lines
1019 B
Python
"""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
|
|
|
|
|
|
def test_media_file_access(client):
|
|
response = client.get('/media/favicon.png')
|
|
assert response.status_code == 200
|
|
assert response.headers['content-type'] == 'image/png'
|