def test_dictDoesNotExist(self):
     try:
         ppolicy = lcppolicy_cracklib.PPolicy(config_errordictpath, cherrypy.log)
     except OSError:
         return
     else:
         raise AssertionError("expected an exception")
 def test_dictNotAbsPath(self):
     try:
         ppolicy = lcppolicy_cracklib.PPolicy(config_errordictnotabspath, cherrypy.log)
     except Exception as e:
         assert str(e) == 'dict_path must be absolute, or not declared'
     else:
         raise AssertionError("expected an exception")
 def test_digits(self):
     password = '******'
     ppolicy = lcppolicy_cracklib.PPolicy(config, cherrypy.log)
     ret = ppolicy.check(password)
     exp = {'match': False, 'reason': 'Password has not enough digits'}
     assert exp == ret
 def test_lower(self):
     password = '******'
     ppolicy = lcppolicy_cracklib.PPolicy(config, cherrypy.log)
     ret = ppolicy.check(password)
     exp = {'match': False, 'reason': 'Password has not enough lower case characters'}
     assert exp == ret
 def test_base(self):
     ppolicy = lcppolicy_cracklib.PPolicy(config, cherrypy.log)
     ret = ppolicy.check(password)
     exp = {'match': True, 'reason': 'Password ok'}
     assert exp == ret
 def test_Dict(self):
     password = '******'
     ppolicy = lcppolicy_cracklib.PPolicy(config_dict, cherrypy.log)
     ret = ppolicy.check(password)
     exp = {'match': False, 'reason': 'Password is based on a dictionary word'}
     assert exp == ret
 def test_other(self):
     password = '******'
     ppolicy = lcppolicy_cracklib.PPolicy(config, cherrypy.log)
     ret = ppolicy.check(password)
     exp = {'match': False, 'reason': 'Password is too short'}
     assert exp == ret
 def test_other(self):
     password = '******'
     ppolicy = lcppolicy_cracklib.PPolicy(config, cherrypy.log)
     ret = ppolicy.check(password)
     exp = {'match': False, 'reason': 'Password has not enough non alphanumeric characters'}
     assert exp == ret