diff options
Diffstat (limited to 'test/test_unit.py')
-rw-r--r-- | test/test_unit.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/test/test_unit.py b/test/test_unit.py index 56ec08f..9cb04fc 100644 --- a/test/test_unit.py +++ b/test/test_unit.py @@ -22,16 +22,17 @@ class TestGGScrapper(unittest.TestCase): class TestMBOX(unittest.TestCase): - def test_create_mbox(self): - '''Create a mbox file from (pickled) Group - ''' + def setUp(self): group_file_name = 'test/group.yaml' with open(group_file_name, 'r') as group_f: - group = yaml.load(group_f) + self.group = yaml.load(group_f) + def test_create_mbox(self): + '''Create a mbox file from (YAMLed) Group + ''' mbx_file = tempfile.NamedTemporaryFile('w', delete=False) mbx = gg_scrapper.MBOX(mbx_file.name) - mbx.write_group(group) + mbx.write_group(self.group) with open('test/mbox.mbx') as exp_f: with open(mbx_file.name) as mbx_f: @@ -39,5 +40,17 @@ class TestMBOX(unittest.TestCase): os.unlink(mbx_file.name) + def test_generate_list_mangled_addrs(self): + self.maxDiff = None + with open('test/mangled_address.cnf') as exp_addr_f: + exp_str = exp_addr_f.read() + + self.group.collect_mangled_addrs() + + with open('{}.cnf'.format(self.group.name)) as obs_f: + mang_addres = obs_f.read() + self.assertEqual(exp_str, mang_addres) + + if __name__ == '__main__': unittest.main() |