aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2013-12-30 01:27:56 +0100
committerMatěj Cepl <mcepl@redhat.com>2013-12-30 01:30:36 +0100
commit163aa69fd2b435b2ef180a2fe91c8112e12e15c3 (patch)
tree596d82e7f985f0f0a77d188397e462bd92ff4643 /test
parent6ce68fd69aa0403766bac31c85be6bb4a3a286cc (diff)
downloadgg_scraper-163aa69fd2b435b2ef180a2fe91c8112e12e15c3.tar.gz
General structure of operation and MBOX writing.
So far, only unit test for the latter.
Diffstat (limited to 'test')
-rw-r--r--test/test_unit.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_unit.py b/test/test_unit.py
index 4674529..e79c635 100644
--- a/test/test_unit.py
+++ b/test/test_unit.py
@@ -1,3 +1,4 @@
+import pickle
import unittest
import gg_scrapper
@@ -16,5 +17,20 @@ class TestGGScrapper(unittest.TestCase):
obs_URL = gg_scrapper.Group.do_redirect(ORIG_URL)
self.assertEqual(obs_URL, EXP_URL)
+
+class TestMBOX(unittest.TestCase):
+ def test_create_mbox(self):
+ '''Create a mbox file from (pickled) Group
+ '''
+ group_file_name = 'test/group.pickle'
+ with open(group_file_name, 'r', encoding='utf8') as group_f:
+ group = pickle.load(group_f)
+
+ mbx = gg_scrapper.MBOX()
+ mbx.format_mbox(group)
+
+ with open('test/generated_mbox.mbx') as exp_f:
+ self.assertEqual(exp_f.read(), mbx.mbox_string)
+
if __name__ == '__main__':
unittest.main()