diff --git a/oarepo_requests/services/oarepo/config.py b/oarepo_requests/services/oarepo/config.py index 6f018d1..0345b97 100644 --- a/oarepo_requests/services/oarepo/config.py +++ b/oarepo_requests/services/oarepo/config.py @@ -65,7 +65,9 @@ def __init__(self, entity: str, when: callable = None): def expand(self, obj: Request, context: dict) -> dict: """Create the request links.""" res = {} - res.update(self._resolve(obj, context)["links"]) + resolved = self._resolve(obj, context) + if "links" in resolved: + res.update(resolved["links"]) if hasattr(obj.type, "extra_entity_links"): entity = self._resolve(obj, context) diff --git a/tests/test_requests/test_no_recipient.py b/tests/test_requests/test_no_recipient.py index 71d33a7..76526e9 100644 --- a/tests/test_requests/test_no_recipient.py +++ b/tests/test_requests/test_no_recipient.py @@ -13,7 +13,7 @@ def test_no_recipient( search_clear, ): creator = users[0] - assert creator.id == 1 + assert creator.id == '1' creator_client = logged_client(creator) @@ -26,6 +26,6 @@ def test_no_recipient( "topic": {"thesis_draft": draft1.json["id"]}, } ) - print(resp_request_create.json) assert resp_request_create.status_code == 201 - assert resp_request_create.json == {} + assert resp_request_create.json['receiver'] is None + assert resp_request_create.json['links']['receiver'] == {}