Пример #1
0
    def test_mboxes_path_init(self, mock_expanduser):
        """Test dirpath initialization"""

        mock_expanduser.return_value = os.path.join(self.tmp_path, 'testpath')

        args = ['http://example.com/']

        cmd = PipermailCommand(*args)
        self.assertEqual(
            cmd.parsed_args.dirpath,
            os.path.join(self.tmp_path, 'testpath/http://example.com/'))

        args = ['http://example.com/', '--mboxes-path', '/tmp/perceval/']

        cmd = PipermailCommand(*args)
        self.assertEqual(cmd.parsed_args.dirpath, '/tmp/perceval/')

        args = [
            'http://example.com/', '--mboxes-path', '/tmp/perceval/',
            '--verify', False
        ]

        cmd = PipermailCommand(*args)
        self.assertEqual(cmd.parsed_args.dirpath, '/tmp/perceval/')
        self.assertFalse(cmd.parsed_args.verify)
    def test_parsing_on_init(self):
        """Test if the class is initialized"""

        args = ['http://example.com/',
                '--mboxes-path', '/tmp/perceval/',
                '--tag', 'test']

        cmd = PipermailCommand(*args)
        self.assertEqual(cmd.parsed_args.url, 'http://example.com/')
        self.assertEqual(cmd.parsed_args.mboxes_path, '/tmp/perceval/')
        self.assertEqual(cmd.parsed_args.tag, 'test')