Skip to content

Commit b5845d9

Browse files
committed
Add complete config
1 parent c4b3649 commit b5845d9

3 files changed

Lines changed: 61 additions & 5 deletions

File tree

tests/fixtures/docs/page_with_meta.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
---
2-
title: Use the MkDocs RSS Plugin
2+
title: Use the MkDocs RSS Plugin with confidence
33
authors:
44
- Guts
55
- Tim Vink
66
- liang2kl
77
date: 2020-03-20 10:20
88
description: First test page of mkdocs-rss-plugin test suite
9+
image: "https://svgsilh.com/png-512/97849.png"
910
tags:
1011
- test
1112
---

tests/fixtures/mkdocs_complete.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,24 @@ use_directory_urls: true
1313

1414
plugins:
1515
- rss:
16-
abstract_chars_count: 200
16+
abstract_chars_count: 160 # -1 for full content
17+
categories:
18+
- tags
1719
comments_path: "#__comments"
18-
feed_ttl: 90
19-
length: 3
20-
20+
date_from_meta:
21+
as_creation: "date"
22+
as_update: false
23+
datetime_format: "%Y-%m-%d %H:%M"
24+
enabled: true
25+
feed_ttl: 1440
26+
image: https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Feed-icon.svg/128px-Feed-icon.svg.png
27+
length: 20
28+
pretty_print: false
29+
match_path: ".*"
30+
url_parameters:
31+
utm_source: "documentation"
32+
utm_medium: "RSS"
33+
utm_campaign: "feed-syndication"
2134
theme:
2235
name: readthedocs
2336

tests/test_build.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,48 @@ def test_simple_build_minimal(self):
118118
if feed_item.title in ("Test page with meta",):
119119
self.assertTrue("author" in feed_item)
120120

121+
def test_simple_build_complete(self):
122+
with tempfile.TemporaryDirectory() as tmpdirname:
123+
cli_result = self.build_docs_setup(
124+
testproject_path="docs",
125+
mkdocs_yml_filepath=Path("tests/fixtures/mkdocs_complete.yml"),
126+
output_path=tmpdirname,
127+
strict=True,
128+
)
129+
130+
if cli_result.exception is not None:
131+
e = cli_result.exception
132+
logger.debug(format_exception(type(e), e, e.__traceback__))
133+
134+
self.assertEqual(cli_result.exit_code, 0)
135+
self.assertIsNone(cli_result.exception)
136+
137+
# created items
138+
feed_parsed = feedparser.parse(Path(tmpdirname) / "feed_rss_created.xml")
139+
for feed_item in feed_parsed.entries:
140+
141+
# mandatory properties
142+
self.assertTrue("description" in feed_item)
143+
self.assertTrue("guid" in feed_item)
144+
self.assertTrue("link" in feed_item)
145+
self.assertTrue("published" in feed_item)
146+
self.assertTrue("source" in feed_item)
147+
self.assertTrue("title" in feed_item)
148+
149+
# optional - following should not be present in the feed by default
150+
if (
151+
"without_meta" in feed_item.title
152+
or feed_item.title == "Test home page"
153+
):
154+
self.assertTrue("category" not in feed_item)
155+
self.assertTrue("comments" in feed_item)
156+
elif "with_meta" in feed_item.title:
157+
self.assertTrue("author" in feed_item)
158+
self.assertTrue("category" in feed_item)
159+
self.assertTrue("enclosure" in feed_item)
160+
else:
161+
pass
162+
121163
def test_simple_build_disabled(self):
122164
with tempfile.TemporaryDirectory() as tmpdirname:
123165
cli_result = self.build_docs_setup(

0 commit comments

Comments
 (0)