use axum::http::StatusCode;
use entropy_kvdb::clean_tests;
use serial_test::serial;
use super::api::UnsafeQuery;
use crate::helpers::tests::{initialize_test_logger, setup_client};
#[tokio::test]
#[serial]
async fn test_unsafe_get_endpoint() {
clean_tests();
initialize_test_logger().await;
setup_client().await;
let client = reqwest::Client::new();
let get_query = UnsafeQuery::new("test".to_string(), vec![10]).to_json();
let put_response = client
.post("http://localhost:3001/unsafe/put")
.header("Content-Type", "application/json")
.body(get_query.clone())
.send()
.await
.unwrap();
assert_eq!(put_response.status(), StatusCode::OK);
let get_response = client
.post("http://localhost:3001/unsafe/get")
.header("Content-Type", "application/json")
.body(get_query)
.send()
.await
.unwrap();
assert_eq!(get_response.status(), StatusCode::OK);
let updated_response_mnemonic = get_response.text().await.unwrap();
assert_eq!(updated_response_mnemonic.as_bytes().to_vec(), vec![10]);
clean_tests();
}