本文整理汇总了Python中buildbot.test.fake.fakebuild.FakeBuildStatus.result方法的典型用法代码示例。如果您正苦于以下问题:Python FakeBuildStatus.result方法的具体用法?Python FakeBuildStatus.result怎么用?Python FakeBuildStatus.result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类buildbot.test.fake.fakebuild.FakeBuildStatus
的用法示例。
在下文中一共展示了FakeBuildStatus.result方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_buildsetFinished_sends_email
# 需要导入模块: from buildbot.test.fake.fakebuild import FakeBuildStatus [as 别名]
# 或者: from buildbot.test.fake.fakebuild.FakeBuildStatus import result [as 别名]
def test_buildsetFinished_sends_email(self):
fakeBuildMessage = Mock()
mn = MailNotifier("[email protected]", buildSetSummary=True, mode="all", builders=["Builder"])
mn.buildMessage = fakeBuildMessage
def fakeGetBuild(number):
return build
def fakeGetBuilder(buildername):
if buildername == builder.name:
return builder
return None
def fakeGetBuildRequests(self, bsid):
return defer.succeed([{"buildername": "Builder", "brid": 1}])
builder = Mock()
builder.getBuild = fakeGetBuild
builder.name = "Builder"
build = FakeBuildStatus()
build.result = FAILURE
build.finished = True
build.reason = "testReason"
build.getBuilder.return_value = builder
self.db = fakedb.FakeDBConnector(self)
self.db.insertTestData(
[
fakedb.SourceStampSet(id=127),
fakedb.Buildset(id=99, sourcestampsetid=127, results=SUCCESS, reason="testReason"),
fakedb.BuildRequest(id=11, buildsetid=99, buildername="Builder"),
fakedb.Build(number=0, brid=11),
]
)
mn.parent = self
self.status = Mock()
mn.master_status = Mock()
mn.master_status.getBuilder = fakeGetBuilder
mn.buildMessageDict = Mock()
mn.buildMessageDict.return_value = {"body": "body", "type": "text", "subject": "subject"}
mn.buildsetFinished(99, FAILURE)
fakeBuildMessage.assert_called_with("Buildset Complete: testReason", [build], SUCCESS)
示例2: test_sendToInterestedUsers_two_builds
# 需要导入模块: from buildbot.test.fake.fakebuild import FakeBuildStatus [as 别名]
# 或者: from buildbot.test.fake.fakebuild.FakeBuildStatus import result [as 别名]
def test_sendToInterestedUsers_two_builds(self):
from email.Message import Message
m = Message()
mn = MailNotifier(fromaddr="[email protected]", lookup=None)
mn.sendMessage = Mock()
def fakeGetBuilder(buildername):
if buildername == builder.name:
return builder
return None
def fakeGetBuildRequests(self, bsid):
return defer.succeed([{"buildername":"Builder", "brid":1}])
builder = Mock()
builder.name = "Builder"
build1 = FakeBuildStatus(name="build")
build1.result = FAILURE
build1.finished = True
build1.reason = "testReason"
build1.builder = builder
build2 = FakeBuildStatus(name="build")
build2.result = FAILURE
build2.finished = True
build2.reason = "testReason"
build2.builder = builder
def fakeCreateEmail(msgdict, builderName, title, results, builds=None,
patches=None, logs=None):
# only concerned with m['To'] and m['CC'], which are added in
# _got_recipients later
return m
mn.createEmail = fakeCreateEmail
self.db = fakedb.FakeDBConnector(self)
self.db.insertTestData([fakedb.SourceStampSet(id=1099),
fakedb.Buildset(id=99, sourcestampsetid=1099,
results=SUCCESS,
reason="testReason"),
fakedb.BuildRequest(id=11, buildsetid=99,
buildername='Builder'),
fakedb.Build(number=0, brid=11),
fakedb.Build(number=1, brid=11),
fakedb.Change(changeid=9123),
fakedb.Change(changeid=9124),
fakedb.ChangeUser(changeid=9123, uid=1),
fakedb.ChangeUser(changeid=9124, uid=2),
fakedb.User(uid=1, identifier="tdurden"),
fakedb.User(uid=2, identifier="user2"),
fakedb.UserInfo(uid=1, attr_type='email',
attr_data="[email protected]"),
fakedb.UserInfo(uid=2, attr_type='email',
attr_data="[email protected]")
])
def _getInterestedUsers():
# 'narrator' in this case is the owner, which tests the lookup
return ["Big Bob <[email protected]>", "narrator"]
build1.getInterestedUsers = _getInterestedUsers
build2.getInterestedUsers = _getInterestedUsers
def _getResponsibleUsers():
return ["Big Bob <[email protected]>"]
build1.getResponsibleUsers = _getResponsibleUsers
build2.getResponsibleUsers = _getResponsibleUsers
# fake sourcestamp with relevant user bits
ss1 = Mock(name="sourcestamp")
fake_change1 = Mock(name="change")
fake_change1.number = 9123
ss1.changes = [fake_change1]
ss1.patch, ss1.addPatch = None, None
ss2 = Mock(name="sourcestamp")
fake_change2 = Mock(name="change")
fake_change2.number = 9124
ss2.changes = [fake_change2]
ss2.patch, ss1.addPatch = None, None
def fakeGetSS(ss):
return lambda: ss
build1.getSourceStamp = fakeGetSS(ss1)
build2.getSourceStamp = fakeGetSS(ss2)
mn.master = self # FIXME: Should be FakeMaster
self.status = mn.master_status = mn.buildMessageDict = Mock()
mn.master_status.getBuilder = fakeGetBuilder
mn.buildMessageDict.return_value = {"body": "body", "type": "text"}
mn.buildMessage(builder.name, [build1, build2], build1.result)
self.assertEqual(m['To'], "[email protected], [email protected]")
示例3: do_test_sendToInterestedUsers
# 需要导入模块: from buildbot.test.fake.fakebuild import FakeBuildStatus [as 别名]
# 或者: from buildbot.test.fake.fakebuild.FakeBuildStatus import result [as 别名]
def do_test_sendToInterestedUsers(self, lookup=None, extraRecipients=[],
sendToInterestedUsers=True,
exp_called_with=None, exp_TO=None,
exp_CC=None):
from email.Message import Message
m = Message()
mn = MailNotifier(fromaddr='[email protected]',
lookup=lookup,
sendToInterestedUsers=sendToInterestedUsers,
extraRecipients=extraRecipients)
mn.sendMessage = Mock()
def fakeGetBuild(number):
return build
def fakeGetBuilder(buildername):
if buildername == builder.name:
return builder
return None
def fakeGetBuildRequests(self, bsid):
return defer.succeed([{"buildername":"Builder", "brid":1}])
builder = Mock()
builder.getBuild = fakeGetBuild
builder.name = "Builder"
build = FakeBuildStatus(name="build")
build.result = FAILURE
build.finished = True
build.reason = "testReason"
build.builder = builder
def fakeCreateEmail(msgdict, builderName, title, results, builds=None,
patches=None, logs=None):
# only concerned with m['To'] and m['CC'], which are added in
# _got_recipients later
return m
mn.createEmail = fakeCreateEmail
self.db = fakedb.FakeDBConnector(self)
self.db.insertTestData([fakedb.SourceStampSet(id=1099),
fakedb.Buildset(id=99, sourcestampsetid=1099,
results=SUCCESS,
reason="testReason"),
fakedb.BuildRequest(id=11, buildsetid=99,
buildername='Builder'),
fakedb.Build(number=0, brid=11),
fakedb.Change(changeid=9123),
fakedb.ChangeUser(changeid=9123, uid=1),
fakedb.User(uid=1, identifier="tdurden"),
fakedb.UserInfo(uid=1, attr_type='svn',
attr_data="tdurden"),
fakedb.UserInfo(uid=1, attr_type='email',
attr_data="[email protected]")
])
# fake sourcestamp with relevant user bits
ss = Mock(name="sourcestamp")
fake_change = Mock(name="change")
fake_change.number = 9123
ss.changes = [fake_change]
ss.patch, ss.addPatch = None, None
def fakeGetSS():
return ss
build.getSourceStamp = fakeGetSS
def _getInterestedUsers():
# 'narrator' in this case is the owner, which tests the lookup
return ["Big Bob <[email protected]>", "narrator"]
build.getInterestedUsers = _getInterestedUsers
def _getResponsibleUsers():
return ["Big Bob <[email protected]>"]
build.getResponsibleUsers = _getResponsibleUsers
mn.master = self # FIXME: Should be FakeMaster
self.status = mn.master_status = mn.buildMessageDict = Mock()
mn.master_status.getBuilder = fakeGetBuilder
mn.buildMessageDict.return_value = {"body": "body", "type": "text"}
mn.buildMessage(builder.name, [build], build.result)
mn.sendMessage.assert_called_with(m, exp_called_with)
self.assertEqual(m['To'], exp_TO)
self.assertEqual(m['CC'], exp_CC)