~fginther/jenkins-launchpad-plugin/getPackageVersion

« back to all changes in this revision

Viewing changes to tests/test_launchpadTrigger.py

refactoring message generation for autolanding/ci so both messages are consistent. Fixes: https://bugs.launchpad.net/bugs/1022503. Approved by jenkins, Allan LeSage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import unittest
2
2
import launchpad
 
3
from textwrap import dedent
3
4
from settings import LAUNCHPAD_LOGIN, LAUNCHPAD_REVIEW_TYPE
4
5
from mock import MagicMock, patch
5
6
from jenkins import JenkinsException
519
520
                    "\n    Passed: http://url/console"
520
521
                   )
521
522
        self.assertEqual(ret, expected)
 
523
 
 
524
    def test_format_message_for_mp_update(self):
 
525
        expected = dedent("""\
 
526
                          mymessage
 
527
                          http://jenkins/34
 
528
                          Executed test runs:
 
529
                              Passed: http://url/console
 
530
                              Passed: http://url/console""")
 
531
        actual = self.launchpadTrigger.format_message_for_mp_update(
 
532
                                                           'http://jenkins/34',
 
533
                                                           "mymessage\n")
 
534
        self.assertEquals(actual, expected)
 
535
 
 
536
    def test_format_message_with_empty_message(self):
 
537
        expected = dedent("""\
 
538
                          http://jenkins/34
 
539
                          Executed test runs:
 
540
                              Passed: http://url/console
 
541
                              Passed: http://url/console""")
 
542
 
 
543
        actual = self.launchpadTrigger.format_message_for_mp_update(
 
544
                                                           'http://jenkins/34')
 
545
        self.assertEquals(actual, expected)