Skip to content

Commit

Permalink
fix: use correct pid value
Browse files Browse the repository at this point in the history
  • Loading branch information
utnapischtim committed Jun 26, 2024
1 parent 12cac20 commit dbdbdb4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion invenio_records_lom/services/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def create(self, identity, data=None, record=None, errors=None):
super().create(identity, data, record, errors)

metadata = LOMMetadata(data["metadata"])
metadata.append_identifier(record.id, catalog="repo-pid")
metadata.append_identifier(record.pid.pid_value, catalog="repo-pid")
record.metadata = metadata.json

# overwrite `publish`` to use the celery-task from this package
Expand Down
2 changes: 2 additions & 0 deletions tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def test_create_draft(service, db, identity, access): # pylint: disable=too-man

# TODO: check the necessity of this
del data["metadata"]["type"]
del json["metadata"]["general"]["identifier"]
assert json["metadata"] == data["metadata"]
assert "access" in json
assert json["access"]["files"] == access["files"]
Expand Down Expand Up @@ -165,6 +166,7 @@ def test_publish(service, db, identity, access): # pylint: disable=too-many-loc
json_pid = general["identifier"][0]["entry"]["langstring"]["#text"]
assert json_pid == record_pid.pid_value

del json["metadata"]["general"]["identifier"]
assert json["metadata"] == data["metadata"]
assert "access" in json
assert json["access"]["files"] == access["files"]
Expand Down

0 comments on commit dbdbdb4

Please sign in to comment.