diff options
| author | 2019-12-08 02:01:01 -0800 | |
|---|---|---|
| committer | 2019-12-08 02:20:21 -0800 | |
| commit | 23acfce3521cd420a2df6eb51f036a2a54140ef6 (patch) | |
| tree | 8b4d0b6e3a0a0c65d803b9782ec095329a7e2f03 /tests | |
| parent | Properly create and close aiohttp sessions (diff) | |
Fix test failures for setup log messages
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bot/cogs/test_duck_pond.py | 12 | ||||
| -rw-r--r-- | tests/bot/cogs/test_security.py | 11 | ||||
| -rw-r--r-- | tests/bot/cogs/test_token_remover.py | 8 | 
3 files changed, 7 insertions, 24 deletions
| diff --git a/tests/bot/cogs/test_duck_pond.py b/tests/bot/cogs/test_duck_pond.py index b801e86f1..d07b2bce1 100644 --- a/tests/bot/cogs/test_duck_pond.py +++ b/tests/bot/cogs/test_duck_pond.py @@ -578,15 +578,7 @@ class DuckPondSetupTests(unittest.TestCase):      """Tests setup of the `DuckPond` cog."""      def test_setup(self): -        """Setup of the cog should log a message at `INFO` level.""" +        """Setup of the extension should call add_cog."""          bot = helpers.MockBot() -        log = logging.getLogger('bot.cogs.duck_pond') - -        with self.assertLogs(logger=log, level=logging.INFO) as log_watcher: -            duck_pond.setup(bot) - -        self.assertEqual(len(log_watcher.records), 1) -        record = log_watcher.records[0] -        self.assertEqual(record.levelno, logging.INFO) - +        duck_pond.setup(bot)          bot.add_cog.assert_called_once() diff --git a/tests/bot/cogs/test_security.py b/tests/bot/cogs/test_security.py index efa7a50b1..9d1a62f7e 100644 --- a/tests/bot/cogs/test_security.py +++ b/tests/bot/cogs/test_security.py @@ -1,4 +1,3 @@ -import logging  import unittest  from unittest.mock import MagicMock @@ -49,11 +48,7 @@ class SecurityCogLoadTests(unittest.TestCase):      """Tests loading the `Security` cog."""      def test_security_cog_load(self): -        """Cog loading logs a message at `INFO` level.""" +        """Setup of the extension should call add_cog."""          bot = MagicMock() -        with self.assertLogs(logger='bot.cogs.security', level=logging.INFO) as cm: -            security.setup(bot) -            bot.add_cog.assert_called_once() - -        [line] = cm.output -        self.assertIn("Cog loaded: Security", line) +        security.setup(bot) +        bot.add_cog.assert_called_once() diff --git a/tests/bot/cogs/test_token_remover.py b/tests/bot/cogs/test_token_remover.py index 3276cf5a5..a54b839d7 100644 --- a/tests/bot/cogs/test_token_remover.py +++ b/tests/bot/cogs/test_token_remover.py @@ -125,11 +125,7 @@ class TokenRemoverSetupTests(unittest.TestCase):      """Tests setup of the `TokenRemover` cog."""      def test_setup(self): -        """Setup of the cog should log a message at `INFO` level.""" +        """Setup of the extension should call add_cog."""          bot = MockBot() -        with self.assertLogs(logger='bot.cogs.token_remover', level=logging.INFO) as cm: -            setup_cog(bot) - -        [line] = cm.output +        setup_cog(bot)          bot.add_cog.assert_called_once() -        self.assertIn("Cog loaded: TokenRemover", line) | 
