From b653f5512c3c00b14759351eb2a4c1a3c12345c2 Mon Sep 17 00:00:00 2001 From: kakwa Date: Tue, 19 May 2015 18:36:16 +0200 Subject: [PATCH] adding unit test for missing backend --- tests/test_LdapCherry.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/test_LdapCherry.py b/tests/test_LdapCherry.py index 640d28b..a82c929 100644 --- a/tests/test_LdapCherry.py +++ b/tests/test_LdapCherry.py @@ -8,7 +8,7 @@ import pytest import sys from sets import Set from ldapcherry import LdapCherry -from ldapcherry.exceptions import DumplicateRoleKey, MissingKey, DumplicateRoleContent, MissingRolesFile, MissingRole +from ldapcherry.exceptions import * from ldapcherry.pyyamlwrapper import DumplicatedKey, RelationError import cherrypy from cherrypy.process import plugins, servers @@ -60,6 +60,18 @@ class TestError(object): app._set_access_log(cfg, logging.DEBUG) app._set_access_log(cfg, logging.DEBUG) + def testMissingBackend(self): + app = LdapCherry() + loadconf('./tests/cfg/ldapcherry.ini', app) + del app.backends_params['ad'] + try: + app._check_backends() + except MissingBackend: + return + else: + raise AssertionError("expected an exception") + + def testMissingParameters(self): app = LdapCherry() try: