Skip to content

Commit dd71dd1

Browse files
committed
Test bad date format
1 parent 574b76a commit dd71dd1

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

tests/test_build.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,6 @@ def test_simple_build_item_dates(self):
188188
self.assertEqual(cli_result.exit_code, 0)
189189
self.assertIsNone(cli_result.exception)
190190

191-
# created items
192-
feed_parsed = feedparser.parse(Path(tmpdirname) / "feed_rss_created.xml")
193-
194-
# updated items
195-
feed_parsed = feedparser.parse(Path(tmpdirname) / "feed_rss_updated.xml")
196-
197191
def test_simple_build_feed_length(self):
198192
with tempfile.TemporaryDirectory() as tmpdirname:
199193
cli_result = self.build_docs_setup(
@@ -411,7 +405,7 @@ def test_bad_config(self):
411405
with tempfile.TemporaryDirectory() as tmpdirname:
412406
cli_result = self.build_docs_setup(
413407
testproject_path="docs",
414-
mkdocs_yml_filepath=Path("mkdocs_bad_config.yml"),
408+
mkdocs_yml_filepath=Path("tests/fixtures/mkdocs_bad_config.yml"),
415409
output_path=tmpdirname,
416410
strict=True,
417411
)
@@ -420,6 +414,29 @@ def test_bad_config(self):
420414
self.assertEqual(cli_result.exit_code, 2)
421415
self.assertIsNotNone(cli_result.exception)
422416

417+
def test_bad_date_format(self):
418+
# add a new page without tracking it
419+
md_str = """---\ndate: 13 April 2022\n---\n\n# This page is dynamically created for test purposes\n\nHi!\n
420+
"""
421+
temp_page = Path("tests/fixtures/docs/temp_page_not_in_git_log.md")
422+
if temp_page.exists():
423+
temp_page.unlink()
424+
temp_page.write_text(md_str)
425+
426+
with tempfile.TemporaryDirectory() as tmpdirname:
427+
cli_result = self.build_docs_setup(
428+
testproject_path="docs",
429+
mkdocs_yml_filepath=Path("mkdocs.yml"),
430+
output_path=tmpdirname,
431+
strict=True,
432+
)
433+
434+
self.assertEqual(cli_result.exit_code, 0)
435+
self.assertIsNone(cli_result.exception)
436+
437+
# rm page
438+
temp_page.unlink()
439+
423440
def test_not_in_git_log(self):
424441
# add a new page without tracking it
425442
md_str = """# This page is dynamically created for test purposes\n\nHi!\n

0 commit comments

Comments
 (0)