1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 09:24:21 +01:00

better unit tests on authentication

This commit is contained in:
kakwa 2015-10-20 20:22:38 +02:00
parent 9ecd97a8d0
commit 807ac93956

View File

@ -110,6 +110,16 @@ class TestError(object):
app._set_access_log(cfg, logging.DEBUG) app._set_access_log(cfg, logging.DEBUG)
app._set_error_log(cfg, logging.DEBUG) app._set_error_log(cfg, logging.DEBUG)
def testAuth(self):
app = LdapCherry()
loadconf('./tests/cfg/ldapcherry_test.ini', app)
app.auth_mode = 'and'
ret1 = app._auth('jsmith', 'passwordsmith')
app.auth_mode = 'or'
ret2 = app._auth('jsmith', 'passwordsmith')
assert ret2 == {'connected': True, 'isadmin': False} and \
ret1 == {'connected': True, 'isadmin': False}
def testPPolicy(self): def testPPolicy(self):
app = LdapCherry() app = LdapCherry()
loadconf('./tests/cfg/ldapcherry.ini', app) loadconf('./tests/cfg/ldapcherry.ini', app)