attempt to load resolved journal files

one step closer to actual functionality, attempt to load the resolved
markdown file in the instance directory, or 404 if it doesn't exist
This commit is contained in:
2020-03-07 10:08:23 -06:00
parent 3f22b56c09
commit 053e3d96a3
5 changed files with 72 additions and 2 deletions

20
tests/conftest.py Normal file
View File

@@ -0,0 +1,20 @@
"""Create the test app and other fixtures."""
import os
import pytest
from incorporealcms import create_app
HERE = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture
def app():
app = create_app(instance_path=os.path.join(HERE, 'instance'))
yield app
@pytest.fixture
def client(app):
return app.test_client()

21
tests/instance/config.py Normal file
View File

@@ -0,0 +1,21 @@
LOGGING = {
'version': 1,
'formatters': {
'default': {
'format': '[%(asctime)s %(levelname)-7s %(name)s] %(message)s',
},
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'default',
},
},
'loggers': {
'': {
'level': 'DEBUG',
'handlers': ['console'],
},
},
}

View File

@@ -0,0 +1,3 @@
# test index
this is some test content

View File

@@ -12,3 +12,13 @@ def test_journal_file_resolver_subdir_to_index():
def test_journal_file_resolver_other_requests_fine():
assert journal_file_resolver('foo/baz') == 'journal/foo/baz.md'
def test_journal_file_that_exists(client):
response = client.get('/')
assert response.status_code == 200
def test_journal_file_that_doesnt_exist(client):
response = client.get('/ohuesthaoeusth')
assert response.status_code == 404