summaryrefslogtreecommitdiffstats
path: root/test/test_internal_rules.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:24:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:24:58 +0000
commitba233a0cbad76b4783a03893e7bf4716fbc0f0ec (patch)
treead369728c1edbe3631c8150585659078ae5d7d0b /test/test_internal_rules.py
parentReleasing progress-linux version 6.17.2-3~progress7.99u1. (diff)
downloadansible-lint-ba233a0cbad76b4783a03893e7bf4716fbc0f0ec.tar.xz
ansible-lint-ba233a0cbad76b4783a03893e7bf4716fbc0f0ec.zip
Merging upstream version 24.6.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/test_internal_rules.py')
-rw-r--r--test/test_internal_rules.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/test/test_internal_rules.py b/test/test_internal_rules.py
index b949238..e1cc69e 100644
--- a/test/test_internal_rules.py
+++ b/test/test_internal_rules.py
@@ -1,8 +1,35 @@
"""Tests for internal rules."""
+
+import pytest
+
from ansiblelint._internal.rules import BaseRule
+from ansiblelint.rules import RulesCollection
+from ansiblelint.runner import Runner
def test_base_rule_url() -> None:
"""Test that rule URL is set to expected value."""
rule = BaseRule()
- assert rule.url == "https://ansible-lint.readthedocs.io/rules/"
+ assert rule.url == "https://ansible.readthedocs.io/projects/lint/rules/"
+
+
+@pytest.mark.parametrize(
+ ("path"),
+ (
+ pytest.param(
+ "examples/playbooks/incorrect_module_args.yml",
+ id="playbook",
+ ),
+ ),
+)
+def test_incorrect_module_args(
+ path: str,
+ default_rules_collection: RulesCollection,
+) -> None:
+ """Check that we fail when file encoding is wrong."""
+ runner = Runner(path, rules=default_rules_collection)
+ matches = runner.run()
+ assert len(matches) == 1, matches
+ assert matches[0].rule.id == "load-failure"
+ assert "Failed to find required 'name' key in include_role" in matches[0].message
+ assert matches[0].tag == "internal-error"