Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ dmypy.json
# ## Custom ######################
# ################################

*.patch
**/*.xml
mkdocs_rss_plugin/_version.py
site/
Expand Down
29 changes: 21 additions & 8 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,15 @@ def test_simple_build_minimal(self):
# optional - following should not be present in the feed by default
self.assertTrue("category" not in feed_item)
self.assertTrue("comments" not in feed_item)
self.assertTrue("enclosure" not in feed_item)

if feed_item.title in ("Test page with meta",):
if feed_item.title == "Page with complete meta":
self.assertTrue("author" in feed_item)
self.assertTrue(feed_item.enclosures)

# make sure the conditional assertions above actually ran
self.assertIn(
"Page with complete meta", {e.title for e in feed_parsed.entries}
)

def test_simple_build_complete(self):
with tempfile.TemporaryDirectory() as tmpdirname:
Expand Down Expand Up @@ -152,17 +157,20 @@ def test_simple_build_complete(self):

# optional - following should not be present in the feed by default
if (
"without_meta" in feed_item.title
feed_item.title.startswith("Page without meta")
or feed_item.title == "Test home page"
):
self.assertTrue("category" not in feed_item)
self.assertTrue("comments" in feed_item)
elif "with_meta" in feed_item.title:
elif feed_item.title == "Page with complete meta":
self.assertTrue("author" in feed_item)
self.assertTrue("category" in feed_item)
self.assertTrue("enclosure" in feed_item)
else:
pass
self.assertTrue(feed_item.enclosures)

# make sure the conditional assertions above actually ran
self.assertIn(
"Page with complete meta", {e.title for e in feed_parsed.entries}
)

def test_simple_build_disabled(self):
with tempfile.TemporaryDirectory() as tmpdirname:
Expand Down Expand Up @@ -326,9 +334,14 @@ def test_simple_build_item_categories_enabled(self):
feed_parsed = feedparser.parse(Path(tmpdirname) / OUTPUT_RSS_FEED_CREATED)

for feed_item in feed_parsed.entries:
if feed_item.title in ("Test page with meta",):
if feed_item.title == "Page with complete meta":
self.assertTrue("category" in feed_item)

# make sure the conditional assertion above actually ran
self.assertIn(
"Page with complete meta", {e.title for e in feed_parsed.entries}
)

def test_simple_build_item_comments_enabled(self):
with tempfile.TemporaryDirectory() as tmpdirname:
cli_result = self.build_docs_setup(
Expand Down
Loading