diff options
| author | salmonik <raisersoft@proton.me> | 2026-04-19 15:44:33 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-04-19 15:44:33 +0200 |
| commit | b343381fea3eab26e334a1b3bba202d715f9ea2e (patch) | |
| tree | 792210018d1e11ac3b160edfe29cf878eb4e3f56 /tests/cogs/test_say.py | |
| parent | chore: add pycord dependency, update main (diff) | |
| download | senator-sperma-b343381fea3eab26e334a1b3bba202d715f9ea2e.tar.gz senator-sperma-b343381fea3eab26e334a1b3bba202d715f9ea2e.zip | |
test: improve test assertions and edge cases
Diffstat (limited to 'tests/cogs/test_say.py')
| -rw-r--r-- | tests/cogs/test_say.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/cogs/test_say.py b/tests/cogs/test_say.py index 12f2d2a..13cad40 100644 --- a/tests/cogs/test_say.py +++ b/tests/cogs/test_say.py | |||
| @@ -13,7 +13,7 @@ def say_cog(bot): | |||
| 13 | @pytest.mark.asyncio | 13 | @pytest.mark.asyncio |
| 14 | async def test_say_command(say_cog, mock_channel, mock_guild, bot): | 14 | async def test_say_command(say_cog, mock_channel, mock_guild, bot): |
| 15 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) | 15 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) |
| 16 | 16 | ||
| 17 | with patch.object(ctx, 'send', new_callable=AsyncMock) as mock_send: | 17 | with patch.object(ctx, 'send', new_callable=AsyncMock) as mock_send: |
| 18 | await say_cog.say.callback(say_cog, ctx, "Hello World") | 18 | await say_cog.say.callback(say_cog, ctx, "Hello World") |
| 19 | mock_send.assert_called_once_with(content="Hello World") | 19 | mock_send.assert_called_once_with(content="Hello World") |
| @@ -22,7 +22,7 @@ async def test_say_command(say_cog, mock_channel, mock_guild, bot): | |||
| 22 | @pytest.mark.asyncio | 22 | @pytest.mark.asyncio |
| 23 | async def test_say_command_empty_text(say_cog, mock_channel, mock_guild, bot): | 23 | async def test_say_command_empty_text(say_cog, mock_channel, mock_guild, bot): |
| 24 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) | 24 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) |
| 25 | 25 | ||
| 26 | with patch.object(ctx, 'send', new_callable=AsyncMock) as mock_send: | 26 | with patch.object(ctx, 'send', new_callable=AsyncMock) as mock_send: |
| 27 | await say_cog.say.callback(say_cog, ctx, "") | 27 | await say_cog.say.callback(say_cog, ctx, "") |
| 28 | mock_send.assert_called_once_with(content="") | 28 | mock_send.assert_called_once_with(content="") |
| @@ -32,7 +32,7 @@ async def test_say_command_empty_text(say_cog, mock_channel, mock_guild, bot): | |||
| 32 | async def test_say_command_long_text(say_cog, mock_channel, mock_guild, bot): | 32 | async def test_say_command_long_text(say_cog, mock_channel, mock_guild, bot): |
| 33 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) | 33 | ctx = MockApplicationContext(bot=bot, channel=mock_channel, guild=mock_guild) |
| 34 | long_text = "A" * 2000 | 34 | long_text = "A" * 2000 |
| 35 | 35 | ||
| 36 | with patch.object(ctx, 'send', new_callable=AsyncMock) as mock_send: | 36 | with patch.object(ctx, 'send', new_callable=AsyncMock) as mock_send: |
| 37 | await say_cog.say.callback(say_cog, ctx, long_text) | 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 | 38 | mock_send.assert_called_once_with(content=long_text) |
