use axum::http::StatusCode; use http_body_util::BodyExt; use serde_json::Value; mod common; /// Needs a live MariaDB connection (SQL_URI) and a valid token; skips /// rather than fails when either is missing, same as groups.rs. #[tokio::test] async fn mapping_methods_lists_the_tools() { if !common::db_available() { eprintln!( "skipping mapping_methods_lists_the_tools: no usable database (check SQL_URI credentials)" ); return; } let Some(token) = common::auth_token().await else { eprintln!("skipping mapping_methods_lists_the_tools: no token (see docs/gn-auth.md)"); return; }; let response = common::get_with_token("GET /mapping-methods", "/mapping-methods", &token).await; assert_eq!(response.status(), StatusCode::OK); let body = response.into_body().collect().await.unwrap().to_bytes(); let methods: Vec = common::data(&body); // The MappingMethod table lists tools no group uses (PLINK, FastMap). let names: Vec<&str> = methods.iter().map(|m| m["name"].as_str().unwrap()).collect(); assert_eq!(names, ["qtlreaper", "Rqtl", "HappyR", "PLINK", "FastMap"]); assert_eq!(methods[0]["id"], 1); }