Esempio n. 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
Esempio n. 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
Esempio n. 3
0
def sopel():
    bot = MockSopel('Sopel')
    bot.config.core.owner = 'Bar'
    return bot
Esempio n. 4
0
def sopel():
    bot = MockSopel("Sopel")
    return bot
Esempio n. 5
0
def test_config_define_formats():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert isinstance(bot.memory['rss']['options'], dict)
Esempio n. 6
0
def test_config_define_hashes():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert isinstance(bot.memory['rss']['hashes'], dict)
Esempio n. 7
0
def test_config_define_sopelmemory():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert isinstance(bot.memory['rss'], rss.SopelMemory)
Esempio n. 8
0
def test_config_define_formats():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert type(bot.memory['rss']['options']) == dict
Esempio n. 9
0
def test_config_define_hashes():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert type(bot.memory['rss']['hashes']) == dict
Esempio n. 10
0
def test_config_define_sopelmemory():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert type(bot.memory['rss']) == rss.SopelMemory