Skip to content

Commit

Permalink
Add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair committed Apr 27, 2023
1 parent be7e206 commit f5308cc
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions dkist/io/tests/test_file_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,47 @@ def test_length_one_first_array_axis(small_visp_dataset):
assert len(small_visp_dataset[0].files.filenames) == 1

assert len(small_visp_dataset[:, 5, 5].files.filenames) == 3


@pytest.mark.parametrize("kwargs", (
{},
{"path": "~/", "overwrite": True}
))
def test_download_quality(mocker, small_visp_dataset, kwargs):
simple_download = mocker.patch("dkist.io.file_manager.Downloader.simple_download")
from dkist.net import conf

small_visp_dataset.files.quality_report(**kwargs)

# Insert the expected default kwargs
if kwargs.get("path") is None:
kwargs["path"] = small_visp_dataset.files.basepath
if "overwrite" not in kwargs:
kwargs["overwrite"] = None

simple_download.assert_called_once_with(
[f"{conf.download_endpoint}/quality?datasetId={small_visp_dataset.meta['inventory']['datasetId']}"],
**kwargs
)


@pytest.mark.parametrize("kwargs", (
{},
{"path": "~/", "overwrite": True}
))
def test_download_quality_movie(mocker, small_visp_dataset, kwargs):
simple_download = mocker.patch("dkist.io.file_manager.Downloader.simple_download")
from dkist.net import conf

small_visp_dataset.files.preview_movie(**kwargs)

# Insert the expected default kwargs
if kwargs.get("path") is None:
kwargs["path"] = small_visp_dataset.files.basepath
if "overwrite" not in kwargs:
kwargs["overwrite"] = None

simple_download.assert_called_once_with(
[f"{conf.download_endpoint}/movie?datasetId={small_visp_dataset.meta['inventory']['datasetId']}"],
**kwargs
)

0 comments on commit f5308cc

Please sign in to comment.