From ec3956ed54f9a35381eed029a17db52b09c5fbfc Mon Sep 17 00:00:00 2001 From: Diogo Munaro Vieira Date: Mon, 20 Apr 2020 10:24:43 -0300 Subject: [PATCH] Even more tests for log --- tests/test_hooks/test_logging.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_hooks/test_logging.py b/tests/test_hooks/test_logging.py index 3c123a4..a23fc8f 100644 --- a/tests/test_hooks/test_logging.py +++ b/tests/test_hooks/test_logging.py @@ -1,3 +1,4 @@ +import logging from asynctest import TestCase, Mock, patch from barterdude.hooks.logging import Logging @@ -9,6 +10,20 @@ def setUp(self): self.message = Mock() self.logging = Logging() + async def test_should_access_logger(self): + log = Logging("my_log", logging.DEBUG) + logger = log.logger + self.assertEqual( + type(logger), + logging.Logger + ) + self.assertEqual( + type(logger.handlers[0]), + logging.StreamHandler + ) + self.assertEqual(logger.name, "my_log") + self.assertEqual(logger.level, logging.DEBUG) + @patch("barterdude.hooks.logging.Logging.logger") @patch("barterdude.hooks.logging.json.dumps") async def test_should_log_before_consume(self, dumps, logger):