コード例 #1
0
ファイル: test_rss.py プロジェクト: RebelCodeBase/sopel-rss
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 sopel():
    bot = MockSopel('Sopel')
    bot.config.core.owner = 'Bar'
    return bot
コード例 #4
0
def sopel():
    bot = MockSopel("Sopel")
    return bot
コード例 #5
0
def test_config_define_formats():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert isinstance(bot.memory['rss']['options'], dict)
コード例 #6
0
def test_config_define_hashes():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert isinstance(bot.memory['rss']['hashes'], dict)
コード例 #7
0
def test_config_define_sopelmemory():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert isinstance(bot.memory['rss'], rss.SopelMemory)
コード例 #8
0
ファイル: test_rss.py プロジェクト: normcyr/sopel-rss
def test_config_define_formats():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert type(bot.memory['rss']['options']) == dict
コード例 #9
0
ファイル: test_rss.py プロジェクト: normcyr/sopel-rss
def test_config_define_hashes():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert type(bot.memory['rss']['hashes']) == dict
コード例 #10
0
ファイル: test_rss.py プロジェクト: normcyr/sopel-rss
def test_config_define_sopelmemory():
    bot = MockSopel('Sopel')
    bot = rss._config_define(bot)
    assert type(bot.memory['rss']) == rss.SopelMemory