Commit 10be944e authored by Nicolas Noirbent's avatar Nicolas Noirbent

tests: add get_logger() testcase

parent 9ddcc6dd
......@@ -8,6 +8,8 @@ INSTALLED_APPS = (
'rest_framework',
)
LOG_DIR = "/tmp"
USE_TZ = True
MIDDLEWARE = []
......
# -*- coding: utf-8 -*-
import logging
from unittest import mock
from django.test import TestCase, override_settings
from hexack.utils.logging import get_logger
@mock.patch('os.makedirs', new=mock.Mock())
class LoggingTestCase(TestCase):
def test_get_logger(self):
'''
Test logging using our get_logger().
'''
logger = get_logger('test')
self.assertEqual(logger.level, logging.INFO)
with self.assertLogs(logger, level=logging.CRITICAL):
logger.critical('critical error test')
@override_settings(DEBUG=True)
def test_get_debug_logger(self):
'''
Logger level should be set to DEBUG when settings.DEBUG
'''
logger = get_logger('debug')
self.assertEqual(logger.level, logging.DEBUG)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment