summaryrefslogtreecommitdiffstats
path: root/test/rules/test_package_latest.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/rules/test_package_latest.py')
-rw-r--r--test/rules/test_package_latest.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/rules/test_package_latest.py b/test/rules/test_package_latest.py
new file mode 100644
index 0000000..5631f02
--- /dev/null
+++ b/test/rules/test_package_latest.py
@@ -0,0 +1,23 @@
+"""Tests for package-latest rule."""
+from ansiblelint.rules import RulesCollection
+from ansiblelint.rules.package_latest import PackageIsNotLatestRule
+from ansiblelint.runner import Runner
+
+
+def test_package_not_latest_positive() -> None:
+ """Positive test for package-latest."""
+ collection = RulesCollection()
+ collection.register(PackageIsNotLatestRule())
+ success = "examples/playbooks/package-check-success.yml"
+ good_runner = Runner(success, rules=collection)
+ assert [] == good_runner.run()
+
+
+def test_package_not_latest_negative() -> None:
+ """Negative test for package-latest."""
+ collection = RulesCollection()
+ collection.register(PackageIsNotLatestRule())
+ failure = "examples/playbooks/package-check-failure.yml"
+ bad_runner = Runner(failure, rules=collection)
+ errs = bad_runner.run()
+ assert len(errs) == 4