Exemplo n.º 1
0
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
Exemplo n.º 2
0
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")
Exemplo n.º 3
0
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()
Exemplo n.º 4
0
def base_cog(bot):
    base_cog = BaseCog.BaseCog(bot)
    bot.add_cog(base_cog)
    dpytest.configure(bot)
    print("Tests starting")
    return base_cog
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
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)
Exemplo n.º 7
0
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)
Exemplo n.º 8
0
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)
Exemplo n.º 9
0
async def test_setup():
    with mock.patch.object(discord.ext.commands.bot.Bot, 'add_cog') as mock1:
        BaseCog.setup(KoalaBot.client)
    mock1.assert_called()
Exemplo n.º 10
0
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)
Exemplo n.º 11
0
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)