def test_format_message_with_bot(self): config = BotConfiguration() config._section_name = "testbot" bot = Bot(config) msg = YLogger.format_message(bot, "Test Message") self.assertIsNotNone(msg) self.assertEquals("[] [testbot] - Test Message", msg)
def test_format_message_with_client_and_bot_and_brain(self): client = TestClient() bot_config = BotConfiguration() bot_config._section_name = "testbot" bot = Bot(bot_config, client) brain_config = BrainConfiguration() brain_config._section_name = "testbrain" brain = Brain(bot, brain_config) msg = YLogger.format_message(brain, "Test Message") self.assertIsNotNone(msg) self.assertEquals("[testclient] [testbot] [testbrain] - Test Message", msg)
def test_format_message_with_client_context(self): client = TestClient() bot_config = BotConfiguration() bot_config._section_name = "testbot" bot = Bot(bot_config, client) brain_config = BrainConfiguration() brain_config._section_name = "testbrain" brain = Brain(bot, brain_config) client_context = ClientContext(client, "testuser") client_context._bot = bot client_context._brain = brain msg = YLogger.format_message(client_context, "Test Message") self.assertIsNotNone(msg) self.assertEquals( "[testclient] [testbot] [testbrain] [testuser] - Test Message", msg)