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 26 27 28 29 30 31 32 33 34 35 36
|
import unittest
from ansiblelint import RulesCollection, Runner
from ansiblelint.rules.TrailingWhitespaceRule import TrailingWhitespaceRule
class TestWithSkipTagId(unittest.TestCase):
collection = RulesCollection()
collection.register(TrailingWhitespaceRule())
file = 'test/with-skip-tag-id.yml'
def test_negative_no_param(self):
bad_runner = Runner(self.collection, self.file, [], [], [])
errs = bad_runner.run()
self.assertGreater(len(errs), 0)
def test_negative_with_id(self):
with_id = '201'
bad_runner = Runner(self.collection, self.file, [with_id], [], [])
errs = bad_runner.run()
self.assertGreater(len(errs), 0)
def test_negative_with_tag(self):
with_tag = 'ANSIBLE0002'
bad_runner = Runner(self.collection, self.file, [with_tag], [], [])
errs = bad_runner.run()
self.assertGreater(len(errs), 0)
def test_positive_skip_id(self):
skip_id = '201'
good_runner = Runner(self.collection, self.file, [], [skip_id], [])
self.assertEqual([], good_runner.run())
def test_positive_skip_tag(self):
skip_tag = 'ANSIBLE0002'
good_runner = Runner(self.collection, self.file, [], [skip_tag], [])
self.assertEqual([], good_runner.run())
|