diff --git a/lib/CogsPrep.py b/lib/CogsPrep.py index e1ad871..a699a8c 100644 --- a/lib/CogsPrep.py +++ b/lib/CogsPrep.py @@ -8,8 +8,6 @@ work_with_cogs: loads, reloads and unloads cogs files """ from os import listdir, rename -from disnake.ext.commands import Bot - from .Logger import logger @@ -22,7 +20,7 @@ def cog_list(fold: str = './cogs') -> list: async def work_with_cogs(what_do: str, - bot: Bot, + bot, cog: str | list): if isinstance(cog, str): cog = cog.split() diff --git a/tests/test_lib_Cog.py b/tests/test_lib_Cog.py index ea81468..62e9fcf 100644 --- a/tests/test_lib_Cog.py +++ b/tests/test_lib_Cog.py @@ -19,9 +19,10 @@ def test_cog_list(mock_cog_list): @pytest.mark.parametrize("cog", ["cog1.py", "cog2"]) @pytest.mark.parametrize("what_do", ['load', 'unload', 'reload', 'disable', 'enable']) async def test_work_with_cogs(what_do, cog): - mock_logger = mock.MagicMock() - with mock.patch('discord_bot.lib.CogsPrep.logger.info') as mocked_logger: - mock_bot = mock.MagicMock(spec=Bot) + mock_logger = mock.AsyncMock() + with (mock.patch('discord_bot.lib.CogsPrep.logger.info') as mocked_logger): + mock_bot = mock.AsyncMock() + await mock_bot(spec=Bot) with mock.patch('discord_bot.lib.CogsPrep.rename') as mock_rename: mock_rename.return_value = True result = await work_with_cogs(what_do, mock_bot, cog)