Skip to content

Commit 2f7892c

Browse files
committed
fix: Use Dummy Data In Place Of Fetching AppInfo
1 parent 06c12dd commit 2f7892c

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

tests/test_command_syncing.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import copy
2-
from typing import Any
2+
from typing import Any, override
33

44
import pytest
55

66
import discord
77
from discord import MISSING, Bot, SlashCommandGroup
8+
from discord.bot import COMMAND_DEFAULTS, DefaultSetComparison
89
from discord.types.interactions import ApplicationCommand, ApplicationCommandOption
910

1011
pytestmark = pytest.mark.asyncio
@@ -56,10 +57,20 @@ async def dummy_callback(ctx):
5657
}
5758

5859

60+
class DummyBot(Bot):
61+
@override
62+
async def _get_command_defaults(self):
63+
command_defaults = COMMAND_DEFAULTS.copy()
64+
command_defaults["integration_types"] = DefaultSetComparison(
65+
(MISSING, {0}), lambda x, y: set(x) == set(y)
66+
)
67+
return command_defaults
68+
69+
5970
async def edit_needed(
6071
local: SlashCommand | SlashCommandGroup, remote: ApplicationCommand
6172
):
62-
b = Bot()
73+
b = DummyBot()
6374
b.add_application_command(local)
6475
r = await b.get_desynced_commands(prefetched=[remote])
6576
return r[0]["action"] == "edit"
@@ -954,7 +965,7 @@ async def test_parent_name(self):
954965
async def edit_needed(
955966
local: SlashCommand | SlashCommandGroup, remote: ApplicationCommand
956967
):
957-
b = Bot()
968+
b = DummyBot()
958969
b.add_application_command(local)
959970
r = await b.get_desynced_commands(prefetched=[remote])
960971
return r[0]["action"] == "upsert" and r[1]["action"] == "delete"

0 commit comments

Comments
 (0)