예제 #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
예제 #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
예제 #3
0
def test_config_define_formats():
    bot = MockSopel("Sopel")
    bot = rss._config_define(bot)
    assert type(bot.memory["rss"]["options"]) == dict
예제 #4
0
def test_config_define_hashes():
    bot = MockSopel("Sopel")
    bot = rss._config_define(bot)
    assert type(bot.memory["rss"]["hashes"]) == dict
예제 #5
0
def test_config_define_sopelmemory():
    bot = MockSopel("Sopel")
    bot = rss._config_define(bot)
    assert type(bot.memory["rss"]) == rss.SopelMemory
예제 #6
0
def test_config_define_formats():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert type(bot.memory['rss']['options']) == dict
예제 #7
0
def test_config_define_hashes():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert type(bot.memory['rss']['hashes']) == dict
예제 #8
0
def test_config_define_sopelmemory():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert type(bot.memory['rss']) == rss.SopelMemory