blob: 506d91f09a6e03a24f610313075064b24af04139 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
"""Tests for deprecated-module rule."""
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.deprecated_module import DeprecatedModuleRule
from ansiblelint.testing import RunFromText
MODULE_DEPRECATED = """
- name: Task example
docker:
debug: test
"""
def test_module_deprecated() -> None:
"""Test for deprecated-module."""
collection = RulesCollection()
collection.register(DeprecatedModuleRule())
runner = RunFromText(collection)
results = runner.run_role_tasks_main(MODULE_DEPRECATED)
assert len(results) == 1
# based on version and blend of ansible being used, we may
# get a missing module, so we future proof the test
assert (
"couldn't resolve module" not in results[0].message
or "Deprecated module" not in results[0].message
)
|