def setUp(self): self.master = fakemaster.make_master(testcase=self, wantData=True, wantDb=True, wantMq=True) self.message = message.MessageFormatter() self.messageMissing = message.MessageFormatterMissingWorker()
def test_basic(self): formatter = message.MessageFormatterMissingWorker() self.setup_db(SUCCESS, SUCCESS) workers = yield self.master.data.get(('workers', )) worker = workers[0] worker['notify'] = ['e@mail'] worker['last_connection'] = ['yesterday'] res = yield formatter.formatMessageForMissingWorker( self.master, worker) text = res['body'] self.assertIn("worker named wrkr went away", text)
def test_unknown_template_type_for_default_message(self): with self.assertRaises(config.ConfigErrors): message.MessageFormatterMissingWorker(template_type='unknown')