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