示例#1
0
    def test_parse_log_line_format_other(self):
        msg = parse_log_line(
            '2016-05-16 23:45:00,343 INFO [mr.roboto][lala] my message'
        )

        self.assertIn("""<span class="timestamp">2016-05-16 23:45:00,343</span>""", msg)
        self.assertIn("""<span class="info">INFO</span>""", msg)
        self.assertIn("""<span class="message">my message</span>""", msg)
示例#2
0
    def test_parse_log_line_format_other(self):
        msg = parse_log_line(
            '2016-05-16 23:45:00,343 INFO [mr.roboto][lala] my message')

        self.assertIn(
            """<span class="timestamp">2016-05-16 23:45:00,343</span>""", msg)
        self.assertIn("""<span class="info">INFO</span>""", msg)
        self.assertIn("""<span class="message">my message</span>""", msg)
示例#3
0
 def test_parse_log_line_requests_connection(self):
     """If requests (the python package) does a connection it always logs
     a message about it, discard them
     """
     msg = parse_log_line(
         '2016-05-11 21:37:25,600 INFO  '
         '[requests.packages.urllib3.connectionpool][waitress] '
         'Starting new HTTPS connection (1): github.com'
     )
     self.assertEqual(msg, '')
示例#4
0
    def test_parse_log_line_format_commit_no_link(self):
        msg = parse_log_line(
            '2013-12-12 22:34 INFO [mr.roboto][lala] Commit: LETS COMMIT ON COREDEV'
        )

        self.assertIn("""<span class="timestamp">2013-12-12 22:34</span>""",
                      msg)
        self.assertIn("""<span class="info">INFO</span>""", msg)
        self.assertIn(
            '<span class="message">Commit: LETS COMMIT ON COREDEV</span>', msg)
示例#5
0
    def test_parse_log_line_format_commit_no_link(self):
        msg = parse_log_line(
            '2013-12-12 22:34 INFO [mr.roboto][lala] Commit: LETS COMMIT ON COREDEV'
        )

        self.assertIn("""<span class="timestamp">2013-12-12 22:34</span>""", msg)
        self.assertIn("""<span class="info">INFO</span>""", msg)
        self.assertIn(
            '<span class="message">Commit: LETS COMMIT ON COREDEV</span>', msg
        )
示例#6
0
    def test_parse_log_line_format_pull_request(self):
        msg = parse_log_line('2013-11-10 12:15 WARN [mr.roboto][lala] '
                             'PR plone/ploneorg.core#155: with action closed')

        self.assertIn("""<span class="timestamp">2013-11-10 12:15</span>""",
                      msg)
        self.assertIn("""<span class="warn">WARN</span>""", msg)
        self.assertIn(
            '<span class="message">PR <a href="https://github.com/plone/'
            'ploneorg.core/pull/155">plone/ploneorg.core#155</a>: '
            'with action closed</span>',
            msg,
        )
示例#7
0
    def test_parse_log_line_format_pull_request(self):
        msg = parse_log_line(
            '2013-11-10 12:15 WARN [mr.roboto][lala] '
            'PR plone/ploneorg.core#155: with action closed'
        )

        self.assertIn("""<span class="timestamp">2013-11-10 12:15</span>""", msg)
        self.assertIn("""<span class="warn">WARN</span>""", msg)
        self.assertIn(
            '<span class="message">PR <a href="https://github.com/plone/'
            'ploneorg.core/pull/155">plone/ploneorg.core#155</a>: '
            'with action closed</span>',
            msg,
        )
示例#8
0
    def test_parse_log_line_format_commit(self):
        msg = parse_log_line('2013-12-12 22:34 INFO [mr.roboto][lala] '
                             'Commit: on plone/ploneorg.core master '
                             'fcbc0f2764f84a027766d96493ea0d40823f7ef1')

        self.assertIn("""<span class="timestamp">2013-12-12 22:34</span>""",
                      msg)
        self.assertIn("""<span class="info">INFO</span>""", msg)
        self.assertIn(
            '<span class="message">Commit: on plone/ploneorg.core master '
            '<a href="https://github.com/plone/ploneorg.core/commit/'
            'fcbc0f2764f84a027766d96493ea0d40823f7ef1">'
            'fcbc0f2764f84a027766d96493ea0d40823f7ef1</a></span>',
            msg,
        )
示例#9
0
    def test_parse_log_line_format_comment(self):
        msg = parse_log_line(
            '2019-02-07 12:36 INFO  [mr.roboto][waitress] '
            'COMMENT plone/plone.app.discussion#147-461384382: '
            'with action created on pull request plone/plone.app.discussion#147'
        )

        self.assertIn("""<span class="timestamp">2019-02-07 12:36</span>""", msg)
        self.assertIn("""<span class="info">INFO</span>""", msg)
        self.assertIn(
            '<span class="message">COMMENT <a '
            'href="https://github.com/plone/plone.app.discussion/pull/147#issuecomment-461384382">'
            'plone/plone.app.discussion#147-461384382</a>: with action created',
            msg,
        )
示例#10
0
    def test_parse_log_line_format_comment(self):
        msg = parse_log_line(
            '2019-02-07 12:36 INFO  [mr.roboto][waitress] '
            'COMMENT plone/plone.app.discussion#147-461384382: '
            'with action created on pull request plone/plone.app.discussion#147'
        )

        self.assertIn("""<span class="timestamp">2019-02-07 12:36</span>""",
                      msg)
        self.assertIn("""<span class="info">INFO</span>""", msg)
        self.assertIn(
            '<span class="message">COMMENT <a '
            'href="https://github.com/plone/plone.app.discussion/pull/147#issuecomment-461384382">'
            'plone/plone.app.discussion#147-461384382</a>: with action created',
            msg,
        )
示例#11
0
    def test_parse_log_line_format_commit(self):
        msg = parse_log_line(
            '2013-12-12 22:34 INFO [mr.roboto][lala] '
            'Commit: on plone/ploneorg.core master '
            'fcbc0f2764f84a027766d96493ea0d40823f7ef1'
        )

        self.assertIn("""<span class="timestamp">2013-12-12 22:34</span>""", msg)
        self.assertIn("""<span class="info">INFO</span>""", msg)
        self.assertIn(
            '<span class="message">Commit: on plone/ploneorg.core master '
            '<a href="https://github.com/plone/ploneorg.core/commit/'
            'fcbc0f2764f84a027766d96493ea0d40823f7ef1">'
            'fcbc0f2764f84a027766d96493ea0d40823f7ef1</a></span>',
            msg,
        )
示例#12
0
 def test_parse_log_line_no_format(self):
     self.assertEqual(
         parse_log_line('la la '),
         '<pre>la la </pre>',
     )
示例#13
0
 def test_parse_log_line_no_format(self):
     self.assertEqual(parse_log_line('la la '), '<pre>la la </pre>')