|
34 | 34 | # ############################################################################# |
35 | 35 | # ########## Classes ############### |
36 | 36 | # ################################## |
| 37 | + |
| 38 | + |
37 | 39 | class TestBuildRss(BaseTest): |
38 | 40 | """Test MkDocs build with RSS plugin.""" |
39 | 41 |
|
@@ -82,6 +84,32 @@ def test_simple_build_disabled(self): |
82 | 84 | self.assertEqual(run_result.exit_code, 0) |
83 | 85 | self.assertIsNone(run_result.exception) |
84 | 86 |
|
| 87 | + def test_simple_build_feed_length(self): |
| 88 | + with tempfile.TemporaryDirectory() as tmpdirname: |
| 89 | + run_result = self.build_docs_setup( |
| 90 | + testproject_path="docs", |
| 91 | + mkdocs_yml_filepath=Path( |
| 92 | + "tests/fixtures/mkdocs_feed_length_custom.yml" |
| 93 | + ), |
| 94 | + output_path=tmpdirname, |
| 95 | + ) |
| 96 | + if run_result.exception is not None: |
| 97 | + e = run_result.exception |
| 98 | + logger.debug(format_exception(type(e), e, e.__traceback__)) |
| 99 | + |
| 100 | + self.assertEqual(run_result.exit_code, 0) |
| 101 | + self.assertIsNone(run_result.exception) |
| 102 | + |
| 103 | + # created items |
| 104 | + feed_parsed = feedparser.parse(Path(tmpdirname) / "feed_rss_created.xml") |
| 105 | + self.assertEqual(feed_parsed.bozo, 0) |
| 106 | + |
| 107 | + # updated items |
| 108 | + feed_parsed = feedparser.parse(Path(tmpdirname) / "feed_rss_updated.xml") |
| 109 | + self.assertEqual(feed_parsed.bozo, 0) |
| 110 | + |
| 111 | + self.assertEqual(len(feed_parsed.entries), 3) |
| 112 | + |
85 | 113 | def test_rss_feed_validation(self): |
86 | 114 | with tempfile.TemporaryDirectory() as tmpdirname: |
87 | 115 | self.build_docs_setup( |
|
0 commit comments