From f372090dd2737f1abc05a48c09bc7db641a75e11 Mon Sep 17 00:00:00 2001 From: Arash Date: Wed, 22 Nov 2023 00:21:25 +0100 Subject: [PATCH] Edit create method to retun list --- lib/galaxy/managers/groups.py | 2 +- lib/galaxy/webapps/galaxy/api/groups.py | 2 +- lib/galaxy_test/api/test_groups.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/managers/groups.py b/lib/galaxy/managers/groups.py index f40c0d7857b3..683d6ec4a8b4 100644 --- a/lib/galaxy/managers/groups.py +++ b/lib/galaxy/managers/groups.py @@ -62,7 +62,7 @@ def create(self, trans: ProvidesAppContext, payload: GroupCreatePayload): encoded_id = DecodedDatabaseIdField.encode(group.id) item = group.to_dict(view="element", value_mapper={"id": DecodedDatabaseIdField.encode}) item["url"] = self._url_for(trans, "create", group_id=encoded_id) - return item + return [item] def show(self, trans: ProvidesAppContext, group_id: int): """ diff --git a/lib/galaxy/webapps/galaxy/api/groups.py b/lib/galaxy/webapps/galaxy/api/groups.py index 19d050669f53..56c92a29e267 100644 --- a/lib/galaxy/webapps/galaxy/api/groups.py +++ b/lib/galaxy/webapps/galaxy/api/groups.py @@ -53,7 +53,7 @@ def create( self, trans: ProvidesAppContext = DependsOnTrans, payload: GroupCreatePayload = Body(...), - ) -> GroupResponse: + ) -> GroupListResponse: return self.manager.create(trans, payload) @router.get( diff --git a/lib/galaxy_test/api/test_groups.py b/lib/galaxy_test/api/test_groups.py index 02bf3bae37ad..6e561497a2ce 100644 --- a/lib/galaxy_test/api/test_groups.py +++ b/lib/galaxy_test/api/test_groups.py @@ -15,7 +15,7 @@ def test_create_valid(self, group_name: Optional[str] = None): payload = self._build_valid_group_payload(group_name) response = self._post("groups", payload, admin=True, json=True) self._assert_status_code_is(response, 200) - group = response.json() + group = response.json()[0] # POST /api/groups returns a list self._assert_valid_group(group) return group