aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cogs/test_say.py
diff options
context:
space:
mode:
authorsalmonik <raisersoft@proton.me>2026-04-18 16:24:42 +0200
committersalmonik <raisersoft@proton.me>2026-04-18 16:24:42 +0200
commit857a7364ddb9b10529593c5e9c3578eb95c1da9b (patch)
treecc160ed8685039fcb08663226395fb97d78fcea6 /tests/cogs/test_say.py
parentadd support for x^2+y^2=0,4 and alike (diff)
downloadsenator-sperma-857a7364ddb9b10529593c5e9c3578eb95c1da9b.tar.gz
senator-sperma-857a7364ddb9b10529593c5e9c3578eb95c1da9b.zip
add a test suite
Signed-off-by: salmonik <raisersoft@proton.me>
Diffstat (limited to '')
-rw-r--r--tests/cogs/test_say.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/cogs/test_say.py b/tests/cogs/test_say.py
new file mode 100644
index 0000000..12f2d2a
--- /dev/null
+++ b/tests/cogs/test_say.py
@@ -0,0 +1,38 @@
1import pytest
2from unittest.mock import AsyncMock, patch
3from cogs.say import Say
4from tests.conftest import MockApplicationContext
5
6
7@pytest.fixture
8def say_cog(bot):
9 cog = Say(bot)
10 return cog
11
12
13@pytest.mark.asyncio
14async def test_say_command(say_cog, mock_channel, mock_guild, bot):
15 ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild)
16
17 with patch.object(ctx, 'send', new_callable=AsyncMock) as mock_send:
18 await say_cog.say.callback(say_cog, ctx, "Hello World")
19 mock_send.assert_called_once_with(content="Hello World")
20
21
22@pytest.mark.asyncio
23async def test_say_command_empty_text(say_cog, mock_channel, mock_guild, bot):
24 ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild)
25
26 with patch.object(ctx, 'send', new_callable=AsyncMock) as mock_send:
27 await say_cog.say.callback(say_cog, ctx, "")
28 mock_send.assert_called_once_with(content="")
29
30
31@pytest.mark.asyncio
32async def test_say_command_long_text(say_cog, mock_channel, mock_guild, bot):
33 ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild)
34 long_text = "A" * 2000
35
36 with patch.object(ctx, 'send', new_callable=AsyncMock) as mock_send:
37 await say_cog.say.callback(say_cog, ctx, long_text)
38 mock_send.assert_called_once_with(content=long_text) \ No newline at end of file