Beispiel #1
0
    def test_add_multi_authors(self):
        mt = MailTree('abc@efg')
        mt.add_author('*****@*****.**')
        mt.add_author('*****@*****.**')
        mt.add_author('*****@*****.**')

        self.assertEqual(mt.authors, ['*****@*****.**', '*****@*****.**'])
Beispiel #2
0
    def test_add_encoded_author(self):
        mt = MailTree('abc@efg')

        mt.add_author('=?utf-8?b?xZrDtsacxJMgxYXEg23EkyA8bmFtZUBleGFtcGxlLmNvbT4=?=')
        mt.add_author('=?utf-8?b?xZrDtsacxJMgxYXEg23EkyA8bmFtZUBleGFtcGxlLmNvbT4=?=')

        self.assertEqual(mt.authors, [u'ŚöƜē Ņămē <*****@*****.**>'])
Beispiel #3
0
    def test_hydrate(self):
        mt = MailTree('*****@*****.**')
        mt.hydrate(self.msgA)

        self.assertEqual(mt.parent.author, 'From test <*****@*****.**>')
        self.assertEqual(mt.nodes['*****@*****.**'].message_id, '*****@*****.**')
        self.assertEqual(len(mt.nodes), 1)
Beispiel #4
0
    def test_single_hydration(self):
        mt = MailTree('*****@*****.**')
        mt.hydrate(self.msgA)

        self.assertEqual(mt.parent.author, 'From test <*****@*****.**>')

        mt.parent.author = 'ERASED'
        mt.hydrate(self.msgA)

        self.assertEqual(mt.parent.author, 'ERASED')
Beispiel #5
0
    def test_hydrate_reply(self):
        mt = MailTree('*****@*****.**')
        mt.hydrate(self.msgB)

        self.assertEqual(mt.parent.author, 'From test <*****@*****.**>')
        self.assertEqual(len(mt.nodes), 2)

        self.assertEqual(len(mt.nodes['*****@*****.**'].children), 1)

        self.assertEqual(mt.nodes['*****@*****.**'].children[0].message_id, '*****@*****.**')

        self.assertEqual(mt.message_id, '*****@*****.**')
Beispiel #6
0
    def test_add_child(self):
        mt = MailTree('*****@*****.**')
        mt.addChild(self.msgB)

        self.assertEqual(len(mt.nodes), 2)
        self.assertEqual(mt.nodes['*****@*****.**'].message_id, '*****@*****.**')
        self.assertEqual(mt.nodes['*****@*****.**'].message_id, '*****@*****.**')

        self.assertEqual(len(mt.nodes['*****@*****.**'].children), 1)
        self.assertEqual(mt.nodes['*****@*****.**'].children[0].message_id, '*****@*****.**')

        self.assertEqual(mt.nodes['*****@*****.**'].children, [])

        self.assertEqual(mt.nodes['*****@*****.**'].author, 'From test <*****@*****.**>')

        self.assertEqual(mt.authors, ['From test <*****@*****.**>'])
Beispiel #7
0
    def test_add_author(self):
        mt = MailTree('abc@efg')
        mt.add_author('My Name Is <*****@*****.**>')

        self.assertEqual(mt.authors, ['My Name Is <*****@*****.**>'])