summaryrefslogtreecommitdiffstats
path: root/test/rules/test_deprecated_module.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 16:04:56 +0000
commitd964cec5e6aa807b75c7a4e7cdc5f11e54b2eda2 (patch)
tree794bc3738a00b5e599f06d1f2f6d79048d87ff8e /test/rules/test_deprecated_module.py
parentInitial commit. (diff)
downloadansible-lint-d964cec5e6aa807b75c7a4e7cdc5f11e54b2eda2.tar.xz
ansible-lint-d964cec5e6aa807b75c7a4e7cdc5f11e54b2eda2.zip
Adding upstream version 6.13.1.upstream/6.13.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/rules/test_deprecated_module.py')
-rw-r--r--test/rules/test_deprecated_module.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/rules/test_deprecated_module.py b/test/rules/test_deprecated_module.py
new file mode 100644
index 0000000..506d91f
--- /dev/null
+++ b/test/rules/test_deprecated_module.py
@@ -0,0 +1,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
+ )