|
5 | 5 |
|
6 | 6 | import importlib
|
7 | 7 | from unittest.mock import AsyncMock, MagicMock, call, patch
|
| 8 | +from discord.ext import commands |
8 | 9 |
|
9 | 10 | import discord
|
10 | 11 | import pytest
|
@@ -648,16 +649,24 @@ async def test_convertints_error(self):
|
648 | 649 | hextodec.convert_list_to_ints = MagicMock(side_effect=ValueError)
|
649 | 650 | hextodec.perform_op_on_list = MagicMock()
|
650 | 651 | hextodec.custom_embed_generation = MagicMock()
|
651 |
| - auxiliary.send_deny_embed = AsyncMock() |
652 |
| - discord_env.context.send = AsyncMock() |
| 652 | + auxiliary.prepare_deny_embed = MagicMock() |
| 653 | + |
| 654 | + # Create a MockContext with the required attributes |
| 655 | + mock_context = MagicMock(spec=commands.Context) |
| 656 | + mock_context.send = AsyncMock() # Mock the send method |
| 657 | + |
| 658 | + # Set the mock context for the test |
| 659 | + discord_env.context = mock_context |
653 | 660 |
|
654 | 661 | # Step 2 - Call the function
|
655 | 662 | await hextodec.htd_command(discord_env.context, "test")
|
656 | 663 |
|
657 | 664 | # Step 3 - Assert that everything works
|
658 |
| - auxiliary.send_deny_embed.assert_called_once_with( |
659 |
| - message="Unable to convert value, are you sure it's valid?", |
660 |
| - channel=discord_env.context.channel, |
| 665 | + auxiliary.prepare_deny_embed.assert_called_once_with( |
| 666 | + message="Unable to convert value, are you sure it's valid?" |
| 667 | + ) |
| 668 | + discord_env.context.send.assert_called_once_with( |
| 669 | + embed=auxiliary.prepare_deny_embed.return_value |
661 | 670 | )
|
662 | 671 |
|
663 | 672 | # Step 4 - Cleanup
|
|
0 commit comments