async def base_cog(bot): """ setup any state specific to the execution of the given module.""" base_cog = BaseCog.BaseCog(bot) bot.add_cog(base_cog) await dpytest.empty_queue() dpytest.configure(bot) return base_cog
def setup_function(): """ setup any state specific to the execution of the given module.""" global base_cog bot = commands.Bot(command_prefix=KoalaBot.COMMAND_PREFIX) base_cog = BaseCog.BaseCog(bot) bot.add_cog(base_cog) dpytest.configure(bot) print("Tests starting")
def se5tup_function(): """ setup any state specific to the execution of the given module.""" global base_cog, tf_cog, utils_cog bot = commands.Bot(command_prefix=KoalaBot.COMMAND_PREFIX) base_cog = BaseCog.BaseCog(bot) tf_cog = TextFilter.TextFilter(bot) tf_cog.tf_database_manager.create_tables() utils_cog = LastCtxCog.LastCtxCog(bot) bot.add_cog(base_cog) bot.add_cog(tf_cog) bot.add_cog(utils_cog) dpytest.configure(bot) print("Tests starting") return dpytest.get_config()
def base_cog(bot): base_cog = BaseCog.BaseCog(bot) bot.add_cog(base_cog) dpytest.configure(bot) print("Tests starting") return base_cog
def test_streaming_new_discord_activity(): test_name = "__your room__" assert_activity(BaseCog.new_discord_activity("streaming", test_name), type=discord.ActivityType.streaming, name=test_name + KoalaBot.KOALA_PLUG, url=KoalaBot.STREAMING_URL)
def test_listening_new_discord_activity(): test_name = "/Darude Sandstorm" assert_activity(BaseCog.new_discord_activity("listening", test_name), type=discord.ActivityType.listening, name=test_name + KoalaBot.KOALA_PLUG)
def test_watching_new_discord_activity(): test_name = "you" assert_activity(BaseCog.new_discord_activity("watching", test_name), type=discord.ActivityType.watching, name=test_name + KoalaBot.KOALA_PLUG)
def test_playing_new_discord_activity(): test_name = "Half Life 3" assert_activity(BaseCog.new_discord_activity("playing", test_name), type=discord.ActivityType.playing, name=test_name + KoalaBot.KOALA_PLUG)
async def test_setup(): with mock.patch.object(discord.ext.commands.bot.Bot, 'add_cog') as mock1: BaseCog.setup(KoalaBot.client) mock1.assert_called()
def test_invalid_new_discord_activity(): test_name = "INCORRECT" with pytest.raises(SyntaxError, match="incorrect is not an activity"): BaseCog.new_discord_activity("incorrect", test_name)
def test_custom_new_discord_activity(): test_name = "1 4M K04L4" assert_activity(BaseCog.new_discord_activity("custom", test_name), type=discord.ActivityType.custom, name=test_name + KoalaBot.KOALA_PLUG)