From 807ac939563f4a1d0a182a5dfac32e3ce920fbbd Mon Sep 17 00:00:00 2001 From: kakwa Date: Tue, 20 Oct 2015 20:22:38 +0200 Subject: [PATCH] better unit tests on authentication --- tests/test_LdapCherry.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_LdapCherry.py b/tests/test_LdapCherry.py index 4d69b62..a9dbb61 100644 --- a/tests/test_LdapCherry.py +++ b/tests/test_LdapCherry.py @@ -110,6 +110,16 @@ class TestError(object): app._set_access_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): app = LdapCherry() loadconf('./tests/cfg/ldapcherry.ini', app)