incorporeal-cms/tests/test_journal.py
Brian S. Stephan 1f420eab30 journal: render markdown content + title metadata
this has a really basic template and whatnot at the moment, so
styling/etc isn't done, but this is maybe the last major piece before I
could actually see pushing this onto the site
2020-03-07 12:06:21 -06:00

39 lines
1.2 KiB
Python

"""Test journal views and helper methods."""
from incorporealcms.journal import journal_file_resolver
def test_journal_file_resolver_dir_to_index():
assert journal_file_resolver('foo/') == 'journal/foo/index.md'
def test_journal_file_resolver_subdir_to_index():
assert journal_file_resolver('foo/bar/') == 'journal/foo/bar/index.md'
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
assert b'<h1>test index</h1>' in response.data
def test_journal_file_that_doesnt_exist(client):
response = client.get('/ohuesthaoeusth')
assert response.status_code == 404
def test_journal_file_with_title_metadata(client):
response = client.get('/')
assert response.status_code == 200
assert b'<title>Index - incorporeal.org</title>' in response.data
def test_journal_file_without_title_metadata(client):
response = client.get('/no-title')
assert response.status_code == 200
assert b'<title>incorporeal.org</title>' in response.data
assert b'<h1>this page doesn\'t have a title!</h1>' in response.data