Skip to content

Commit

Permalink
Add test against feed length
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Mar 29, 2022
1 parent 3539912 commit 92c8e71
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ site_name: MkDocs RSS Plugin - TEST
site_description: Basic setup to test against MkDocs RSS plugin
site_author: Julien Moura (Guts)
site_url: https://guts.github.io/mkdocs-rss-plugin
copyright: 'Guts - In Geo Veritas'
copyright: "Guts - In Geo Veritas"

# Repository
repo_name: 'guts/mkdocs-rss-plugin'
repo_url: 'https://github.com/guts/mkdocs-rss-plugin'
repo_name: "guts/mkdocs-rss-plugin"
repo_url: "https://github.com/guts/mkdocs-rss-plugin"

use_directory_urls: true

Expand Down
28 changes: 28 additions & 0 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
# #############################################################################
# ########## Classes ###############
# ##################################


class TestBuildRss(BaseTest):
"""Test MkDocs build with RSS plugin."""

Expand Down Expand Up @@ -82,6 +84,32 @@ def test_simple_build_disabled(self):
self.assertEqual(run_result.exit_code, 0)
self.assertIsNone(run_result.exception)

def test_simple_build_feed_length(self):
with tempfile.TemporaryDirectory() as tmpdirname:
run_result = self.build_docs_setup(
testproject_path="docs",
mkdocs_yml_filepath=Path(
"tests/fixtures/mkdocs_feed_length_custom.yml"
),
output_path=tmpdirname,
)
if run_result.exception is not None:
e = run_result.exception
logger.debug(format_exception(type(e), e, e.__traceback__))

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

# created items
feed_parsed = feedparser.parse(Path(tmpdirname) / "feed_rss_created.xml")
self.assertEqual(feed_parsed.bozo, 0)

# updated items
feed_parsed = feedparser.parse(Path(tmpdirname) / "feed_rss_updated.xml")
self.assertEqual(feed_parsed.bozo, 0)

self.assertEqual(len(feed_parsed.entries), 3)

def test_rss_feed_validation(self):
with tempfile.TemporaryDirectory() as tmpdirname:
self.build_docs_setup(
Expand Down

0 comments on commit 92c8e71

Please sign in to comment.