From d0935147ee10c1b6d1e2fac4f59c246fa9c04bb9 Mon Sep 17 00:00:00 2001 From: Walavouchey <36758269+Walavouchey@users.noreply.github.com> Date: Thu, 30 Nov 2023 23:09:22 +0100 Subject: [PATCH] add failing test for linux --- tests/test_link_checker.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/test_link_checker.py b/tests/test_link_checker.py index d909360..3ad4b18 100644 --- a/tests/test_link_checker.py +++ b/tests/test_link_checker.py @@ -376,6 +376,34 @@ def test__invalid_newspost_link(self, root): class TestNewspostSectionLinks: + @pytest.mark.parametrize( + "payload", + [ + {"case_sensitive": False, "capitalisation_correct": False, "should_error": False}, + {"case_sensitive": False, "capitalisation_correct": True, "should_error": False}, + {"case_sensitive": True, "capitalisation_correct": False, "should_error": True}, + {"case_sensitive": True, "capitalisation_correct": True, "should_error": False}, + ] + ) + def test__section_link_casing(self, root, payload): + utils.create_files( + root, + ('wiki/First_article/en.md', '## First article') + ) + + link = link_parser.find_link('Check the [first article](/wiki/{}#first-article).' + .format("First_article" if payload["capitalisation_correct"] else "First_Article")) + assert link + error = link_checker.check_link( + article=dummy_article('does/not/matter'), + link=link, redirects={}, references={}, all_articles={}, + case_sensitive=payload["case_sensitive"] + ) + if payload["should_error"]: + assert isinstance(error, error_types.LinkNotFoundError) + else: + assert error is None + def test__valid_newspost_section_link_within_post(self, root): utils.create_files( root,