Esempio n. 1
0
    def test_parse_supybot_invalid_log(self):
        """Test whether it raises an exception when the log is invalid"""

        with self.assertRaises(ParseError):
            messages = Supybot.parse_supybot_log(
                'data/supybot_invalid_msg.log')
            _ = [message for message in messages]
Esempio n. 2
0
    def test_parse_supybot_log(self):
        """Test whether it parses a log"""

        # Empty lines and empty comment lines are ignored
        messages = Supybot.parse_supybot_log('data/supybot_valid.log')
        messages = [m for m in messages]

        self.assertEqual(len(messages), 97)

        msg = messages[1]
        self.assertEqual(msg['timestamp'], '2012-10-17T09:16:29+0000')
        self.assertEqual(msg['type'], SupybotParser.TCOMMENT)
        self.assertEqual(msg['nick'], 'benpol')
        self.assertEqual(msg['body'], "they're related to fragmentation?")

        msg = messages[-2]
        self.assertEqual(msg['timestamp'], '2012-10-17T23:42:10+0000')
        self.assertEqual(msg['type'], SupybotParser.TCOMMENT)
        self.assertEqual(msg['nick'], 'supy-bot')
        self.assertEqual(msg['body'],
                         "[backend] Fix bug #23: invalid timestamp")

        msg = messages[-1]
        self.assertEqual(msg['timestamp'], '2012-10-17T23:42:26+0000')
        self.assertEqual(msg['type'], SupybotParser.TCOMMENT)
        self.assertEqual(msg['nick'], 'gregaf')
        self.assertEqual(
            msg['body'],
            "but I may be wrong or debugging at the wrong level...")
Esempio n. 3
0
    def test_parse_supybot_log(self):
        """Test whether it parses a log"""

        # Empty lines and empty comment lines are ignored
        messages = Supybot.parse_supybot_log('data/supybot_valid.log')
        messages = [m for m in messages]

        self.assertEqual(len(messages), 97)

        msg = messages[1]
        self.assertEqual(msg['timestamp'], '2012-10-17T09:16:29+0000')
        self.assertEqual(msg['type'], SupybotParser.TCOMMENT)
        self.assertEqual(msg['nick'], 'benpol')
        self.assertEqual(msg['body'], "they're related to fragmentation?")

        msg = messages[-2]
        self.assertEqual(msg['timestamp'], '2012-10-17T23:42:10+0000')
        self.assertEqual(msg['type'], SupybotParser.TCOMMENT)
        self.assertEqual(msg['nick'], 'supy-bot')
        self.assertEqual(msg['body'], "[backend] Fix bug #23: invalid timestamp")

        msg = messages[-1]
        self.assertEqual(msg['timestamp'], '2012-10-17T23:42:26+0000')
        self.assertEqual(msg['type'], SupybotParser.TCOMMENT)
        self.assertEqual(msg['nick'], 'gregaf')
        self.assertEqual(msg['body'], "but I may be wrong or debugging at the wrong level...")
Esempio n. 4
0
    def test_parse_supybot_invalid_log(self):
        """Test whether it raises an exception when the log is invalid"""

        with self.assertRaises(ParseError):
            messages = Supybot.parse_supybot_log('data/supybot_invalid_msg.log')
            _ = [message for message in messages]