-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08a5ded
commit c9392ec
Showing
9 changed files
with
274 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -374,45 +374,42 @@ def test_dandiset_rest_create(api_client, user): | |
# Verify that computed metadata was injected | ||
year = datetime.datetime.now(datetime.UTC).year | ||
url = f'{settings.DANDI_WEB_APP_URL}/dandiset/{dandiset.identifier}/draft' | ||
assert ( | ||
dandiset.draft_version.metadata | ||
== { | ||
**metadata, | ||
'manifestLocation': [ | ||
f'{settings.DANDI_API_URL}/api/dandisets/{dandiset.identifier}/versions/draft/assets/' | ||
], | ||
'name': name, | ||
'identifier': DANDISET_SCHEMA_ID_RE, | ||
'id': f'DANDI:{dandiset.identifier}/draft', | ||
'version': 'draft', | ||
'url': url, | ||
'dateCreated': UTC_ISO_TIMESTAMP_RE, | ||
'citation': ( | ||
f'{user.last_name}, {user.first_name} ({year}) {name} ' | ||
f'(Version draft) [Data set]. DANDI archive. {url}' | ||
), | ||
'@context': f'https://raw.githubusercontent.com/dandi/schema/master/releases/{settings.DANDI_SCHEMA_VERSION}/context.json', | ||
'schemaVersion': settings.DANDI_SCHEMA_VERSION, | ||
'schemaKey': 'Dandiset', | ||
'access': [{'schemaKey': 'AccessRequirements', 'status': 'dandi:OpenAccess'}], | ||
'repository': settings.DANDI_WEB_APP_URL, | ||
'contributor': [ | ||
{ | ||
'name': 'Doe, John', | ||
'email': user.email, | ||
'roleName': ['dcite:ContactPerson'], | ||
'schemaKey': 'Person', | ||
'affiliation': [], | ||
'includeInCitation': True, | ||
} | ||
], | ||
'assetsSummary': { | ||
'schemaKey': 'AssetsSummary', | ||
'numberOfBytes': 0, | ||
'numberOfFiles': 0, | ||
}, | ||
} | ||
) | ||
assert dandiset.draft_version.metadata == { | ||
**metadata, | ||
'manifestLocation': [ | ||
f'{settings.DANDI_API_URL}/api/dandisets/{dandiset.identifier}/versions/draft/assets/' | ||
], | ||
'name': name, | ||
'identifier': DANDISET_SCHEMA_ID_RE, | ||
'id': f'DANDI:{dandiset.identifier}/draft', | ||
'version': 'draft', | ||
'url': url, | ||
'dateCreated': UTC_ISO_TIMESTAMP_RE, | ||
'citation': ( | ||
f'{user.last_name}, {user.first_name} ({year}) {name} ' | ||
f'(Version draft) [Data set]. DANDI archive. {url}' | ||
), | ||
'@context': f'https://raw.githubusercontent.com/dandi/schema/master/releases/{settings.DANDI_SCHEMA_VERSION}/context.json', | ||
'schemaVersion': settings.DANDI_SCHEMA_VERSION, | ||
'schemaKey': 'Dandiset', | ||
'access': [{'schemaKey': 'AccessRequirements', 'status': 'dandi:OpenAccess'}], | ||
'repository': settings.DANDI_WEB_APP_URL, | ||
'contributor': [ | ||
{ | ||
'name': 'Doe, John', | ||
'email': user.email, | ||
'roleName': ['dcite:ContactPerson'], | ||
'schemaKey': 'Person', | ||
'affiliation': [], | ||
'includeInCitation': True, | ||
} | ||
], | ||
'assetsSummary': { | ||
'schemaKey': 'AssetsSummary', | ||
'numberOfBytes': 0, | ||
'numberOfFiles': 0, | ||
}, | ||
} | ||
|
||
|
||
@pytest.mark.django_db() | ||
|
@@ -470,45 +467,42 @@ def test_dandiset_rest_create_with_identifier(api_client, admin_user): | |
# Verify that computed metadata was injected | ||
year = datetime.datetime.now(datetime.UTC).year | ||
url = f'{settings.DANDI_WEB_APP_URL}/dandiset/{dandiset.identifier}/draft' | ||
assert ( | ||
dandiset.draft_version.metadata | ||
== { | ||
**metadata, | ||
'manifestLocation': [ | ||
f'{settings.DANDI_API_URL}/api/dandisets/{dandiset.identifier}/versions/draft/assets/' | ||
], | ||
'name': name, | ||
'identifier': f'DANDI:{identifier}', | ||
'id': f'DANDI:{dandiset.identifier}/draft', | ||
'version': 'draft', | ||
'url': url, | ||
'dateCreated': UTC_ISO_TIMESTAMP_RE, | ||
'citation': ( | ||
f'{admin_user.last_name}, {admin_user.first_name} ({year}) {name} ' | ||
f'(Version draft) [Data set]. DANDI archive. {url}' | ||
), | ||
'@context': f'https://raw.githubusercontent.com/dandi/schema/master/releases/{settings.DANDI_SCHEMA_VERSION}/context.json', | ||
'schemaVersion': settings.DANDI_SCHEMA_VERSION, | ||
'schemaKey': 'Dandiset', | ||
'access': [{'schemaKey': 'AccessRequirements', 'status': 'dandi:OpenAccess'}], | ||
'repository': settings.DANDI_WEB_APP_URL, | ||
'contributor': [ | ||
{ | ||
'name': 'Doe, John', | ||
'email': admin_user.email, | ||
'roleName': ['dcite:ContactPerson'], | ||
'schemaKey': 'Person', | ||
'affiliation': [], | ||
'includeInCitation': True, | ||
} | ||
], | ||
'assetsSummary': { | ||
'schemaKey': 'AssetsSummary', | ||
'numberOfBytes': 0, | ||
'numberOfFiles': 0, | ||
}, | ||
} | ||
) | ||
assert dandiset.draft_version.metadata == { | ||
**metadata, | ||
'manifestLocation': [ | ||
f'{settings.DANDI_API_URL}/api/dandisets/{dandiset.identifier}/versions/draft/assets/' | ||
], | ||
'name': name, | ||
'identifier': f'DANDI:{identifier}', | ||
'id': f'DANDI:{dandiset.identifier}/draft', | ||
'version': 'draft', | ||
'url': url, | ||
'dateCreated': UTC_ISO_TIMESTAMP_RE, | ||
'citation': ( | ||
f'{admin_user.last_name}, {admin_user.first_name} ({year}) {name} ' | ||
f'(Version draft) [Data set]. DANDI archive. {url}' | ||
), | ||
'@context': f'https://raw.githubusercontent.com/dandi/schema/master/releases/{settings.DANDI_SCHEMA_VERSION}/context.json', | ||
'schemaVersion': settings.DANDI_SCHEMA_VERSION, | ||
'schemaKey': 'Dandiset', | ||
'access': [{'schemaKey': 'AccessRequirements', 'status': 'dandi:OpenAccess'}], | ||
'repository': settings.DANDI_WEB_APP_URL, | ||
'contributor': [ | ||
{ | ||
'name': 'Doe, John', | ||
'email': admin_user.email, | ||
'roleName': ['dcite:ContactPerson'], | ||
'schemaKey': 'Person', | ||
'affiliation': [], | ||
'includeInCitation': True, | ||
} | ||
], | ||
'assetsSummary': { | ||
'schemaKey': 'AssetsSummary', | ||
'numberOfBytes': 0, | ||
'numberOfFiles': 0, | ||
}, | ||
} | ||
|
||
|
||
@pytest.mark.django_db() | ||
|
@@ -580,44 +574,41 @@ def test_dandiset_rest_create_with_contributor(api_client, admin_user): | |
# Verify that computed metadata was injected | ||
year = datetime.datetime.now(datetime.UTC).year | ||
url = f'{settings.DANDI_WEB_APP_URL}/dandiset/{dandiset.identifier}/draft' | ||
assert ( | ||
dandiset.draft_version.metadata | ||
== { | ||
**metadata, | ||
'manifestLocation': [ | ||
f'{settings.DANDI_API_URL}/api/dandisets/{dandiset.identifier}/versions/draft/assets/' | ||
], | ||
'name': name, | ||
'identifier': f'DANDI:{identifier}', | ||
'id': f'DANDI:{dandiset.identifier}/draft', | ||
'version': 'draft', | ||
'url': url, | ||
'dateCreated': UTC_ISO_TIMESTAMP_RE, | ||
'citation': ( | ||
f'Jane Doe ({year}) {name} ' f'(Version draft) [Data set]. DANDI archive. {url}' | ||
), | ||
'@context': f'https://raw.githubusercontent.com/dandi/schema/master/releases/{settings.DANDI_SCHEMA_VERSION}/context.json', | ||
'schemaVersion': settings.DANDI_SCHEMA_VERSION, | ||
'schemaKey': 'Dandiset', | ||
'access': [{'schemaKey': 'AccessRequirements', 'status': 'dandi:OpenAccess'}], | ||
'repository': settings.DANDI_WEB_APP_URL, | ||
'contributor': [ | ||
{ | ||
'name': 'Jane Doe', | ||
'email': '[email protected]', | ||
'roleName': ['dcite:ContactPerson'], | ||
'schemaKey': 'Person', | ||
'affiliation': [], | ||
'includeInCitation': True, | ||
} | ||
], | ||
'assetsSummary': { | ||
'schemaKey': 'AssetsSummary', | ||
'numberOfBytes': 0, | ||
'numberOfFiles': 0, | ||
}, | ||
} | ||
) | ||
assert dandiset.draft_version.metadata == { | ||
**metadata, | ||
'manifestLocation': [ | ||
f'{settings.DANDI_API_URL}/api/dandisets/{dandiset.identifier}/versions/draft/assets/' | ||
], | ||
'name': name, | ||
'identifier': f'DANDI:{identifier}', | ||
'id': f'DANDI:{dandiset.identifier}/draft', | ||
'version': 'draft', | ||
'url': url, | ||
'dateCreated': UTC_ISO_TIMESTAMP_RE, | ||
'citation': ( | ||
f'Jane Doe ({year}) {name} ' f'(Version draft) [Data set]. DANDI archive. {url}' | ||
), | ||
'@context': f'https://raw.githubusercontent.com/dandi/schema/master/releases/{settings.DANDI_SCHEMA_VERSION}/context.json', | ||
'schemaVersion': settings.DANDI_SCHEMA_VERSION, | ||
'schemaKey': 'Dandiset', | ||
'access': [{'schemaKey': 'AccessRequirements', 'status': 'dandi:OpenAccess'}], | ||
'repository': settings.DANDI_WEB_APP_URL, | ||
'contributor': [ | ||
{ | ||
'name': 'Jane Doe', | ||
'email': '[email protected]', | ||
'roleName': ['dcite:ContactPerson'], | ||
'schemaKey': 'Person', | ||
'affiliation': [], | ||
'includeInCitation': True, | ||
} | ||
], | ||
'assetsSummary': { | ||
'schemaKey': 'AssetsSummary', | ||
'numberOfBytes': 0, | ||
'numberOfFiles': 0, | ||
}, | ||
} | ||
|
||
|
||
@pytest.mark.django_db() | ||
|
@@ -673,45 +664,42 @@ def test_dandiset_rest_create_embargoed(api_client, user): | |
# Verify that computed metadata was injected | ||
year = datetime.datetime.now(datetime.UTC).year | ||
url = f'{settings.DANDI_WEB_APP_URL}/dandiset/{dandiset.identifier}/draft' | ||
assert ( | ||
dandiset.draft_version.metadata | ||
== { | ||
**metadata, | ||
'manifestLocation': [ | ||
f'{settings.DANDI_API_URL}/api/dandisets/{dandiset.identifier}/versions/draft/assets/' | ||
], | ||
'name': name, | ||
'identifier': DANDISET_SCHEMA_ID_RE, | ||
'id': f'DANDI:{dandiset.identifier}/draft', | ||
'version': 'draft', | ||
'url': url, | ||
'dateCreated': UTC_ISO_TIMESTAMP_RE, | ||
'citation': ( | ||
f'{user.last_name}, {user.first_name} ({year}) {name} ' | ||
f'(Version draft) [Data set]. DANDI archive. {url}' | ||
), | ||
'@context': f'https://raw.githubusercontent.com/dandi/schema/master/releases/{settings.DANDI_SCHEMA_VERSION}/context.json', | ||
'schemaVersion': settings.DANDI_SCHEMA_VERSION, | ||
'schemaKey': 'Dandiset', | ||
'access': [{'schemaKey': 'AccessRequirements', 'status': 'dandi:EmbargoedAccess'}], | ||
'repository': settings.DANDI_WEB_APP_URL, | ||
'contributor': [ | ||
{ | ||
'name': 'Doe, John', | ||
'email': user.email, | ||
'roleName': ['dcite:ContactPerson'], | ||
'schemaKey': 'Person', | ||
'affiliation': [], | ||
'includeInCitation': True, | ||
} | ||
], | ||
'assetsSummary': { | ||
'schemaKey': 'AssetsSummary', | ||
'numberOfBytes': 0, | ||
'numberOfFiles': 0, | ||
}, | ||
} | ||
) | ||
assert dandiset.draft_version.metadata == { | ||
**metadata, | ||
'manifestLocation': [ | ||
f'{settings.DANDI_API_URL}/api/dandisets/{dandiset.identifier}/versions/draft/assets/' | ||
], | ||
'name': name, | ||
'identifier': DANDISET_SCHEMA_ID_RE, | ||
'id': f'DANDI:{dandiset.identifier}/draft', | ||
'version': 'draft', | ||
'url': url, | ||
'dateCreated': UTC_ISO_TIMESTAMP_RE, | ||
'citation': ( | ||
f'{user.last_name}, {user.first_name} ({year}) {name} ' | ||
f'(Version draft) [Data set]. DANDI archive. {url}' | ||
), | ||
'@context': f'https://raw.githubusercontent.com/dandi/schema/master/releases/{settings.DANDI_SCHEMA_VERSION}/context.json', | ||
'schemaVersion': settings.DANDI_SCHEMA_VERSION, | ||
'schemaKey': 'Dandiset', | ||
'access': [{'schemaKey': 'AccessRequirements', 'status': 'dandi:EmbargoedAccess'}], | ||
'repository': settings.DANDI_WEB_APP_URL, | ||
'contributor': [ | ||
{ | ||
'name': 'Doe, John', | ||
'email': user.email, | ||
'roleName': ['dcite:ContactPerson'], | ||
'schemaKey': 'Person', | ||
'affiliation': [], | ||
'includeInCitation': True, | ||
} | ||
], | ||
'assetsSummary': { | ||
'schemaKey': 'AssetsSummary', | ||
'numberOfBytes': 0, | ||
'numberOfFiles': 0, | ||
}, | ||
} | ||
|
||
|
||
@pytest.mark.django_db() | ||
|
Oops, something went wrong.