diff --git a/tests/cfg/ldapcherry.ini b/tests/cfg/ldapcherry.ini index b04dbd7..0be7a75 100644 --- a/tests/cfg/ldapcherry.ini +++ b/tests/cfg/ldapcherry.ini @@ -99,6 +99,16 @@ auth.mode = 'or' # custom auth module to load #auth.module = 'ldapcherry.auth.modNone' +[ppolicy] + +# password policy module +ppolicy.module = 'ldapcherry.ppolicy.simple' + +# parameters of the module +min_length = 8 +min_upper = 1 +min_digit = 1 + # resources parameters [resources] # templates directory diff --git a/tests/test_LdapCherry.py b/tests/test_LdapCherry.py index 67d18df..5249b9c 100644 --- a/tests/test_LdapCherry.py +++ b/tests/test_LdapCherry.py @@ -87,6 +87,13 @@ class TestError(object): app._set_access_log(cfg, logging.DEBUG) app._set_error_log(cfg, logging.DEBUG) + def testPPolicy(self): + app = LdapCherry() + loadconf('./tests/cfg/ldapcherry.ini', app) + wrong = app._checkppolicy('password')['match'] + good = app._checkppolicy('Passw0rd.')['match'] + assert wrong == False and good == True + def testMissingBackend(self): app = LdapCherry() loadconf('./tests/cfg/ldapcherry.ini', app)