Example #1
0
def _fixture_bot_setup(request):
    bot = MockSopel("Sopel")
    bot = rss._config_define(bot)
    bot.config.core.db_filename = tempfile.mkstemp()[1]
    bot.db = SopelDB(bot.config)
    bot.output = ""

    # monkey patch bot
    def join(self, channel):
        if channel not in bot.channels:
            bot.config.core.channels.append(channel)

    bot.join = types.MethodType(join, bot)

    def say(self, message, channel=""):
        bot.output += message + "\n"

    bot.say = types.MethodType(say, bot)

    # tear down bot
    def fin():
        os.remove(bot.config.filename)
        os.remove(bot.config.core.db_filename)

    request.addfinalizer(fin)

    return bot
Example #2
0
def _fixture_bot_setup(request):
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    bot.config.core.db_filename = tempfile.mkstemp()[1]
    bot.db = SopelDB(bot.config)
    bot.output = ''

    # monkey patch bot
    def join(self, channel):
        if channel not in bot.channels:
            bot.config.core.channels.append(channel)

    bot.join = types.MethodType(join, bot)

    def say(self, message, channel=''):
        bot.output += message + "\n"

    bot.say = types.MethodType(say, bot)

    # tear down bot
    def fin():
        os.remove(bot.config.filename)
        os.remove(bot.config.core.db_filename)

    request.addfinalizer(fin)

    return bot
Example #3
0
def test_config_define_formats():
    bot = MockSopel("Sopel")
    bot = rss._config_define(bot)
    assert type(bot.memory["rss"]["options"]) == dict
Example #4
0
def test_config_define_hashes():
    bot = MockSopel("Sopel")
    bot = rss._config_define(bot)
    assert type(bot.memory["rss"]["hashes"]) == dict
Example #5
0
def test_config_define_sopelmemory():
    bot = MockSopel("Sopel")
    bot = rss._config_define(bot)
    assert type(bot.memory["rss"]) == rss.SopelMemory
Example #6
0
def test_config_define_formats():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert type(bot.memory['rss']['options']) == dict
Example #7
0
def test_config_define_hashes():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert type(bot.memory['rss']['hashes']) == dict
Example #8
0
def test_config_define_sopelmemory():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert type(bot.memory['rss']) == rss.SopelMemory