Created
January 6, 2014 13:04
-
-
Save elmirjagudin/8282611 to your computer and use it in GitHub Desktop.
mail-utests-nine.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/master/buildbot/status/mail.py b/master/buildbot/status/mail.py | |
index 9535f90..e1f1950 100644 | |
--- a/master/buildbot/status/mail.py | |
+++ b/master/buildbot/status/mail.py | |
@@ -110,6 +111,8 @@ def _defaultMessageIntro(mode, results, build): | |
text = "The Buildbot has detected a passing build" | |
elif results == EXCEPTION: | |
text = "The Buildbot has detected a build exception" | |
+ elif results == CANCELLED: | |
+ text = "The Build was cancelled by the user" | |
return text | |
@@ -182,6 +185,8 @@ def _defaultMessageSummary(build, results): | |
text = "Build succeeded!\n" | |
elif results == WARNINGS: | |
text = "Build Had Warnings%s\n" % t | |
+ elif results == CANCELLED: | |
+ text = "Build was cancelled by %s\n" % build.getResponsibleUsers() | |
else: | |
text = "BUILD FAILED%s\n" % t | |
diff --git a/master/buildbot/test/unit/test_status_mail.py b/master/buildbot/test/unit/test_status_mail.py | |
index 0860816..008c57b 100644 | |
--- a/master/buildbot/test/unit/test_status_mail.py | |
+++ b/master/buildbot/test/unit/test_status_mail.py | |
@@ -20,11 +20,13 @@ from buildbot.config import ConfigErrors | |
from buildbot.process import properties | |
from buildbot.status import mail | |
from buildbot.status.mail import MailNotifier | |
+from buildbot.status.results import CANCELLED | |
from buildbot.status.results import EXCEPTION | |
from buildbot.status.results import FAILURE | |
from buildbot.status.results import SUCCESS | |
from buildbot.status.results import WARNINGS | |
from buildbot.test.fake import fakedb | |
from buildbot.test.fake.fakebuild import FakeBuildStatus | |
from buildbot.test.util.config import ConfigErrorsMixin | |
from mock import Mock | |
@@ -945,6 +970,11 @@ class TestDefaultMessageIntro(unittest.TestCase): | |
self.assertEqual("The Buildbot has detected a build exception", | |
mail._defaultMessageIntro("all", EXCEPTION, build)) | |
+ def testCancelled(self): | |
+ build = self.setUpBuild() | |
+ self.assertEqual("The Build was cancelled by the user", | |
+ mail._defaultMessageIntro("all", CANCELLED, build)) | |
+ | |
# Test buildbot.status.mail._defaultMessageProjects() function | |
class TestDefaultMessageProjects(unittest.TestCase): | |
@@ -1084,6 +1114,11 @@ class TestDefaultMessageSummary(unittest.TestCase): | |
self.assertEqual("BUILD FAILED\n", | |
mail._defaultMessageSummary(self.build, EXCEPTION)) | |
+ def testCancelled(self): | |
+ self.build.getResponsibleUsers = Mock(return_value="Joe Bloggs") | |
+ self.assertEqual("Build was cancelled by Joe Bloggs\n", | |
+ mail._defaultMessageSummary(self.build, CANCELLED)) | |
+ | |
def testFailure(self): | |
self.assertEqual("BUILD FAILED\n", | |
mail._defaultMessageSummary(self.build, FAILURE)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment