mirror of
https://github.com/venthur/blag.git
synced 2025-11-25 12:42:41 +00:00
Merge branch 'master' into better_default_theme
This commit is contained in:
@@ -33,6 +33,11 @@ def article_template(environment: Environment) -> Iterator[Template]:
|
||||
yield environment.get_template('article.html')
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def index_template(environment: Environment) -> Iterator[Template]:
|
||||
yield environment.get_template('index.html')
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def archive_template(environment: Environment) -> Iterator[Template]:
|
||||
yield environment.get_template('archive.html')
|
||||
|
||||
@@ -291,8 +291,10 @@ foo bar
|
||||
assert os.path.exists(f'{args.output_dir}/testdir/test')
|
||||
# ... feed
|
||||
assert os.path.exists(f'{args.output_dir}/atom.xml')
|
||||
# ... archive
|
||||
# ... index
|
||||
assert os.path.exists(f'{args.output_dir}/index.html')
|
||||
# ... archive
|
||||
assert os.path.exists(f'{args.output_dir}/archive.html')
|
||||
# ... tags
|
||||
assert os.path.exists(f'{args.output_dir}/tags/index.html')
|
||||
assert os.path.exists(f'{args.output_dir}/tags/foo.html')
|
||||
@@ -304,6 +306,7 @@ foo bar
|
||||
[
|
||||
'page.html',
|
||||
'article.html',
|
||||
'index.html',
|
||||
'archive.html',
|
||||
'tags.html',
|
||||
'tag.html',
|
||||
|
||||
@@ -27,6 +27,26 @@ def test_article(article_template: Template) -> None:
|
||||
assert '1980-05-09' in result
|
||||
|
||||
|
||||
def test_index(index_template: Template) -> None:
|
||||
entry = {
|
||||
'title': 'this is a title',
|
||||
'dst': 'https://example.com/link',
|
||||
'date': datetime.datetime(1980, 5, 9),
|
||||
}
|
||||
archive = [entry]
|
||||
ctx = {
|
||||
'archive': archive,
|
||||
}
|
||||
result = index_template.render(ctx)
|
||||
assert 'site title' in result
|
||||
|
||||
assert 'this is a title' in result
|
||||
assert '1980-05-09' in result
|
||||
assert 'https://example.com/link' in result
|
||||
|
||||
assert '/archive.html' in result
|
||||
|
||||
|
||||
def test_archive(archive_template: Template) -> None:
|
||||
entry = {
|
||||
'title': 'this is a title',
|
||||
@@ -38,7 +58,7 @@ def test_archive(archive_template: Template) -> None:
|
||||
'archive': archive,
|
||||
}
|
||||
result = archive_template.render(ctx)
|
||||
assert 'site title' in result
|
||||
assert 'Archive' in result
|
||||
|
||||
assert 'this is a title' in result
|
||||
assert '1980-05-09' in result
|
||||
|
||||
Reference in New Issue
Block a user