about summary refs log tree commit diff
path: root/test/python/test_openapi.py
diff options
context:
space:
mode:
authorPjotr Prins <pjotr.public01@thebird.nl>2026-10-03 13:49:36 +0000
committerPjotr <wrk@bosa.lan>2026-10-03 13:49:36 +0000
commit7c1bdb98a569d8b6389b222af746155c53aa3761 (patch)
treedae203b9214ab0c8d9e1e7a061387d7ddef79e82 /test/python/test_openapi.py
parent50385262fa8c26a1c7f5b170b0ccb1196ba2f676 (diff)
downloadgenenetwork4-7c1bdb98a569d8b6389b222af746155c53aa3761.tar.gz
Add /groups and /groups/{group} endpoints.
* src/db.rs (Group): New struct.  Summary of one InbredSet row,
matching the shape of GeneNetwork2's GET /api/v_pre1/groups response.
(get_all_groups): New function.  Mirrors GeneNetwork2's
wqflask.api.router.get_groups_list (no species filter yet).
(GroupDetail): New struct, deriving FromRow instead of being built
from a tuple like SpeciesDetail, since InbredSet has 14 columns, more
than mysql_common's FromRow is implemented for tuples (up to 12).
FromRow matches by column name (PascalCase of the field name via
#[mysql(rename_all = "PascalCase")]), except public, which is
lowercase in the schema and needs its own #[mysql(rename = "public")].
(get_group_by_name): New function.  Mirrors GeneNetwork2's
wqflask.api.router.get_group_info, but returns every column instead of
a fixed subset.
* src/lib.rs (app): Add /groups and /groups/{group} routes.
(groups, group_by_name): New handlers, following the same
ApiError/request-id/spawn_blocking pattern as species/species_by_name.
(group_by_name): On no match, set ApiError's next to /groups.
* tests/groups.rs: New file.  Checks BXD is present (used throughout
the GeneNetwork2 and GeneNetwork3 test suites as a fixture group,
always present in the database); skips rather than fails when no
database is reachable, same as species.rs.
* test/python/test_groups.py: New file.  Likewise.
* tests/group_by_name.rs: New file.  Checks BXD's full row and an
unknown-group 404 case, same pattern as species_by_name.rs.
* test/python/test_group_by_name.py: New file.  Likewise.
* tests/openapi.rs (openapi_json_describes_all_endpoints): Check for
/groups and /groups/{group} among the documented paths.
* test/python/test_openapi.py
(test_openapi_json_describes_all_endpoints): Likewise.
* README.md: Document /groups and /groups/{group}.
Diffstat (limited to 'test/python/test_openapi.py')
-rw-r--r--test/python/test_openapi.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/python/test_openapi.py b/test/python/test_openapi.py
index 0815d34..f4813c3 100644
--- a/test/python/test_openapi.py
+++ b/test/python/test_openapi.py
@@ -20,7 +20,14 @@ class OpenApiTest(ServerTestCase):
 
         doc = json.loads(body)
         self.assertEqual(doc["info"]["title"], "GeneNetwork4 API")
-        for path in ("/", "/version", "/species", "/species/{species}"):
+        for path in (
+            "/",
+            "/version",
+            "/species",
+            "/species/{species}",
+            "/groups",
+            "/groups/{group}",
+        ):
             self.assertIn(path, doc["paths"])