def testMailinMultipart(self): p = self.p self.p.subscribe(TESTSENDER) from email.MIMEText import MIMEText from email.MIMEMultipart import MIMEMultipart msg = MIMEMultipart() msg['From'] = TESTSENDER msg['To'] = TESTTO msg.attach(MIMEText('*bold*')) msg.attach(MIMEText('<b>bold</b>','html')) mailin.mailin(p, msg.as_string()) self.assertEqual(1, p.commentCount()) self.assertEqual(1, len(re.findall(r'\*bold\*', p.text())))
def testMailinTrackerIssueLongSubject(self): longsubjmsg = str(TestMessage(to='bugs@somewhere',subject=LONGSUBJECT)) self.p.upgradeFolderIssueProperties() self.assertEqual(0, self.p.issueCount()) mailin.mailin(self.p.folder(),longsubjmsg) self.assertEqual(1, self.p.issueCount())
def testMailinTrackerIssue(self): self.p.upgradeFolderIssueProperties() self.assertEqual(0, self.p.issueCount()) mailin.mailin(self.p.folder(), str(TestMessage(to='bugs@somewhere'))) self.assertEqual(1, self.p.issueCount())
def testNonSubscriberMailinWithOpenPosting(self): old = self.p.text() mailin.mailin(self.p,TESTMSG) self.assertEqual(1, len(re.findall(TESTBODY,self.p.text())))
def testNonSubscriberMailinFails(self): delattr(self.p.folder(),'mailin_policy') old = self.p.text() mailin.mailin(self.p,TESTMSG) self.assertEqual(old, self.p.read())
def testSubscriberMailin(self): delattr(self.p.folder(),'mailin_policy') old = self.p.text() self.p.subscribe(TESTSENDER) mailin.mailin(self.p,TESTMSG) self.assertEqual(1, len(re.findall(TESTBODY,self.p.text())))