forked from TeamMsgExtractor/msg-extractor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tests.py
47 lines (38 loc) · 1.54 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import unittest
import msglite
class TestCase(unittest.TestCase):
def setUp(self):
pass
def test_unicode_message(self):
msg = msglite.Message("example-msg-files/unicode.msg")
# msg.dump()
# msg.debug()
# print(msg.attachments)
self.assertEqual(msg.subject, u"Test for TIF files")
self.assertEqual(
msg.body,
u"This is a test email to experiment with the MS Outlook MSG "
u"Extractor\r\n\r\n\r\n-- \r\n\r\n\r\nKind regards"
u"\r\n\r\n\r\n\r\n\r\nBrian Zhou\r\n\r\n",
)
self.assertEqual(msg.date, "Mon, 18 Nov 2013 08:26:24 +0000")
self.assertEqual(msg.sender, "Brian Zhou <[email protected]>")
self.assertEqual(msg.to, ["[email protected]"])
self.assertEqual(msg.cc, ["Brian Zhou <[email protected]>"])
self.assertEqual(len(msg.attachments), 2)
msg.close()
def test_norse_message(self):
msg = msglite.Message("example-msg-files/norse.msg")
self.assertIn("Byggemøtereferat", msg.subject)
self.assertIn("byggemøtereferat", msg.body)
self.assertIn("byggemøtereferat", msg.htmlBody)
msg.close()
def test_sample_message(self):
msg = msglite.Message("example-msg-files/sample.msg")
self.assertEqual(msg.to, ["[email protected]"])
msg.close()
def test_rom_message(self):
msg = msglite.Message("example-msg-files/rom.msg")
self.assertIn("așteptăm", msg.body)
msg.close()
unittest.main(verbosity=2)