Skip to content

Commit cda7827

Browse files
committed
coverage: Test publish --no-toc feature
1 parent 415c83c commit cda7827

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

doorstop/cli/tests/test_all.py

+24
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,23 @@ def test_publish_document_html_file(self):
796796
filePath = os.path.join(self.temp, "documents", "req.html")
797797
self.assertTrue(os.path.isfile(filePath))
798798

799+
def test_publish_document_md_file_no_toc(self):
800+
"""Verify 'doorstop publish --no-toc' creates an MarkDownfile with no TOC."""
801+
path = os.path.join(self.temp, "req.md")
802+
self.assertIs(None, main(["publish", "--no-toc", "req", path]))
803+
self.assertTrue(os.path.isfile(path))
804+
text = common.read_text(path)
805+
self.assertNotIn("Table of Contents", text)
806+
807+
def test_publish_document_html_file_no_toc(self):
808+
"""Verify 'doorstop publish --no-toc' creates an HTML file with no TOC."""
809+
path = os.path.join(self.temp, "req.html")
810+
self.assertIs(None, main(["publish", "--no-toc", "req", path]))
811+
filePath = os.path.join(self.temp, "documents", "req.html")
812+
self.assertTrue(os.path.isfile(filePath))
813+
text = common.read_text(filePath)
814+
self.assertNotIn("Table of Contents", text)
815+
799816
def test_publish_tree_html(self):
800817
"""Verify 'doorstop publish' can create an HTML directory."""
801818
path = os.path.join(self.temp, "all")
@@ -842,6 +859,13 @@ def test_publish_markdown_tree_no_path(self):
842859
],
843860
)
844861

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

846870
class TestPublishCommand(TempTestCase):
847871
"""Tests 'doorstop publish' options toc and template"""

0 commit comments

Comments
 (0)