diff --git a/dandi/tests/fixtures.py b/dandi/tests/fixtures.py index a13fa954b..788a1a438 100644 --- a/dandi/tests/fixtures.py +++ b/dandi/tests/fixtures.py @@ -628,6 +628,22 @@ def bids_nwb_dandiset( return new_dandiset +# TODO: refactor: avoid duplication and come up with some fixture helper which would +# just need specify bids example name +@pytest.fixture() +def bids_zarr_dandiset( + new_dandiset: SampleDandiset, bids_examples: Path +) -> SampleDandiset: + shutil.copytree( + bids_examples / "micr_SEMzarr", + new_dandiset.dspath, + dirs_exist_ok=True, + ignore=shutil.ignore_patterns(dandiset_metadata_file), + ) + (new_dandiset.dspath / "CHANGES").write_text("0.1.0 2014-11-03\n") + return new_dandiset + + @pytest.fixture() def bids_dandiset_invalid( new_dandiset: SampleDandiset, bids_error_examples: Path diff --git a/dandi/tests/test_upload.py b/dandi/tests/test_upload.py index f30620a52..61cb95247 100644 --- a/dandi/tests/test_upload.py +++ b/dandi/tests/test_upload.py @@ -292,6 +292,17 @@ def test_upload_zarr(new_dandiset: SampleDandiset) -> None: new_dandiset.upload() +# identical to above, but different scenaior/fixture and path. TODO: avoid duplication +def test_upload_bids_zarr(bids_zarr_dandiset: SampleDandiset) -> None: + new_dandiset.upload() + (asset,) = new_dandiset.dandiset.get_assets() + assert isinstance(asset, RemoteZarrAsset) + assert asset.asset_type is AssetType.ZARR + assert asset.path == "sample.zarr" + # Test that uploading again without any changes works: + new_dandiset.upload() + + def test_upload_different_zarr(tmp_path: Path, zarr_dandiset: SampleDandiset) -> None: asset = zarr_dandiset.dandiset.get_asset_by_path("sample.zarr") assert isinstance(asset, RemoteZarrAsset)