From fc71e0cafdcd69604cc6074fe09aefc7853754c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Fri, 3 May 2024 17:14:26 +0100 Subject: [PATCH] fixed tests --- Cargo.lock | 1 + nym-node/nym-node-http-api/Cargo.toml | 1 + .../router/api/v1/gateway/client_interfaces/wireguard/mod.rs | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f22b2cb428..555d3e03bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5110,6 +5110,7 @@ dependencies = [ "fastrand 2.1.0", "headers", "hmac 0.12.1", + "hyper 1.3.1", "ipnetwork 0.16.0", "nym-crypto", "nym-http-api-common", diff --git a/nym-node/nym-node-http-api/Cargo.toml b/nym-node/nym-node-http-api/Cargo.toml index 1b9fb3043e..4efd1a2ff7 100644 --- a/nym-node/nym-node-http-api/Cargo.toml +++ b/nym-node/nym-node-http-api/Cargo.toml @@ -38,6 +38,7 @@ nym-wireguard = { path = "../../common/wireguard" } nym-wireguard-types = { path = "../../common/wireguard-types", features = ["verify"] } [dev-dependencies] +hyper.workspace = true dashmap.workspace = true serde_json.workspace = true diff --git a/nym-node/nym-node-http-api/src/router/api/v1/gateway/client_interfaces/wireguard/mod.rs b/nym-node/nym-node-http-api/src/router/api/v1/gateway/client_interfaces/wireguard/mod.rs index 775b1a69b5..d0dfe43670 100644 --- a/nym-node/nym-node-http-api/src/router/api/v1/gateway/client_interfaces/wireguard/mod.rs +++ b/nym-node/nym-node-http-api/src/router/api/v1/gateway/client_interfaces/wireguard/mod.rs @@ -104,6 +104,7 @@ mod test { use crate::api::v1::gateway::client_interfaces::wireguard::{ routes, WireguardAppState, WireguardAppStateInner, }; + use axum::body::to_bytes; use axum::body::Body; use axum::http::Request; use axum::http::StatusCode; @@ -203,7 +204,7 @@ mod test { nonce, gateway_data, wg_port: 8080, - } = serde_json::from_slice(&hyper::body::to_bytes(response.into_body()).await.unwrap()) + } = serde_json::from_slice(&to_bytes(response.into_body(), usize::MAX).await.unwrap()) .unwrap() else { panic!("invalid response") @@ -257,7 +258,7 @@ mod test { assert_eq!(response.status(), StatusCode::OK); let clients: Vec = - serde_json::from_slice(&hyper::body::to_bytes(response.into_body()).await.unwrap()) + serde_json::from_slice(&to_bytes(response.into_body(), usize::MAX).await.unwrap()) .unwrap(); assert!(!clients.is_empty());