Skip to content

Commit

Permalink
update auxiliary download test
Browse files Browse the repository at this point in the history
  • Loading branch information
aperrin66 committed Jan 17, 2025
1 parent e684609 commit ca9dff5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/converters/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,22 @@ def test_download_auxiliary_files_if_folder_not_present(self):
with mock.patch('pathlib.Path.is_dir', return_value=False), \
mock.patch('os.makedirs'), \
mock.patch('geospaas_processing.utils.http_request') as mock_http_request, \
mock.patch('tarfile.open'), \
mock.patch('builtins.open'), \
mock.patch('tarfile.open') as mock_tarfile_open, \
mock.patch('builtins.open') as mock_open, \
mock.patch('pathlib.Path.iterdir', return_value=['/baz']), \
mock.patch('pathlib.Path.rmdir') as mock_rmdir, \
mock.patch('pathlib.Path.unlink') as mock_unlink, \
mock.patch('shutil.move') as mock_move, \
mock.patch.object(TestConversionManager, 'make_symlink') as mock_make_symlink:
mock_chunk = mock.MagicMock()
(mock_http_request.return_value.__enter__.return_value
.iter_content.return_value) = iter([mock_chunk])
TestConversionManager.download_auxiliary_files()

mock_http_request.assert_called()
mock_http_request.return_value.__enter__.return_value.iter_content.assert_called()
mock_open.return_value.__enter__.return_value.write.assert_called_with(mock_chunk)
mock_tarfile_open.assert_called()
mock_rmdir.assert_called()
mock_unlink.assert_called()
mock_move.assert_called()
Expand Down

0 comments on commit ca9dff5

Please sign in to comment.