Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions dandi/cli/tests/test_service_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import anys
from click.testing import CliRunner
from dandischema.consts import DANDI_SCHEMA_VERSION
from dandischema.models import ID_PATTERN
import pytest

Expand Down Expand Up @@ -104,18 +103,21 @@ def test_update_dandiset_from_doi(
)
assert r.exit_code == 0
metadata = new_dandiset.dandiset.get_raw_metadata()
# The DANDI schema version in the metadata under test is the server's,
# not this client's.
server_schema_version = new_dandiset.client.get("/info/")["schema_version"]
with (DATA_DIR / "update_dandiset_from_doi" / f"{name}.json").open() as fp:
expected = json.load(fp)
expected["id"] = anys.AnyFullmatch(rf"{ID_PATTERN}:{dandiset_id}/draft")
expected["url"] = f"{repository}/dandiset/{dandiset_id}/draft"
expected["@context"] = (
"https://raw.githubusercontent.com/dandi/schema/master/releases"
f"/{DANDI_SCHEMA_VERSION}/context.json"
f"/{server_schema_version}/context.json"
)
expected["identifier"] = anys.AnyFullmatch(rf"{ID_PATTERN}:{dandiset_id}")
expected["repository"] = repository
expected["dateCreated"] = anys.ANY_AWARE_DATETIME_STR
expected["schemaVersion"] = DANDI_SCHEMA_VERSION
expected["schemaVersion"] = server_schema_version
expected["wasGeneratedBy"][0]["id"] = anys.AnyFullmatch(
r"urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
)
Expand Down
Loading