1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 09:24:21 +01:00

adding unit test for missing backend

This commit is contained in:
kakwa 2015-05-19 18:36:16 +02:00
parent 2c4ce35b52
commit b653f5512c

View File

@ -8,7 +8,7 @@ import pytest
import sys import sys
from sets import Set from sets import Set
from ldapcherry import LdapCherry from ldapcherry import LdapCherry
from ldapcherry.exceptions import DumplicateRoleKey, MissingKey, DumplicateRoleContent, MissingRolesFile, MissingRole from ldapcherry.exceptions import *
from ldapcherry.pyyamlwrapper import DumplicatedKey, RelationError from ldapcherry.pyyamlwrapper import DumplicatedKey, RelationError
import cherrypy import cherrypy
from cherrypy.process import plugins, servers 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)
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): def testMissingParameters(self):
app = LdapCherry() app = LdapCherry()
try: try: