Skip to content
Open
Show file tree
Hide file tree
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: 4 additions & 4 deletions api/share/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def share_update_cedar_metadata_record(self, referent_id, cedar_record_pk):
shtrove_ingest_url(),
params={
'focus_iri': referent.get_semantic_iri(),
'record_identifier': _shtrove_cedar_record_identifier(cedar_record._id, cedar_record.template.cedar_id),
'record_identifier': _shtrove_cedar_record_identifier(referent._id, cedar_record.template.cedar_id),
'is_supplementary': True,
},
headers={
Expand All @@ -142,7 +142,7 @@ def share_delete_cedar_metadata_record(
response = requests.delete(
shtrove_ingest_url(),
params={
'record_identifier': _shtrove_cedar_record_identifier(cedar_record___id, cedar_template_cedar_id),
'record_identifier': _shtrove_cedar_record_identifier(cedar_referent___id, cedar_template_cedar_id),
},
headers=_shtrove_auth_headers(referent),
)
Expand Down Expand Up @@ -300,8 +300,8 @@ def _shtrove_record_identifier(osf_item, osfmap_partition: OsfmapPartition):
)


def _shtrove_cedar_record_identifier(cedar_record___id, template_cedar_id) -> str:
return f'{cedar_record___id}/CedarMetadataRecord:{template_cedar_id}'
def _shtrove_cedar_record_identifier(referent_osfid, template_cedar_id) -> str:
return f'{referent_osfid}/CedarMetadataRecord:{template_cedar_id}'


def _shtrove_auth_headers(osf_item):
Expand Down
12 changes: 6 additions & 6 deletions osf_tests/test_collection_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,12 +874,12 @@ def test_cedar_record_identifier_on_create(self, mock_delete, mock_pls, unmodera
with mock.patch('api.share.utils._shtrove_cedar_record_identifier') as mock_identifier:
unmoderated_collection_submission_public.save()
mock_identifier.assert_called_with(
to_create_record._id,
to_create_record.guid._id,
to_create_record.template.cedar_id
)
assert (
_shtrove_cedar_record_identifier(to_create_record._id, to_create_record.template.cedar_id) ==
f'{to_create_record._id}/CedarMetadataRecord:http26'
_shtrove_cedar_record_identifier(to_create_record.guid._id, to_create_record.template.cedar_id) ==
f'{to_create_record.guid._id}/CedarMetadataRecord:http26'
)

@mock.patch('api.share.utils.pls_send_trove_record')
Expand All @@ -897,10 +897,10 @@ def test_cedar_record_identifier_on_delete(self, mock_update, mock_pls, unmodera
with mock.patch('api.share.utils.requests.delete'):
with mock.patch('api.share.utils._shtrove_cedar_record_identifier') as mock_identifier:
unmoderated_collection_submission_public.save()
mock_identifier.assert_called_with(to_delete_record._id, to_delete_record.template.cedar_id)
mock_identifier.assert_called_with(to_delete_record.guid._id, to_delete_record.template.cedar_id)
assert (
_shtrove_cedar_record_identifier(to_delete_record._id, to_delete_record.template.cedar_id) ==
f'{to_delete_record._id}/CedarMetadataRecord:http25'
_shtrove_cedar_record_identifier(to_delete_record.guid._id, to_delete_record.template.cedar_id) ==
f'{to_delete_record.guid._id}/CedarMetadataRecord:http25'
)

@mock.patch('api.share.utils.share_update_cedar_metadata_record')
Expand Down