improve Python test to cover low level FascistCheck
Gbp-Pq: Name improve_test_737040.patch
This commit is contained in:
parent
6cbfe96595
commit
4fcca984e4
|
@ -15,6 +15,13 @@ dictpath = None
|
|||
|
||||
|
||||
class TestModuleFunctions(unittest.TestCase):
|
||||
def test_FascistCheck(self):
|
||||
try:
|
||||
cracklib.FascistCheck('test', dictpath=dictpath)
|
||||
self.fail('expected ValueError')
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
def test_VeryFascistCheck(self):
|
||||
try:
|
||||
cracklib.VeryFascistCheck('test', dictpath=dictpath)
|
||||
|
@ -109,7 +116,9 @@ class TestModuleFunctions(unittest.TestCase):
|
|||
def test_simple_combinations(self):
|
||||
testset = '#a' * (cracklib.MIN_LENGTH // 2)
|
||||
for passwd in [testset[:i] for i in range(
|
||||
cracklib.MIN_LENGTH - cracklib.LOW_CREDIT - cracklib.OTH_CREDIT)]:
|
||||
cracklib.MIN_LENGTH -
|
||||
cracklib.LOW_CREDIT -
|
||||
cracklib.OTH_CREDIT)]:
|
||||
self.assertEquals(
|
||||
1, cracklib.simple(passwd),
|
||||
'password {0} should be detected as too simple'.format(
|
||||
|
@ -127,7 +136,7 @@ def run(verbosity=1, repeat=1, use_dictpath=None):
|
|||
print(('cracklib is installed in: ' + os.path.dirname(__file__)))
|
||||
print(('cracklib version: ' + __version__))
|
||||
print((sys.version))
|
||||
dictpath=use_dictpath
|
||||
dictpath = use_dictpath
|
||||
|
||||
suite = unittest.TestSuite()
|
||||
for cls in tests:
|
||||
|
|
Loading…
Reference in New Issue