Skip to content

Commit aa292c8

Browse files
committed
feat(tests): Checks For Multiple Sub Commands
1 parent f541c76 commit aa292c8

1 file changed

Lines changed: 177 additions & 0 deletions

File tree

tests/test_command_syncing.py

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,92 @@ async def test_subcommand_counts(self):
10201020
rd["options"] = []
10211021
assert await edit_needed(s, rd)
10221022

1023+
async def test_multi_subcommand_diff(self):
1024+
# No Different
1025+
s = SlashCommandGroup("subcommand")
1026+
s.add_command(SlashCommand(parent=s))
1027+
s.add_command(SlashCommand(parent=s, name="another"))
1028+
rd = self.dict_factory({}, {})
1029+
rd["options"].append(
1030+
ApplicationCommandOption(
1031+
type=1,
1032+
name="another",
1033+
name_localizations=None,
1034+
description="desc",
1035+
description_localizations=None,
1036+
required=True,
1037+
)
1038+
)
1039+
assert not await edit_needed(s, rd)
1040+
1041+
# First Local Different
1042+
s = SlashCommandGroup("subcommand")
1043+
s.add_command(SlashCommand(parent=s, description="different"))
1044+
s.add_command(SlashCommand(parent=s, name="another"))
1045+
rd = self.dict_factory({}, {})
1046+
rd["options"].append(
1047+
ApplicationCommandOption(
1048+
type=1,
1049+
name="another",
1050+
name_localizations=None,
1051+
description="desc",
1052+
description_localizations=None,
1053+
required=True,
1054+
)
1055+
)
1056+
assert await edit_needed(s, rd)
1057+
1058+
# Second Local Different
1059+
s = SlashCommandGroup("subcommand")
1060+
s.add_command(SlashCommand(parent=s))
1061+
s.add_command(SlashCommand(parent=s, name="another", description="different"))
1062+
rd = self.dict_factory({}, {})
1063+
rd["options"].append(
1064+
ApplicationCommandOption(
1065+
type=1,
1066+
name="another",
1067+
name_localizations=None,
1068+
description="desc",
1069+
description_localizations=None,
1070+
required=True,
1071+
)
1072+
)
1073+
assert await edit_needed(s, rd)
1074+
1075+
# First Remote Different
1076+
s = SlashCommandGroup("subcommand")
1077+
s.add_command(SlashCommand(parent=s))
1078+
s.add_command(SlashCommand(parent=s, name="another"))
1079+
rd = self.dict_factory({}, {"description": "different"})
1080+
rd["options"].append(
1081+
ApplicationCommandOption(
1082+
type=1,
1083+
name="another",
1084+
name_localizations=None,
1085+
description="desc",
1086+
description_localizations=None,
1087+
required=True,
1088+
)
1089+
)
1090+
assert await edit_needed(s, rd)
1091+
1092+
# Second Remote Different
1093+
s = SlashCommandGroup("subcommand")
1094+
s.add_command(SlashCommand(parent=s))
1095+
s.add_command(SlashCommand(parent=s, name="another"))
1096+
rd = self.dict_factory({}, {})
1097+
rd["options"].append(
1098+
ApplicationCommandOption(
1099+
type=1,
1100+
name="another",
1101+
name_localizations=None,
1102+
description="different",
1103+
description_localizations=None,
1104+
required=True,
1105+
)
1106+
)
1107+
assert await edit_needed(s, rd)
1108+
10231109

10241110
class TestSubSubCommandSyncing:
10251111

@@ -1091,3 +1177,94 @@ async def test_subsubcommand_counts(self):
10911177
rd = self.dict_factory({}, {})
10921178
rd["options"][0]["options"] = []
10931179
assert await edit_needed(s, rd)
1180+
1181+
async def test_multi_subsubcommand_diff(self):
1182+
# No Different
1183+
s = SlashCommandGroup("subcommand")
1184+
ss = s.create_subgroup("testing", description="desc")
1185+
ss.add_command(SlashCommand(parent=ss))
1186+
ss.add_command(SlashCommand(parent=ss, name="another"))
1187+
rd = self.dict_factory({}, {})
1188+
rd["options"][0]["options"].append(
1189+
ApplicationCommandOption(
1190+
type=1,
1191+
name="another",
1192+
name_localizations=None,
1193+
description="desc",
1194+
description_localizations=None,
1195+
required=True,
1196+
)
1197+
)
1198+
assert not await edit_needed(s, rd)
1199+
1200+
# First Local Different
1201+
s = SlashCommandGroup("subcommand")
1202+
ss = s.create_subgroup("testing", description="desc")
1203+
ss.add_command(SlashCommand(parent=ss, description="different"))
1204+
ss.add_command(SlashCommand(parent=ss, name="another"))
1205+
rd = self.dict_factory({}, {})
1206+
rd["options"][0]["options"].append(
1207+
ApplicationCommandOption(
1208+
type=1,
1209+
name="another",
1210+
name_localizations=None,
1211+
description="desc",
1212+
description_localizations=None,
1213+
required=True,
1214+
)
1215+
)
1216+
assert await edit_needed(s, rd)
1217+
1218+
# Second Local Different
1219+
s = SlashCommandGroup("subcommand")
1220+
ss = s.create_subgroup("testing", description="desc")
1221+
ss.add_command(SlashCommand(parent=ss))
1222+
ss.add_command(SlashCommand(parent=ss, name="another", description="different"))
1223+
rd = self.dict_factory({}, {})
1224+
rd["options"][0]["options"].append(
1225+
ApplicationCommandOption(
1226+
type=1,
1227+
name="another",
1228+
name_localizations=None,
1229+
description="desc",
1230+
description_localizations=None,
1231+
required=True,
1232+
)
1233+
)
1234+
assert await edit_needed(s, rd)
1235+
1236+
# First Remote Different
1237+
s = SlashCommandGroup("subcommand")
1238+
ss = s.create_subgroup("testing", description="desc")
1239+
ss.add_command(SlashCommand(parent=ss))
1240+
ss.add_command(SlashCommand(parent=ss, name="another"))
1241+
rd = self.dict_factory({}, {"description": "different"})
1242+
rd["options"][0]["options"].append(
1243+
ApplicationCommandOption(
1244+
type=1,
1245+
name="another",
1246+
name_localizations=None,
1247+
description="desc",
1248+
description_localizations=None,
1249+
required=True,
1250+
)
1251+
)
1252+
assert await edit_needed(s, rd)
1253+
1254+
# Second Remote Different
1255+
s = SlashCommandGroup("subcommand")
1256+
ss = s.create_subgroup("testing", description="desc")
1257+
ss.add_command(SlashCommand(parent=ss))
1258+
ss.add_command(SlashCommand(parent=ss, name="another"))
1259+
rd = self.dict_factory({}, {})
1260+
rd["options"][0]["options"].append(
1261+
ApplicationCommandOption(
1262+
type=1,
1263+
name="another",
1264+
name_localizations=None,
1265+
description="different",
1266+
description_localizations=None,
1267+
required=True,
1268+
)
1269+
)
1270+
assert await edit_needed(s, rd)

0 commit comments

Comments
 (0)