diff --git a/peach-web/src/tests.rs b/peach-web/src/tests.rs index 0dde736..c9c799e 100644 --- a/peach-web/src/tests.rs +++ b/peach-web/src/tests.rs @@ -1,11 +1,12 @@ use std::fs::File; use std::io::Read; +use log::info; +use rocket::serde::json::{Value, json}; use rocket::http::{ContentType, Status}; use rocket::local::blocking::Client; - - +use crate::utils::build_json_response; use super::init_rocket; @@ -422,6 +423,9 @@ fn ping_pong() { // HELPER FUNCTION TESTS +// TODO: fix this test +// it currently fails with +// error[E0609]: no field `message` on type `JsonValue` //#[test] //fn test_build_json_response() { // let status = "success".to_string(); diff --git a/peach-web/src/utils.rs b/peach-web/src/utils.rs index a36963c..9021338 100644 --- a/peach-web/src/utils.rs +++ b/peach-web/src/utils.rs @@ -1,19 +1,10 @@ pub mod monitor; use rocket::serde::json::{Value, json}; -use rocket::serde::{Serialize, Deserialize}; +use rocket::serde::{Serialize}; // HELPER FUNCTIONS -#[derive(Serialize, Deserialize)] -pub struct JsonResponse { - pub status: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub data: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub msg: Option, -} - pub fn build_json_response( status: String, data: Option,