Skip to content

Commit

Permalink
coverage: Test publish --no-toc feature
Browse files Browse the repository at this point in the history
  • Loading branch information
robtaylor committed Oct 16, 2024
1 parent 415c83c commit cda7827
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions doorstop/cli/tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,23 @@ def test_publish_document_html_file(self):
filePath = os.path.join(self.temp, "documents", "req.html")
self.assertTrue(os.path.isfile(filePath))

def test_publish_document_md_file_no_toc(self):
"""Verify 'doorstop publish --no-toc' creates an MarkDownfile with no TOC."""
path = os.path.join(self.temp, "req.md")
self.assertIs(None, main(["publish", "--no-toc", "req", path]))
self.assertTrue(os.path.isfile(path))
text = common.read_text(path)
self.assertNotIn("Table of Contents", text)

def test_publish_document_html_file_no_toc(self):
"""Verify 'doorstop publish --no-toc' creates an HTML file with no TOC."""
path = os.path.join(self.temp, "req.html")
self.assertIs(None, main(["publish", "--no-toc", "req", path]))
filePath = os.path.join(self.temp, "documents", "req.html")
self.assertTrue(os.path.isfile(filePath))
text = common.read_text(filePath)
self.assertNotIn("Table of Contents", text)

def test_publish_tree_html(self):
"""Verify 'doorstop publish' can create an HTML directory."""
path = os.path.join(self.temp, "all")
Expand Down Expand Up @@ -842,6 +859,13 @@ def test_publish_markdown_tree_no_path(self):
],
)

def test_publish_tree_html_no_toc(self):
"""Verify 'doorstop publish --no-toc' returns a html document with no toc."""
path = os.path.join(self.temp, "all")
self.assertIs(None, main(["publish", "--no-toc", "all", path]))
self.assertTrue(os.path.isdir(path))
self.assertTrue(os.path.isfile(os.path.join(path, "index.html")))


class TestPublishCommand(TempTestCase):
"""Tests 'doorstop publish' options toc and template"""
Expand Down

0 comments on commit cda7827

Please sign in to comment.