Example #1
0
    def test_format_message_with_client_and_bot_and_brain(self):
        brain_config = BrainConfiguration()
        brain_config._section_name = "testbrain"
        brain = Brain(None, brain_config)

        msg = YLogger.format_message(brain, "Test Message")
        self.assertIsNotNone(msg)
        self.assertEquals("[] [] [testbrain] - Test Message", msg)
Example #2
0
    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)
Example #3
0
    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)
Example #4
0
    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)
Example #5
0
    def test_format_message_with_client(self):
        client = TestClient()

        msg = YLogger.format_message(client, "Test Message")
        self.assertIsNotNone(msg)
        self.assertEquals("[testclient] - Test Message", msg)