コード例 #1
0
    def test_author_indexes_with_bad_from_header(self):
        mail = self.stub()
        msg = self.stub()

        self.expect(mail.msg).result(msg)
        self.expect(msg.has_key('From')).result(True)
        self.expect(msg.get('From')).result(
            'Patrick Hengartner </O=KANTON ZUG/OU=EXCHANGE ADMINISTRATIVE GROUP\n (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=HEPA>'
        )

        self.replay()

        self.assertEqual(document_author(mail)(), 'Patrick Hengartner')

        self.assertEqual(sortable_author(mail)(), 'Patrick Hengartner')
コード例 #2
0
    def test_author_indexes(self):
        mail = self.stub()
        msg = self.stub()

        self.expect(mail.msg).result(msg)
        self.expect(msg.has_key('From')).result(True)
        self.expect(
            msg.get('From')).result(u'"Hugo Boss" <*****@*****.**>')
        self.replay()

        # ftw.mail removes quotes around name in 'From:'
        self.assertEqual(
            document_author(mail)(), 'Hugo Boss &lt;[email protected]&gt;')

        self.assertEqual(
            sortable_author(mail)(), 'Hugo Boss &lt;[email protected]&gt;')
コード例 #3
0
    def test_author_indexes(self):
        mail = self.stub()
        msg = self.stub()

        self.expect(mail.msg).result(msg)
        self.expect(msg.has_key('From')).result(True)
        self.expect(msg.get('From')).result(
            u'"Hugo Boss" <*****@*****.**>')
        self.replay()

        self.assertEqual(
            document_author(mail)(),
            '"Hugo Boss" &lt;[email protected]&gt;')

        self.assertEqual(
            sortable_author(mail)(),
            '"Hugo Boss" &lt;[email protected]&gt;')
コード例 #4
0
    def test_author_indexes_with_bad_from_header(self):
        mail = self.stub()
        msg = self.stub()

        self.expect(mail.msg).result(msg)
        self.expect(msg.has_key('From')).result(True)
        self.expect(msg.get('From')).result(
            'Patrick Hengartner </O=KANTON ZUG/OU=EXCHANGE ADMINISTRATIVE GROUP\n (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=HEPA>')

        self.replay()

        self.assertEqual(
            document_author(mail)(),
            'Patrick Hengartner')

        self.assertEqual(
            sortable_author(mail)(),
            'Patrick Hengartner')