diff options
Diffstat (limited to '')
-rw-r--r-- | test/test_internal_rules.py | 29 |
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" |