Skip to content

Commit 6e0e8b7

Browse files
committed
Fix test case
1 parent 5da8db8 commit 6e0e8b7

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

intbot/core/bot/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async def close(ctx):
6565
await ctx.message.delete()
6666

6767
# Send notification to the thread
68-
await channel.send(f"# This was marked as done by {author.mention}")
68+
await channel.send(f"# This was marked as done by {author.mention}", suppress_embeds=True)
6969

7070
# We need to archive after adding tags in case it was a forum.
7171
await channel.edit(archived=True)

intbot/tests/test_bot/test_main.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,16 @@ async def test_wiki_command():
105105
async def test_close_command():
106106
# Mock context
107107
ctx = AsyncMock()
108-
ctx.channel = discord.Thread()
109-
ctx.channel.parent = discord.ForumChannel()
110-
ctx.author = discord.Member()
111-
ctx.author.mention = "TestUser"
108+
ctx.channel = AsyncMock()
109+
ctx.message.author = AsyncMock()
110+
ctx.channel.type = discord.ChannelType.public_thread
112111

113112
# Call the command
114113
await close(ctx)
115114

116115
# Assert that the command sent the expected message
117-
ctx.send.assert_called_once_with(
118-
"# This was marked as done by {ctx.author.mention}",
116+
ctx.channel.send.assert_called_once_with(
117+
f"# This was marked as done by {ctx.message.author.mention}",
119118
suppress_embeds=True,
120119
)
121120

0 commit comments

Comments
 (0)