Skip to content

Commit

Permalink
Added missing test.
Browse files Browse the repository at this point in the history
  • Loading branch information
neerdoc committed Feb 15, 2024
1 parent 388d97d commit f258ae8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions doorstop/core/tests/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,29 @@ def test_html_tree_with_custom_template(self):
walk = getWalk(self.dirpath)
self.assertEqual(expected_walk, walk)

def test_html_tree_with_multiple_template(self):
"""Verify that a document tree with multiple custom html template throws an error."""
# This test MUST use the expensive tree since it changes the document content
# in the source tree otherwise!
build_expensive_tree(self)

# Check that only custom template is published.
os.makedirs(self.dirpath)
# Create a custom template folder.
doc_path = self.mock_tree.documents[0].path
os.mkdir(os.path.join(doc_path, "template"))
Path(os.path.join(doc_path, "template", "custom_css.css")).touch()
# Create another custom template folder.
doc_path = self.mock_tree.documents[1].path
os.mkdir(os.path.join(doc_path, "template"))
Path(os.path.join(doc_path, "template", "custom_css.css")).touch()

# Act
with self.assertRaises(DoorstopError):
_, _ = template.get_template(
self.mock_tree, self.dirpath, ".html", "custom_css"
)

def test_html_doc_with_custom_template(self):
"""Verify that a custom html template is used correctly."""
# This test MUST use the expensive tree since it changes the document content
Expand Down

0 comments on commit f258ae8

Please sign in to comment.