diff --git a/tests/test_LdapCherry.py b/tests/test_LdapCherry.py index b0235ac..81260ee 100644 --- a/tests/test_LdapCherry.py +++ b/tests/test_LdapCherry.py @@ -44,6 +44,9 @@ cherrypy.config.update(configfile) instance.reload(app.config) +class BadModule(): + pass + class TestError(object): def testNominal(self): @@ -51,6 +54,30 @@ loadconf('./tests/cfg/ldapcherry.ini', app) return True + def testMissingBackendModule(self): + app = LdapCherry() + loadconf('./tests/cfg/ldapcherry.ini', app) + cfg = {'backends': {'ldap.module': 'dontexists'}} + try: + app._init_backends(cfg) + except BackendModuleLoadingFail: + return + else: + raise AssertionError("expected an exception") + + def testInitgBackendModuleFail(self): + app = LdapCherry() + loadconf('./tests/cfg/ldapcherry.ini', app) + cfg = {'backends': {'ldap.module': 'ldapcherry.backend'}} + try: + app._init_backends(cfg) + except BackendModuleInitFail: + return + else: + raise AssertionError("expected an exception") + + + def testLog(self): app = LdapCherry() cfg = { 'global' : {}}