'Test processing emails to individual persons'

def testProcessEmailToPerson(self):

    s3db = current.s3db
    resource = s3db.resource('pr_person', uid=['MsgTestPerson1', 'MsgTestPerson2'])
    rows = resource.select(['pe_id'], as_rows=True)
    self.sent = []
    outbox = s3db.msg_outbox
    for row in rows:
        outbox_id = outbox.insert(pe_id=row.pe_id, message_id=self.message_id)
    msg = current.msg
    msg.send_email = self.send_email
    msg.process_outbox()
    self.assertEqual(len(self.sent), 2)
    self.assertTrue(('test1@example.com' in self.sent))
    self.assertTrue(('test2@example.com' in self.sent))
