def zztest_send(self): from opencore.utilities.messenger import Messenger messenger = Messenger() joe = DummyProfile(name='joe') # messenger.send uses find_site(profile) to look up root so # place joe in a 'locatable' path joe.__parent__ = self.root joes_queue = DummyQueue() self.root['mailbox']['joe'] = joes_queue messenger.send("a", joe, "frankly I don't give a damn!") self.assertEqual(1, len(joes_queue)) self.assertEqual('a', joes_queue[0]['From']) self.assertEqual("frankly I don't give a damn!", joes_queue[0].get_payload())
def zztest_sending_bad_msg(self): from opencore.utilities.messenger import Messenger messenger = Messenger() joe = DummyProfile(name='joe') joe.__parent__ = self.root joes_queue = DummyQueue() self.root['mailbox']['joe'] = joes_queue self.assertRaises(TypeError, lambda : messenger.send("a", joe, 99))