1
0
Fork 0
mirror of https://github.com/kakwa/ldapcherry synced 2025-07-04 20:37:48 +02:00

fix log_level + unit tests

* python logging doesn't support the 7 log levels of syslog, compensate it
* adding unit test on log level
This commit is contained in:
kakwa 2015-05-18 23:59:54 +02:00
parent 2ba56128ac
commit bfd1969ab3
2 changed files with 17 additions and 3 deletions

View file

@ -13,6 +13,7 @@ from ldapcherry.pyyamlwrapper import DumplicatedKey, RelationError
import cherrypy
from cherrypy.process import plugins, servers
from cherrypy import Application
import logging
# monkey patching cherrypy to disable config interpolation
def new_as_dict(self, raw=True, vars=None):
@ -49,3 +50,16 @@ class TestError(object):
loadconf('./tests/cfg/ldapcherry.ini', app)
return True
def testLogger(self):
app = LdapCherry()
loadconf('./tests/cfg/ldapcherry.ini', app)
assert app._get_loglevel('debug') is logging.DEBUG and \
app._get_loglevel('notice') is logging.INFO and \
app._get_loglevel('info') is logging.INFO and \
app._get_loglevel('warning') is logging.WARNING and \
app._get_loglevel('err') is logging.ERROR and \
app._get_loglevel('critical') is logging.CRITICAL and \
app._get_loglevel('alert') is logging.CRITICAL and \
app._get_loglevel('emergency') is logging.CRITICAL and \
app._get_loglevel('notalevel') is logging.INFO