From cd8ed8bc5793985df2c1692072a932ceee517b95 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 8 Jul 2026 02:13:35 +0200 Subject: OPEN THE RUST GATES Signed-off-by: salmonik --- tests/cogs/test_tts.py | 58 -------------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 tests/cogs/test_tts.py (limited to 'tests/cogs/test_tts.py') diff --git a/tests/cogs/test_tts.py b/tests/cogs/test_tts.py deleted file mode 100644 index c6563e6..0000000 --- a/tests/cogs/test_tts.py +++ /dev/null @@ -1,58 +0,0 @@ -import pytest -from unittest.mock import AsyncMock, patch, MagicMock -import discord -from conftest import MockApplicationContext - - -@pytest.fixture -def tts_cog(bot): - from cogs.tts import TTS - cog = TTS(bot) - return cog - - -@pytest.mark.asyncio -async def test_tts_file_output(tts_cog, mock_channel, mock_guild, bot, mock_user): - ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) - ctx.user = mock_user - ctx.author = mock_user - - "/tmp/test_tts.mp3" - - with patch('cogs.tts.gTTS') as _: - with patch('os.path.exists', return_value=True): - with patch('os.unlink'): - with patch.object(ctx, 'respond', new_callable=AsyncMock) as mock_respond: - with patch('cogs.tts.get_volume', return_value=1.0): - await tts_cog.tts.callback(tts_cog, ctx, text="Hello", output="file") - mock_respond.assert_called_once() - - -@pytest.mark.asyncio -async def test_tts_voice_output_not_in_channel(tts_cog, mock_channel, mock_guild, bot, mock_user): - ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) - ctx.user = mock_user - ctx.author = mock_user - ctx.author.voice = None - - with patch('cogs.tts.gTTS'): - with patch('os.path.exists', return_value=True): - with patch('os.unlink'): - with patch.object(ctx, 'respond', new_callable=AsyncMock) as mock_respond: - with patch('cogs.tts.get_volume', return_value=1.0): - await tts_cog.tts.callback(tts_cog, ctx, text="Hello", output="vc") - - -@pytest.mark.asyncio -async def test_tts_error_handling(tts_cog, mock_channel, mock_guild, bot, mock_user): - ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) - ctx.user = mock_user - ctx.author = mock_user - - with patch('cogs.tts.gTTS', side_effect=Exception("TTS Error")): - with patch('os.path.exists', return_value=False): - with patch.object(ctx, 'respond', new_callable=AsyncMock) as mock_respond: - await tts_cog.tts.callback(tts_cog, ctx, text="Hello", output="file") - mock_respond.assert_called_once() - args = mock_respond.call_args - assert "Error" in str(args) or "eror" in str(args) -- cgit v1.2.3