Skip to content

Commit

Permalink
Merge pull request #152 from Guts/tests/better-coverage
Browse files Browse the repository at this point in the history
Tests: more use cases, better coverage
  • Loading branch information
Guts authored Oct 13, 2022
2 parents 478d1a9 + 9256d6e commit d825cc9
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 3 deletions.
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ addopts =
--cov-config=setup.cfg
--cov=mkdocs_rss_plugin
--cov-report=html
--cov-report=term
--cov-report=xml
--ignore=tests/_wip/
junit_family = xunit2
Expand All @@ -58,6 +59,7 @@ python_files = test_*.py
testpaths = tests

[coverage:run]
disable_warnings=include-ignored
branch = True
include =
mkdocs_rss_plugin/*
Expand Down
8 changes: 8 additions & 0 deletions tests/fixtures/docs/page_with_meta_bad_date.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
date: 2022-03-30 15:09:34
description: Test page with meta keys as singular and values as iterable
---

# Test page with meta keys as singular

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
1 change: 1 addition & 0 deletions tests/fixtures/mkdocs_complete.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ plugins:
utm_campaign: "feed-syndication"
theme:
name: readthedocs
locale: fr

# Extensions to enhance markdown
markdown_extensions:
Expand Down
7 changes: 4 additions & 3 deletions tests/fixtures/mkdocs_item_categories.yml
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 All @@ -18,6 +18,7 @@ plugins:

theme:
name: readthedocs
language: de

# Extensions to enhance markdown
markdown_extensions:
Expand Down
11 changes: 11 additions & 0 deletions tests/fixtures/mkdocs_minimal_no_site_url.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
site_name: Test RSS Plugin
site_description: Test RSS Plugin
# site_url: https://guts.github.io/mkdocs-rss-plugin

use_directory_urls: true

plugins:
- rss

theme:
name: mkdocs
15 changes: 15 additions & 0 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,21 @@ def test_rss_feed_validation(self):
# some feed characteristics
self.assertEqual(feed_parsed.version, "rss20")

def test_config_no_site_url(self):
with tempfile.TemporaryDirectory() as tmpdirname:
cli_result = self.build_docs_setup(
testproject_path="docs",
mkdocs_yml_filepath=Path(
"tests/fixtures/mkdocs_minimal_no_site_url.yml"
),
output_path=tmpdirname,
strict=True,
)

# cli should returns an error code (1)
self.assertEqual(cli_result.exit_code, 1)
self.assertIsNotNone(cli_result.exception)

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

0 comments on commit d825cc9

Please sign in to comment.