1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-25 10:44:30 +01:00

adding unit test for ppolicy

This commit is contained in:
kakwa 2015-07-03 20:26:02 +02:00
parent cd13bf5d22
commit 4a55d040f9
2 changed files with 17 additions and 0 deletions

View File

@ -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

View File

@ -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)