
Lint rule to make sure no module argument looking like "password" will get logged. Change-Id: I180b77faf7aaab57d1c48fc993e43f08c4fb16f6 Closes-Bug: #1760878
23 lines
734 B
Python
23 lines
734 B
Python
import unittest
|
|
|
|
from ansiblelint import RulesCollection, Runner
|
|
from NoLogPasswordsRule import NoLogPasswordsRule
|
|
|
|
|
|
class TestNoLogPasswordsRule(unittest.TestCase):
|
|
collection = RulesCollection()
|
|
|
|
def setUp(self):
|
|
self.collection.register(NoLogPasswordsRule())
|
|
|
|
def test_file_positive(self):
|
|
success = 'ansible-lint/test/no-log-passwords-success.yml'
|
|
good_runner = Runner(self.collection, success, [], [], [])
|
|
self.assertEqual([], good_runner.run())
|
|
|
|
def test_file_negative(self):
|
|
failure = 'ansible-lint/test/no-log-passwords-failure.yml'
|
|
bad_runner = Runner(self.collection, failure, [], [], [])
|
|
errs = bad_runner.run()
|
|
self.assertEqual(3, len(errs))
|