def setUp(self): self.bot = mock.Mock(name='IRCStatusBot-instance') self.bot.nickname = 'nick' self.bot.notify_events = {'success': 1, 'failure': 1} # fake out subscription/unsubscription self.subscribed = False def subscribe(contact): self.subscribed = True self.bot.status.subscribe = subscribe def unsubscribe(contact): self.subscribed = False self.bot.status.unsubscribe = unsubscribe # fake out clean shutdown self.bot.master = mock.Mock(name='IRCStatusBot-instance.master') self.bot.master.botmaster = mock.Mock( name='IRCStatusBot-instance.master.botmaster') self.bot.master.botmaster.shuttingDown = False def cleanShutdown(): self.bot.master.botmaster.shuttingDown = True self.bot.master.botmaster.cleanShutdown = cleanShutdown def cancelCleanShutdown(): self.bot.master.botmaster.shuttingDown = False self.bot.master.botmaster.cancelCleanShutdown = cancelCleanShutdown self.contact = words.IRCContact(self.bot, '#buildbot')
def setUp(self): self.bot = mock.Mock(name='IRCStatusBot-instance') self.bot.notify_events = { 'success' : 1, 'failure' : 1 } # fake out subscription/unsubscription self.subscribed = False def subscribe(contact): self.subscribed = True self.bot.status.subscribe = subscribe def unsubscribe(contact): self.subscribed = False self.bot.status.unsubscribe = unsubscribe self.contact = words.IRCContact(self.bot, '#buildbot')
def setUp(self): self.master = fakemaster.make_master(testcase=self, wantMq=True, wantData=True, wantDb=True) for builderid, name in zip(self.BUILDER_IDS, self.BUILDER_NAMES): self.master.db.builders.addTestBuilder(builderid=builderid, name=name) # I think the 'bot' part of this is actually going away ... # TO REMOVE: self.bot = mock.Mock(name='IRCStatusBot-instance') self.bot.nickname = 'nick' self.bot.notify_events = {'success': 1, 'failure': 1} self.bot.useRevisions = False self.bot.useColors = False # fake out subscription/unsubscription self.subscribed = False def subscribe(contact): self.subscribed = True self.bot.status.subscribe = subscribe def unsubscribe(contact): self.subscribed = False self.bot.status.unsubscribe = unsubscribe # fake out clean shutdown self.bot.master = self.master self.bot.master.botmaster = mock.Mock( name='IRCStatusBot-instance.master.botmaster') self.bot.master.botmaster.shuttingDown = False def cleanShutdown(): self.bot.master.botmaster.shuttingDown = True self.bot.master.botmaster.cleanShutdown = cleanShutdown def cancelCleanShutdown(): self.bot.master.botmaster.shuttingDown = False self.bot.master.botmaster.cancelCleanShutdown = cancelCleanShutdown self.contact = words.IRCContact(self.bot, '#buildbot')