Skip to content

Commit

Permalink
Test RemoteDandiset.refresh()
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Jul 26, 2021
1 parent b289c3f commit 62924b8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions dandi/dandiapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ def version(self) -> Version:
self._version_id is None or vdict["version"] == self.version_id
):
self._version = Version.parse_obj(vdict)
self._version_id = self._version.identifier
return self._version
assert self._version_id is not None
self._version = self.get_version(self._version_id)
Expand Down
16 changes: 16 additions & 0 deletions dandi/tests/test_dandiapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,3 +563,19 @@ def test_get_digest_nonexistent(text_dandiset):
asset = text_dandiset["dandiset"].get_asset_by_path("file.txt")
with pytest.raises(NotFoundError):
asset.get_digest("md5")


def test_refresh(text_dandiset):
dandiset = text_dandiset["dandiset"]
mtime = dandiset.version.modified
md = dandiset.get_metadata()
md.description = "A test Dandiset with altered metadata"
dandiset.set_metadata(md)
dandiset.wait_until_valid()
dandiset.publish()
assert dandiset.version.modified == mtime
assert dandiset.most_recent_published_version is None
dandiset.refresh()
assert dandiset.version_id == DRAFT
assert dandiset.version.modified > mtime
assert dandiset.most_recent_published_version is not None

0 comments on commit 62924b8

Please sign in to comment.