diff --git a/tests/test_LdapCherry.py b/tests/test_LdapCherry.py index a9dbb61..a043d9c 100644 --- a/tests/test_LdapCherry.py +++ b/tests/test_LdapCherry.py @@ -156,6 +156,7 @@ class TestError(object): def testLogin(self): app = LdapCherry() loadconf('./tests/cfg/ldapcherry_test.ini', app) + app.auth_mode = 'or' try: app.login('jwatson', 'passwordwatson') except cherrypy.HTTPRedirect as e: @@ -164,6 +165,18 @@ class TestError(object): else: raise AssertionError("expected an exception") + def testLoginFailure(self): + app = LdapCherry() + loadconf('./tests/cfg/ldapcherry_test.ini', app) + app.auth_mode = 'or' + try: + app.login('jwatson', 'wrongPassword') + except cherrypy.HTTPRedirect as e: + expected = 'http://127.0.0.1:8080/signin' + assert e[0][0] == expected + else: + raise AssertionError("expected an exception") + def testSearch(self): app = LdapCherry() loadconf('./tests/cfg/ldapcherry_test.ini', app)