示例#1
0
 def test_destinationFromLongSubject(self):
     m = MailIn(
         self.p,
         str(
             TestMessage(subject='[' + ' ....' * 20 + 'Test Page' +
                         ' ....' * 20 + ']')))
     self.assertEqual(m.decideMailinAction(), ('COMMENT', 'TestPage'))
示例#2
0
    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)'
        ))
示例#3
0
 def test_destinationFromTrackerAddress(self):
     m = MailIn(self.p, str(TestMessage(to='[email protected]', )))
     action, info = m.decideMailinAction()
     self.assertEqual(action, 'ISSUE')
示例#4
0
 def test_destinationFromMultipleBracketedNamesInSubject(self):
     m = MailIn(self.p, str(TestMessage(subject='[Fwd:][LIST][Some Page]')))
     self.assertEqual(m.decideMailinAction(), ('CREATE', 'Some Page'))
示例#5
0
 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')
示例#6
0
 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'))
示例#7
0
 def test_destinationWithNoNamedPage(self):
     m = MailIn(self.p, str(TestMessage(subject='test')))
     self.assertEqual(m.decideMailinAction(), ('COMMENT', 'TestPage'))
示例#8
0
    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]'))