From e66c78d6eaeb01b64911013b3a36d798c561acb8 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 28 Aug 2023 12:32:57 +0200 Subject: integration test: move json_body to root of crate --- src/garage/tests/k2v/batch.rs | 2 +- src/garage/tests/k2v/item.rs | 2 +- src/garage/tests/k2v/mod.rs | 13 ------------- src/garage/tests/k2v/poll.rs | 2 +- 4 files changed, 3 insertions(+), 16 deletions(-) (limited to 'src/garage/tests/k2v') diff --git a/src/garage/tests/k2v/batch.rs b/src/garage/tests/k2v/batch.rs index 595d0ba8..71de91bf 100644 --- a/src/garage/tests/k2v/batch.rs +++ b/src/garage/tests/k2v/batch.rs @@ -6,7 +6,7 @@ use assert_json_diff::assert_json_eq; use base64::prelude::*; use serde_json::json; -use super::json_body; +use crate::json_body; use hyper::{Method, StatusCode}; #[tokio::test] diff --git a/src/garage/tests/k2v/item.rs b/src/garage/tests/k2v/item.rs index 588836c7..25d9cce4 100644 --- a/src/garage/tests/k2v/item.rs +++ b/src/garage/tests/k2v/item.rs @@ -6,7 +6,7 @@ use assert_json_diff::assert_json_eq; use base64::prelude::*; use serde_json::json; -use super::json_body; +use crate::json_body; use hyper::{Method, StatusCode}; #[tokio::test] diff --git a/src/garage/tests/k2v/mod.rs b/src/garage/tests/k2v/mod.rs index a009460e..241e3dc2 100644 --- a/src/garage/tests/k2v/mod.rs +++ b/src/garage/tests/k2v/mod.rs @@ -3,16 +3,3 @@ pub mod errorcodes; pub mod item; pub mod poll; pub mod simple; - -use hyper::{Body, Response}; - -pub async fn json_body(res: Response) -> serde_json::Value { - let res_body: serde_json::Value = serde_json::from_slice( - &hyper::body::to_bytes(res.into_body()) - .await - .unwrap() - .to_vec()[..], - ) - .unwrap(); - res_body -} diff --git a/src/garage/tests/k2v/poll.rs b/src/garage/tests/k2v/poll.rs index dd44aed9..452317c2 100644 --- a/src/garage/tests/k2v/poll.rs +++ b/src/garage/tests/k2v/poll.rs @@ -5,8 +5,8 @@ use std::time::Duration; use assert_json_diff::assert_json_eq; use serde_json::json; -use super::json_body; use crate::common; +use crate::json_body; #[tokio::test] async fn test_poll_item() { -- cgit v1.2.3