def test_destinationFromLongSubject(self): m = MailIn( self.p, str( TestMessage(subject='[' + ' ....' * 20 + 'Test Page' + ' ....' * 20 + ']'))) self.assertEqual(m.decideMailinAction(), ('COMMENT', 'TestPage'))
def test_destinationFromLongSubjectWithLineBreak(self): m = MailIn( self.p, str( TestMessage(subject='''\ Re: [IssueNo0547 mail (with long subject ?) may go to wrong page (test with long long long long long long subject)] property change'''))) self.assertEqual(m.decideMailinAction(), ( 'CREATE', 'IssueNo0547 mail (with long subject ?) may go to wrong page (test with long long long long long long subject)' ))
def test_destinationFromTrackerAddress(self): m = MailIn(self.p, str(TestMessage(to='[email protected]', ))) action, info = m.decideMailinAction() self.assertEqual(action, 'ISSUE')
def test_destinationFromMultipleBracketedNamesInSubject(self): m = MailIn(self.p, str(TestMessage(subject='[Fwd:][LIST][Some Page]'))) self.assertEqual(m.decideMailinAction(), ('CREATE', 'Some Page'))
def test_destinationWithNoNamedPageAndBlankDefaultMailinPageProperty(self): self.p.folder().default_mailin_page = '' m = MailIn(self.p, str(TestMessage(subject='test'))) action, info = m.decideMailinAction() self.assertEqual(action, 'ERROR')
def test_destinationWithNoNamedPageAndDefaultMailinPageProperty(self): self.p.folder().default_mailin_page = 'TestPage' m = MailIn(self.p, str(TestMessage(subject='test'))) self.assertEqual(m.decideMailinAction(), ('COMMENT', 'TestPage'))
def test_destinationWithNoNamedPage(self): m = MailIn(self.p, str(TestMessage(subject='test'))) self.assertEqual(m.decideMailinAction(), ('COMMENT', 'TestPage'))
def test_recipientIdentification(self): # from Mail.py: # If the message has multiple recipients, decide which one refers to us # as follows: # - the first recipient matching the folder's mail_from property, # - or the first one looking like a typical zwiki mailin alias (.*MAILINADDREXP), # - or the first one. m = MailIn(self.p, str(TestMessage(to='a'))) self.assertEqual(m.recipient(), ('', 'a')) m = MailIn(self.p, str(TestMessage(to='a, b'))) self.assertEqual(m.recipient(), ('', 'a')) self.p.folder().mail_from = 'b' m = MailIn(self.p, str(TestMessage(to='a, b, [email protected]'))) self.assertEqual(m.recipient(), ('', 'b')) del self.p.folder().mail_from m = MailIn(self.p, str(TestMessage(to='[email protected], [email protected]'))) self.assertEqual(m.recipient(), ('', '[email protected]')) m = MailIn(self.p, str(TestMessage(to='[email protected], [email protected]'))) self.assertEqual(m.recipient(), ('', '[email protected]')) m = MailIn(self.p, str(TestMessage(to='[email protected], [email protected]'))) self.assertEqual(m.recipient(), ('', '[email protected]')) m = MailIn(self.p, str(TestMessage(to='[email protected], [email protected]'))) self.assertEqual(m.recipient(), ('', '[email protected]'))