Example #1
0
    def test_init(self):
        """Check attributes initialization"""

        mls = MailingList('test', self.tmp_path)

        self.assertEqual(mls.uri, 'test')
        self.assertEqual(mls.dirpath, self.tmp_path)
Example #2
0
    def test_mboxes_error(self, mock_check_compressed_file_type):
        """Check whether OSError exceptions are properly handled"""

        mock_check_compressed_file_type.side_effect = OSError

        mls = MailingList('test', self.tmp_path)
        with self.assertLogs(logger, level='WARNING') as cm:
            _ = mls.mboxes
            self.assertEqual(cm.output[-1], 'WARNING:perceval.backends.core.mbox:'
                                            'Ignoring zip mbox due to: ')
Example #3
0
    def test_mboxes(self):
        """Check whether it gets a list of mboxes sorted by name"""

        mls = MailingList('test', self.tmp_path)

        mboxes = mls.mboxes
        self.assertEqual(len(mboxes), 6)
        self.assertEqual(mboxes[0].filepath, self.cfiles['bz2'])
        self.assertEqual(mboxes[1].filepath, self.cfiles['gz'])
        self.assertEqual(mboxes[2].filepath, self.files['complex'])
        self.assertEqual(mboxes[3].filepath, self.files['multipart'])
        self.assertEqual(mboxes[4].filepath, self.files['single'])
        self.assertEqual(mboxes[5].filepath, self.files['unknown'])