-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #448 from render-engine/🐛---Archive-isnt-getting-c…
…lass-page-name
- Loading branch information
Showing
2 changed files
with
19 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
import pytest | ||
|
||
from render_engine.archive import Archive | ||
from render_engine.page import Page | ||
|
||
|
||
def test_archive_slug_name_with_pages(): | ||
def test_archive_slug_named_after_title(): | ||
"""Archives usually get their name from their collection. This tests that the slug is named after the title""" | ||
|
||
archive = Archive(title="test archive", pages=[Page()], template="", routes=["./"], template_vars={}) | ||
|
||
assert archive._slug == "test-archive" | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"title, expected_slug", | ||
[("archive", "archive1"), ("collection", "collection1"), ("Test Collection", "test-collection1")], | ||
) | ||
def test_archive_slug_name_with_pages(title, expected_slug): | ||
"""tests that if num_archive_pages is greater than 1, the slug is appended with the archive_index""" | ||
|
||
archive = Archive( | ||
title="archive", | ||
pages=[Page()], | ||
template="", | ||
routes=["./"], | ||
archive_index=1, | ||
num_archive_pages=2, | ||
template_vars={} | ||
title=title, pages=[Page()], template="", routes=["./"], archive_index=1, num_archive_pages=2, template_vars={} | ||
) | ||
|
||
assert archive.slug == "archive1" | ||
assert archive._slug == expected_slug |