
The custom ansible-lint rule APTRepositoryCacheUpdateRule was added in 67bfc907030d7f0ce6fbb63f0608aa021f0b5400, this change adds tests to validate its functionality. Change-Id: Ie0642cc41c016fc016b2bc6fc6d04b6afdf2be2c Partial-bug: 1750656
23 lines
796 B
Python
23 lines
796 B
Python
import unittest
|
|
|
|
from ansiblelint import RulesCollection, Runner
|
|
from APTRepositoryCacheUpdateRule import APTRepositoryCacheUpdateRule
|
|
|
|
|
|
class TestAPTRepositoryCacheUpdateRule(unittest.TestCase):
|
|
collection = RulesCollection()
|
|
|
|
def setUp(self):
|
|
self.collection.register(APTRepositoryCacheUpdateRule())
|
|
|
|
def test_file_positive(self):
|
|
success = 'ansible-lint/test/apt-repository-cache-update-success.yml'
|
|
good_runner = Runner(self.collection, success, [], [], [])
|
|
self.assertEqual([], good_runner.run())
|
|
|
|
def test_file_negative(self):
|
|
failure = 'ansible-lint/test/apt-repository-cache-update-failure.yml'
|
|
bad_runner = Runner(self.collection, failure, [], [], [])
|
|
errs = bad_runner.run()
|
|
self.assertEqual(4, len(errs))
|