From 649fb7d6a6f78fb0d1be0d2fcc989a8dc27bc0c3 Mon Sep 17 00:00:00 2001 From: Justin Riley Date: Tue, 2 Aug 2016 18:35:17 -0400 Subject: [PATCH] add tests for onedns.logger module --- onedns/tests/test_logging.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 onedns/tests/test_logging.py diff --git a/onedns/tests/test_logging.py b/onedns/tests/test_logging.py new file mode 100644 index 0000000..f2bb22d --- /dev/null +++ b/onedns/tests/test_logging.py @@ -0,0 +1,21 @@ +import logging + +from testfixtures import LogCapture + +from onedns import logger + + +def test_onedns_logger(): + assert not logger.log.handlers + with LogCapture() as log_capture: + logger.configure_onedns_logging() + assert logger.log.handlers + assert logger.console.level == logging.INFO + logger.log.info('test') + logger.configure_onedns_logging(debug=True) + assert logger.console.level == logging.DEBUG + logger.log.debug('test') + log_capture.check( + ('onedns', 'INFO', 'test'), + ('onedns', 'DEBUG', 'test'), + )