def test_status_can_be_cleared(self): self.patch_connection() Bot.LOGS = (Log('/tmp/jabber_test/first.log', 'first'), Log('/tmp/jabber_test/secnd.log', 'secnd'), ) status = self.Status() bot = Bot('user@server', 'pass') bot.status = status bot.client = fudge.Fake('client').is_a_stub() filename1 = '/tmp/jabber_test/first.log' log1 = Log('first') self.set_date('2011-09-21 01:00:03') open(filename1, 'w').write('2011-09-21 01:00:01,854 - first - INFO - Line 01\n') # Status should be 'Ok' bot.cycle() self.assertEquals(bot.status_msg, '2011-09-21 01:00:03 Ok') self.assertEquals(bot.status_show, '') # Error will change status self.set_date('2011-09-21 01:00:05') open(filename1, 'a').write('2011-09-21 01:00:04,854 - first - ERROR - Error 01\n') bot.cycle() self.assertEquals(bot.status_msg, '2011-09-21 01:00:04 first: Error 01') self.assertEquals(bot.status_show, 'dnd') bot.clear() bot.cycle() self.assertEquals(bot.status_msg, '2011-09-21 01:00:03 Ok') self.assertEquals(bot.status_show, '')