mirror of
https://github.com/zensical/zensical.git
synced 2026-09-24 23:35:35 +00:00
fix: relax validation of autorefs settings
Signed-off-by: Timothée Mazzucotelli <dev@pawamoy.fr>
This commit is contained in:
Vendored
+7
-1
@@ -572,8 +572,14 @@ class TestPluginShimming:
|
||||
)
|
||||
|
||||
def test_autorefs_standalone(self, tmp_path: Path) -> None:
|
||||
config = self._parse_yaml(tmp_path, plugins={"autorefs": {}})
|
||||
options = {
|
||||
"resolve_closest": True,
|
||||
"link_titles": "external",
|
||||
"strip_title_tags": False,
|
||||
}
|
||||
config = self._parse_yaml(tmp_path, plugins={"autorefs": options})
|
||||
assert AutorefsExtension.name in config["markdown_extensions"]
|
||||
assert config["plugins"]["autorefs"]["config"] == {}
|
||||
|
||||
def test_autorefs_disabled_not_added(
|
||||
self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path
|
||||
|
||||
+14
@@ -265,6 +265,20 @@ def test_accepts_supported_shim_options(
|
||||
assert plugins[name]["config"] == config
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"option", ["resolve_closest", "link_titles", "strip_title_tags"]
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"value", [True, False, "auto", "external", 42, [], {}, None]
|
||||
)
|
||||
def test_silently_discards_unsupported_autorefs_options(
|
||||
option: str, value: Any, capsys: pytest.CaptureFixture[str]
|
||||
) -> None:
|
||||
plugins = _convert_plugins({"autorefs": {"enabled": True, option: value}})
|
||||
assert plugins["autorefs"]["config"] == {"enabled": True}
|
||||
assert capsys.readouterr().err == ""
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("name", "config", "message"),
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user