def test_add_multi_authors(self): mt = MailTree('abc@efg') mt.add_author('*****@*****.**') mt.add_author('*****@*****.**') mt.add_author('*****@*****.**') self.assertEqual(mt.authors, ['*****@*****.**', '*****@*****.**'])
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ē <*****@*****.**>'])
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)
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')
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, '*****@*****.**')
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 <*****@*****.**>'])
def test_add_author(self): mt = MailTree('abc@efg') mt.add_author('My Name Is <*****@*****.**>') self.assertEqual(mt.authors, ['My Name Is <*****@*****.**>'])