Exemplo n.º 1
0
    def test_run_folder_exception(self,
                                  mock_isdir,
                                  mock_walk,
                                  mock_run_importanize,
                                  mock_parser):
        mock_run_importanize.side_effect = ValueError
        mock_isdir.return_value = True
        mock_walk.return_value = [
            (
                'root',
                ['dir1', 'dir2'],
                ['foo.py', 'bar.txt'],
            ),
        ]

        conf = mock.MagicMock(print=True)
        run(
            mock.sentinel.path,
            mock.sentinel.config,
            conf,
        )
        mock_run_importanize.assert_called_once_with(
            os.path.join('root', 'foo.py'),
            mock.sentinel.config,
            conf,
        )
        mock_parser.error.assert_called_once_with(mock.ANY)
Exemplo n.º 2
0
 def test_run_single_file(self, mock_isdir, mock_run_importanize):
     mock_isdir.return_value = False
     run(
         mock.sentinel.path,
         mock.sentinel.config,
         mock.sentinel.args,
     )
     mock_run_importanize.assert_called_once_with(
         mock.sentinel.path,
         mock.sentinel.config,
         mock.sentinel.args,
     )
Exemplo n.º 3
0
 def test_run_single_file(self, mock_isdir, mock_run_importanize):
     mock_isdir.return_value = False
     run(
         mock.sentinel.path,
         mock.sentinel.config,
         mock.sentinel.args,
     )
     mock_run_importanize.assert_called_once_with(
         mock.sentinel.path,
         mock.sentinel.config,
         mock.sentinel.args,
     )
Exemplo n.º 4
0
 def test_run_single_file_exception(self, mock_isdir, mock_run_importanize,
                                    mock_parser):
     mock_isdir.return_value = False
     mock_run_importanize.side_effect = ValueError
     run(
         mock.sentinel.path,
         mock.sentinel.config,
         mock.sentinel.args,
     )
     mock_run_importanize.assert_called_once_with(
         mock.sentinel.path,
         mock.sentinel.config,
         mock.sentinel.args,
     )
     mock_parser.error.assert_called_once_with(mock.ANY)
Exemplo n.º 5
0
 def test_run_single_file_exception(self,
                                    mock_isdir,
                                    mock_run_importanize,
                                    mock_parser):
     mock_isdir.return_value = False
     mock_run_importanize.side_effect = ValueError
     run(
         mock.sentinel.path,
         mock.sentinel.config,
         mock.sentinel.args,
     )
     mock_run_importanize.assert_called_once_with(
         mock.sentinel.path,
         mock.sentinel.config,
         mock.sentinel.args,
     )
     mock_parser.error.assert_called_once_with(mock.ANY)
Exemplo n.º 6
0
    def test_run_folder(self, mock_isdir, mock_walk, mock_run_importanize):
        mock_isdir.return_value = True
        mock_walk.return_value = [
            (
                'root',
                ['dir1', 'dir2'],
                ['foo.py', 'bar.txt'],
            ),
        ]

        conf = mock.MagicMock(print=True)
        run(
            mock.sentinel.path,
            mock.sentinel.config,
            conf,
        )
        mock_run_importanize.assert_called_once_with(
            os.path.join('root', 'foo.py'),
            mock.sentinel.config,
            conf,
        )
Exemplo n.º 7
0
    def test_run_folder(self,
                        mock_isdir,
                        mock_walk,
                        mock_run_importanize):
        mock_isdir.return_value = True
        mock_walk.return_value = [
            (
                'root',
                ['dir1', 'dir2'],
                ['foo.py', 'bar.txt'],
            ),
        ]

        conf = mock.MagicMock(print=True)
        run(
            mock.sentinel.path,
            mock.sentinel.config,
            conf,
        )
        mock_run_importanize.assert_called_once_with(
            os.path.join('root', 'foo.py'),
            mock.sentinel.config,
            conf,
        )
Exemplo n.º 8
0
    def test_run_folder_exception(self, mock_isdir, mock_walk,
                                  mock_run_importanize, mock_parser):
        mock_run_importanize.side_effect = ValueError
        mock_isdir.return_value = True
        mock_walk.return_value = [
            (
                'root',
                ['dir1', 'dir2'],
                ['foo.py', 'bar.txt'],
            ),
        ]

        conf = mock.MagicMock(print=True)
        run(
            mock.sentinel.path,
            mock.sentinel.config,
            conf,
        )
        mock_run_importanize.assert_called_once_with(
            os.path.join('root', 'foo.py'),
            mock.sentinel.config,
            conf,
        )
        mock_parser.error.assert_called_once_with(mock.ANY)