diff options
Diffstat (limited to 'tests/cogs/test_ai.py')
| -rw-r--r-- | tests/cogs/test_ai.py | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/tests/cogs/test_ai.py b/tests/cogs/test_ai.py deleted file mode 100644 index aab9861..0000000 --- a/tests/cogs/test_ai.py +++ /dev/null | |||
| @@ -1,43 +0,0 @@ | |||
| 1 | import pytest | ||
| 2 | from unittest.mock import AsyncMock, patch, MagicMock | ||
| 3 | from conftest import MockApplicationContext | ||
| 4 | |||
| 5 | |||
| 6 | @pytest.fixture | ||
| 7 | def ai_cog(bot): | ||
| 8 | from cogs.ai import AI | ||
| 9 | cog = AI(bot) | ||
| 10 | return cog | ||
| 11 | |||
| 12 | |||
| 13 | @pytest.mark.asyncio | ||
| 14 | async def test_senator_command_success(ai_cog, mock_channel, mock_guild, bot): | ||
| 15 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) | ||
| 16 | |||
| 17 | with patch('cogs.ai.llm_completion', new_callable=AsyncMock, return_value="Test response from AI") as mock_llm: | ||
| 18 | with patch.object(ctx, 'send_followup', new_callable=AsyncMock) as mock_followup: | ||
| 19 | await ai_cog.senator.callback(ai_cog, ctx, text="Hello", tts=False) | ||
| 20 | mock_llm.assert_awaited_once() | ||
| 21 | mock_followup.assert_called_once_with("Test response from AI") | ||
| 22 | |||
| 23 | |||
| 24 | @pytest.mark.asyncio | ||
| 25 | async def test_senator_command_empty_choices(ai_cog, mock_channel, mock_guild, bot): | ||
| 26 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) | ||
| 27 | |||
| 28 | with patch('cogs.ai.llm_completion', new_callable=AsyncMock, return_value=None) as mock_llm: | ||
| 29 | with patch.object(ctx, 'send_followup', new_callable=AsyncMock) as mock_followup: | ||
| 30 | await ai_cog.senator.callback(ai_cog, ctx, text="Hello", tts=False) | ||
| 31 | mock_llm.assert_awaited_once() | ||
| 32 | mock_followup.assert_called_once_with("bot siem zesroł") | ||
| 33 | |||
| 34 | |||
| 35 | @pytest.mark.asyncio | ||
| 36 | async def test_senator_command_no_choices_key(ai_cog, mock_channel, mock_guild, bot): | ||
| 37 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) | ||
| 38 | |||
| 39 | with patch('cogs.ai.llm_completion', new_callable=AsyncMock, return_value=None) as mock_llm: | ||
| 40 | with patch.object(ctx, 'send_followup', new_callable=AsyncMock) as mock_followup: | ||
| 41 | await ai_cog.senator.callback(ai_cog, ctx, text="Hello", tts=False) | ||
| 42 | mock_llm.assert_awaited_once() | ||
| 43 | mock_followup.assert_called_once_with("bot siem zesroł") | ||
