diff --git a/api/share/utils.py b/api/share/utils.py index 97941de145d..d9ffd388771 100644 --- a/api/share/utils.py +++ b/api/share/utils.py @@ -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={ @@ -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), ) @@ -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): diff --git a/osf_tests/test_collection_submission.py b/osf_tests/test_collection_submission.py index cd719c40bb5..327447e313e 100644 --- a/osf_tests/test_collection_submission.py +++ b/osf_tests/test_collection_submission.py @@ -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') @@ -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')