Skip to content

Commit

Permalink
Test bad date format
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Mar 30, 2022
1 parent 574b76a commit dd71dd1
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,6 @@ def test_simple_build_item_dates(self):
self.assertEqual(cli_result.exit_code, 0)
self.assertIsNone(cli_result.exception)

# created items
feed_parsed = feedparser.parse(Path(tmpdirname) / "feed_rss_created.xml")

# updated items
feed_parsed = feedparser.parse(Path(tmpdirname) / "feed_rss_updated.xml")

def test_simple_build_feed_length(self):
with tempfile.TemporaryDirectory() as tmpdirname:
cli_result = self.build_docs_setup(
Expand Down Expand Up @@ -411,7 +405,7 @@ def test_bad_config(self):
with tempfile.TemporaryDirectory() as tmpdirname:
cli_result = self.build_docs_setup(
testproject_path="docs",
mkdocs_yml_filepath=Path("mkdocs_bad_config.yml"),
mkdocs_yml_filepath=Path("tests/fixtures/mkdocs_bad_config.yml"),
output_path=tmpdirname,
strict=True,
)
Expand All @@ -420,6 +414,29 @@ def test_bad_config(self):
self.assertEqual(cli_result.exit_code, 2)
self.assertIsNotNone(cli_result.exception)

def test_bad_date_format(self):
# add a new page without tracking it
md_str = """---\ndate: 13 April 2022\n---\n\n# This page is dynamically created for test purposes\n\nHi!\n
"""
temp_page = Path("tests/fixtures/docs/temp_page_not_in_git_log.md")
if temp_page.exists():
temp_page.unlink()
temp_page.write_text(md_str)

with tempfile.TemporaryDirectory() as tmpdirname:
cli_result = self.build_docs_setup(
testproject_path="docs",
mkdocs_yml_filepath=Path("mkdocs.yml"),
output_path=tmpdirname,
strict=True,
)

self.assertEqual(cli_result.exit_code, 0)
self.assertIsNone(cli_result.exception)

# rm page
temp_page.unlink()

def test_not_in_git_log(self):
# add a new page without tracking it
md_str = """# This page is dynamically created for test purposes\n\nHi!\n
Expand Down

0 comments on commit dd71dd1

Please sign in to comment.