diff options
| author | Pjotr Prins <pjotr.public01@thebird.nl> | 2026-10-03 12:39:04 +0000 |
|---|---|---|
| committer | Pjotr <wrk@bosa.lan> | 2026-10-03 12:39:04 +0000 |
| commit | 6d2254a53e298ad3f2411252f9ffb22f38ab4676 (patch) | |
| tree | 1bd69545372ffb63ce43d00a571fd1d3fe589dc9 /test/python/test_openapi.py | |
| parent | bb1a44b0c75471b5c004170552540b9632f89810 (diff) | |
| download | genenetwork4-6d2254a53e298ad3f2411252f9ffb22f38ab4676.tar.gz | |
Add /species/{species} for a single species' full row.
Checked for an existing implementation first: GeneNetwork2's
wqflask/api/router.py has /api/v_pre1/species/<species_name>, matching
Name, FullName or SpeciesName, but returning only a 4-column subset
(Id, Name, FullName, TaxonomyId). GeneNetwork3's gn3/db/wiki.py has
only internal name-to-id lookups for the wiki feature; its /species is
SPARQL-based metadata, not a Species table row. gn-guile's species
code (gn/data/species.scm) is also SPARQL/RDF metadata, not backed by
db_webqtl.
* src/db.rs (params): Import.
(SpeciesDetail): New struct, one full row of the Species table.
(get_species_by_name): New function. Same match logic as
GeneNetwork2's get_species_info (Name, FullName or SpeciesName), but
selects every column instead of a fixed subset.
* src/lib.rs (app): Add /species/{species} route.
(species_by_name): New handler. 404 if no species matches.
* tests/species_by_name.rs: New file. Tests mouse specifically
(Name=mouse is always present) and an unknown-species 404 case; skips
rather than fails when no database is reachable, same as species.rs.
* test/python/test_species_by_name.py: New file. Likewise.
* tests/openapi.rs (openapi_json_describes_all_endpoints): Check for
/species/{species} among the documented paths.
* test/python/test_openapi.py (test_openapi_json_describes_all_endpoints):
Likewise.
* README.md: Document /species/{species}.
Diffstat (limited to 'test/python/test_openapi.py')
| -rw-r--r-- | test/python/test_openapi.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/python/test_openapi.py b/test/python/test_openapi.py index 03100b9..0815d34 100644 --- a/test/python/test_openapi.py +++ b/test/python/test_openapi.py @@ -20,7 +20,7 @@ class OpenApiTest(ServerTestCase): doc = json.loads(body) self.assertEqual(doc["info"]["title"], "GeneNetwork4 API") - for path in ("/", "/version", "/species"): + for path in ("/", "/version", "/species", "/species/{species}"): self.assertIn(path, doc["paths"]) |
