Skip to content

Commit 574b76a

Browse files
committed
Test customized meta dates
1 parent f388c09 commit 574b76a

3 files changed

Lines changed: 48 additions & 1 deletion

File tree

tests/fixtures/docs/page_with_meta.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
2-
title: Use the MkDocs RSS Plugin with confidence
2+
title: Page with complete meta
33
authors:
44
- Guts
55
- Tim Vink
66
- liang2kl
77
date: 2020-03-20 10:20
8+
update: 2022-03-30 10:20
89
description: First test page of mkdocs-rss-plugin test suite
910
image: "https://svgsilh.com/png-512/97849.png"
1011
tags:
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Project information
2+
site_name: MkDocs RSS Plugin - TEST
3+
site_description: Basic setup to test against MkDocs RSS plugin
4+
site_author: Julien Moura (Guts)
5+
site_url: https://guts.github.io/mkdocs-rss-plugin
6+
copyright: 'Guts - In Geo Veritas'
7+
8+
# Repository
9+
repo_name: 'guts/mkdocs-rss-plugin'
10+
repo_url: 'https://github.com/guts/mkdocs-rss-plugin'
11+
12+
use_directory_urls: true
13+
14+
plugins:
15+
- rss:
16+
date_from_meta:
17+
as_creation: "date"
18+
as_update: "update"
19+
datetime_format: "%Y-%m-%d %H:%M"
20+
21+
theme:
22+
name: readthedocs
23+
24+
# Extensions to enhance markdown
25+
markdown_extensions:
26+
- meta

tests/test_build.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,26 @@ def test_simple_build_disabled(self):
174174
self.assertEqual(cli_result.exit_code, 0)
175175
self.assertIsNone(cli_result.exception)
176176

177+
def test_simple_build_item_dates(self):
178+
with tempfile.TemporaryDirectory() as tmpdirname:
179+
cli_result = self.build_docs_setup(
180+
testproject_path="docs",
181+
mkdocs_yml_filepath=Path("tests/fixtures/mkdocs_dates_overridden.yml"),
182+
output_path=tmpdirname,
183+
)
184+
if cli_result.exception is not None:
185+
e = cli_result.exception
186+
logger.debug(format_exception(type(e), e, e.__traceback__))
187+
188+
self.assertEqual(cli_result.exit_code, 0)
189+
self.assertIsNone(cli_result.exception)
190+
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+
177197
def test_simple_build_feed_length(self):
178198
with tempfile.TemporaryDirectory() as tmpdirname:
179199
cli_result = self.build_docs_setup(

0 commit comments

Comments
 (0)