예제 #1
0
    def setUp(self):
        self.master = fakemaster.make_master(testcase=self,
                                             wantData=True,
                                             wantDb=True,
                                             wantMq=True)

        self.message = message.MessageFormatter()
예제 #2
0
    def test_message_success_plain_no_steps(self):
        formatter = message.MessageFormatter()
        res = yield self.do_one_test(formatter, SUCCESS, SUCCESS)
        self.assertEqual(
            res, {
                'type':
                'plain',
                'subject':
                '☺ Buildbot (Buildbot): Builder1 - test ((unknown revision))',
                'body':
                textwrap.dedent('''\
                A passing build has been detected on builder Builder1 while building Buildbot.

                Full details are available at:
                    http://localhost:8080/#builders/80/builds/1

                Build state: test
                Revision: (unknown)
                Worker: wrkr
                Build Reason: because
                Blamelist: him@bar, me@foo

                Steps:

                - (no steps)
                ''')
            })
예제 #3
0
    def test_message_success_html(self):
        formatter = message.MessageFormatter(template_type='html')
        res = yield self.do_one_test(formatter, SUCCESS, SUCCESS)
        self.assertEqual(
            res, {
                'type':
                'html',
                'subject':
                '☺ Buildbot (Buildbot): Builder1 - test ((unknown revision))',
                'body':
                textwrap.dedent('''\
                <p>A passing build has been detected on builder
                <a href="http://localhost:8080/#builders/80/builds/1">Builder1</a>
                while building Buildbot.</p>
                <p>Information:</p>
                <ul>
                    <li>Build state: test</li>
                    <li>Revision: (unknown)</li>
                    <li>Worker: wrkr</li>
                    <li>Build Reason: because</li>
                    <li>Blamelist: him@bar, me@foo</li>
                </ul>
                <p>Steps:</p>
                <ul>

                    <li>No steps</li>

                </ul>''')
            })
예제 #4
0
    def setUp(self):
        self.setUpTestReactor()
        self.master = fakemaster.make_master(self,
                                             wantData=True,
                                             wantDb=True,
                                             wantMq=True)

        self.message = message.MessageFormatter()
        self.messageMissing = message.MessageFormatterMissingWorker()
예제 #5
0
 def test_inline_template(self):
     self.message = message.MessageFormatter(
         template="URL: {{ build_url }} -- {{ summary }}")
     res = yield self.doOneTest(SUCCESS, SUCCESS)
     self.assertEqual(res['type'], "plain")
     self.assertEqual(
         res['body'],
         "URL: http://localhost:8080/#builders/80/builds/1 -- Build succeeded!"
     )
예제 #6
0
    def test_message_success_html_with_steps(self):
        formatter = message.MessageFormatter(template_type='html')
        res = yield self.do_one_test(
            formatter,
            SUCCESS,
            SUCCESS,
            with_steps=True,
            extra_build_properties={'got_revision': 'abcd1234'})
        self.assertEqual(
            res,
            {
                'type':
                'html',
                'subject':
                '☺ Buildbot (Buildbot): Builder1 - test (abcd1234)',
                'body':
                textwrap.dedent('''\
                <p>A passing build has been detected on builder
                <a href="http://localhost:8080/#builders/80/builds/1">Builder1</a>
                while building Buildbot.</p>
                <p>Information:</p>
                <ul>
                    <li>Build state: test</li>
                    <li>Revision: abcd1234</li>
                    <li>Worker: wrkr</li>
                    <li>Build Reason: because</li>
                    <li>Blamelist: him@bar, me@foo</li>
                </ul>
                <p>Steps:</p>
                <ul>

                    <li style="">
                    1: first step ( success )
                    </li>

                    <li style="">
                    2: second step ( success )
                    (
                        <a href="http://localhost:8080/#builders/80/builds/1/steps/2/logs/stdio">&lt;stdio&gt;</a>
                        <a href="http://localhost:8080/#builders/80/builds/1/steps/2/logs/stderr">&lt;stderr&gt;</a>
                    )
                    </li>

                    <li style="">
                    3: third step ( success )
                    (
                        <a href="http://localhost:8080/#builders/80/builds/1/steps/3/logs/stdio">&lt;stdio&gt;</a>
                    )
                    </li>

                </ul>''')  # noqa pylint: disable=line-too-long
            })
예제 #7
0
    def test_message_success_plain_with_steps(self):
        formatter = message.MessageFormatter()
        res = yield self.do_one_test(
            formatter,
            SUCCESS,
            SUCCESS,
            with_steps=True,
            extra_build_properties={'got_revision': 'abcd1234'})
        self.assertEqual(
            res, {
                'type':
                'plain',
                'subject':
                '☺ Buildbot (Buildbot): Builder1 - test (abcd1234)',
                'body':
                textwrap.dedent('''\
                A passing build has been detected on builder Builder1 while building Buildbot.

                Full details are available at:
                    http://localhost:8080/#builders/80/builds/1

                Build state: test
                Revision: abcd1234
                Worker: wrkr
                Build Reason: because
                Blamelist: him@bar, me@foo

                Steps:

                - 1: first step ( success )

                - 2: second step ( success )
                    Logs:
                        - stdio: http://localhost:8080/#builders/80/builds/1/steps/2/logs/stdio
                        - stderr: http://localhost:8080/#builders/80/builds/1/steps/2/logs/stderr

                - 3: third step ( success )
                    Logs:
                        - stdio: http://localhost:8080/#builders/80/builds/1/steps/3/logs/stdio

                ''')
            })
예제 #8
0
    def test_message_success(self):
        formatter = message.MessageFormatter()
        res = yield self.do_one_test(formatter, SUCCESS, SUCCESS)
        self.assertEqual(res['type'], "plain")
        self.assertEqual(
            res['body'],
            textwrap.dedent('''\
            The Buildbot has detected a passing build on builder Builder1 while building Buildbot.
            Full details are available at:
                http://localhost:8080/#builders/80/builds/1

            Buildbot URL: http://localhost:8080/

            Worker for this Build: wrkr

            Build Reason: because
            Blamelist: him@bar, me@foo

            Build succeeded!

            Sincerely,
             -The Buildbot'''))
        self.assertIsNone(res['subject'])
예제 #9
0
 def test_message_failure_nochange(self):
     formatter = message.MessageFormatter()
     res = yield self.do_one_test(formatter, FAILURE, FAILURE, "change")
     self.assertIn("The Buildbot has detected a failed build on builder",
                   res['body'])
예제 #10
0
 def test_inline_subject(self):
     self.message = message.MessageFormatter(subject="subject")
     res = yield self.doOneTest(SUCCESS, SUCCESS)
     self.assertEqual(res['subject'], "subject")
예제 #11
0
 def test_want_logs_deprecated(self):
     with assertProducesWarning(DeprecatedApiWarning,
                                "wantLogs has been deprecated"):
         formatter = message.MessageFormatter(wantLogs=True)
     self.assertEqual(formatter.want_logs, True)
     self.assertEqual(formatter.want_logs_content, True)
예제 #12
0
 def test_want_steps_deprecated(self):
     with assertProducesWarning(DeprecatedApiWarning,
                                "wantSteps has been deprecated"):
         formatter = message.MessageFormatter(wantSteps=True)
     self.assertEqual(formatter.want_steps, True)
예제 #13
0
 def test_message_failure_nochange(self):
     formatter = message.MessageFormatter()
     res = yield self.do_one_test(formatter, FAILURE, FAILURE, "change")
     self.assertIn(
         "A failed build has been detected on builder Builder1 while building",
         res['body'])
예제 #14
0
 def test_message_success_nochange(self):
     formatter = message.MessageFormatter()
     res = yield self.do_one_test(formatter, SUCCESS, SUCCESS, "change")
     self.assertIn(
         "A passing build has been detected on builder Builder1 while building",
         res['body'])
예제 #15
0
 def test_inline_subject(self):
     formatter = message.MessageFormatter(subject="subject")
     res = yield self.do_one_test(formatter, SUCCESS, SUCCESS)
     self.assertEqual(res['subject'], "subject")
예제 #16
0
 def test_unknown_template_type_for_default_message(self):
     with self.assertRaises(config.ConfigErrors):
         message.MessageFormatter(template_type='unknown')
예제 #17
0
 def test_message_success_nochange(self):
     formatter = message.MessageFormatter()
     res = yield self.do_one_test(formatter, SUCCESS, SUCCESS, "change")
     self.assertIn("The Buildbot has detected a passing build on builder",
                   res['body'])