diff --git a/tests/test_LdapCherry.py b/tests/test_LdapCherry.py index 81260ee..3fe0645 100644 --- a/tests/test_LdapCherry.py +++ b/tests/test_LdapCherry.py @@ -15,6 +15,8 @@ from cherrypy.process import plugins, servers from cherrypy import Application import logging +cherrypy.session = {} + # monkey patching cherrypy to disable config interpolation def new_as_dict(self, raw=True, vars=None): """Convert an INI file to a dictionary""" @@ -76,8 +78,6 @@ class TestError(object): else: raise AssertionError("expected an exception") - - def testLog(self): app = LdapCherry() cfg = { 'global' : {}} @@ -113,6 +113,17 @@ class TestError(object): e = Exception() app._handle_exception(e) + def testLogin(self): + app = LdapCherry() + loadconf('./tests/cfg/ldapcherry.ini', app) + try: + app.login('jwatson', 'passwordwatson') + except cherrypy.HTTPRedirect as e: + expected = 'http://127.0.0.1:8080/' + assert e[0][0] == expected + else: + raise AssertionError("expected an exception") + def testLogger(self): app = LdapCherry() loadconf('./tests/cfg/ldapcherry.ini', app)