taler-rust

GNU Taler code in Rust. Largely core banking integrations.
Log | Files | Refs | Submodules | README | LICENSE

commit a3bf4f047b99f8cf93a5b234865db7c28cafa283
parent 76458c228b38ccfbebdc6e5fcf47f0c6f068f39b
Author: Antoine A <>
Date:   Thu, 19 Nov 2026 11:37:37 +0100

common: drop stupid LLM tests

Diffstat:
Mcommon/taler-api/src/error.rs | 23-----------------------
Mcommon/taler-api/src/extract.rs | 49-------------------------------------------------
2 files changed, 0 insertions(+), 72 deletions(-)

diff --git a/common/taler-api/src/error.rs b/common/taler-api/src/error.rs @@ -276,26 +276,3 @@ pub fn forbidden(hint: impl Display) -> ApiError { pub fn bad_request(hint: impl Display) -> ApiError { ApiError::new(ErrorCode::GENERIC_JSON_INVALID).with_hint(hint) } - -#[cfg(test)] -mod tests { - use super::*; - use serde_json::{Value, json, value::to_raw_value}; - - #[tokio::test] - async fn extra_details_in_response() { - let extra = json!({ "fields": ["amount", "currency"] }); - let response = bad_request("invalid payment") - .with_extra(to_raw_value(&extra).unwrap()) - .into_response(); - - assert_eq!(response.status(), StatusCode::BAD_REQUEST); - let body = axum::body::to_bytes(response.into_body(), 4096) - .await - .unwrap(); - let body: Value = serde_json::from_slice(&body).unwrap(); - assert_eq!(body["code"], ErrorCode::GENERIC_JSON_INVALID as u16); - assert_eq!(body["hint"], "invalid payment"); - assert_eq!(body["extra"], extra); - } -} diff --git a/common/taler-api/src/extract.rs b/common/taler-api/src/extract.rs @@ -237,52 +237,3 @@ impl<T: serde::de::DeserializeOwned, S: Sync + Send> FromRequestParts<S> for Que Ok(Query(params)) } } - -#[cfg(test)] -mod tests { - use super::*; - - #[tokio::test] - async fn configured_decompression_limit() { - const LIMIT: usize = 2 * MAX_BODY_LENGTH + 2; - let value = "x".repeat(LIMIT - 2); - let json = serde_json::to_vec(&value).unwrap(); - let mut buffer = vec![0; json.len()]; - let (compressed, code) = - zlib_rs::compress_slice(&mut buffer, &json, zlib_rs::DeflateConfig::default()); - assert_eq!(code, ReturnCode::Ok); - - let request = |data: &[u8]| { - Request::builder() - .header(header::CONTENT_TYPE, "application/json") - .header(header::CONTENT_ENCODING, "deflate") - .body(Body::from(data.to_vec())) - .unwrap() - }; - assert!( - Req::<String>::from_request(request(compressed), &()) - .await - .is_err() - ); - let req = request(compressed); - assert_eq!( - Req::<String, LIMIT>::from_request(req, &()) - .await - .unwrap() - .0, - value - ); - let req = request(compressed); - assert!( - OptReq::<String, { LIMIT - 1 }>::from_request(req, &()) - .await - .is_err() - ); - let truncated = request(&compressed[..compressed.len() - 1]); - assert!( - Req::<String, LIMIT>::from_request(truncated, &()) - .await - .is_err() - ); - } -}