Test change
Rust Build / Rustfmt (pull_request) Successful in 36s
Rust Build / Test Suite (pull_request) Successful in 1m58s

This commit is contained in:
2026-06-17 15:28:01 -04:00
parent ebabd77369
commit 22b6478c07
+26 -18
View File
@@ -176,22 +176,11 @@ mod request {
"user_id": super::TEST_USER_ID,
});
/*
let req = axum::http::Request::builder()
.method(axum::http::Method::POST)
.uri(textsender_api::caller::endpoints::ADD_CONTACT)
.header(axum::http::header::CONTENT_TYPE, "application/json")
.header(
axum::http::header::AUTHORIZATION,
super::bearer_auth().await,
)
.body(axum::body::Body::from(payload.to_string()))
.unwrap();
*/
match run_post(
&payload,
Some(&payload),
textsender_api::caller::endpoints::ADD_CONTACT,
axum::http::Method::POST,
true,
)
.await
{
@@ -206,13 +195,22 @@ mod request {
pub async fn get_contact(
app: &axum::Router,
id: &uuid::Uuid,
) -> Result<axum::response::Response, std::convert::Infallible> {
) -> Result<axum::response::Response, axum::http::Error> {
let uri = format!(
"{}?id={}",
textsender_api::caller::endpoints::GET_CONTACT,
id
);
match run_post(None, &uri, axum::http::Method::GET, false).await {
Ok(req) => match app.clone().oneshot(req).await {
Ok(response) => Ok(response),
Err(err) => Err(axum::http::Error::from(err)),
},
Err(err) => Err(err),
}
/*
let req = axum::http::Request::builder()
.method(axum::http::Method::GET)
.uri(uri)
@@ -225,6 +223,7 @@ mod request {
.unwrap();
app.clone().oneshot(req).await
*/
}
pub async fn update_contact_names(
@@ -305,12 +304,21 @@ mod request {
*/
pub async fn run_post(
payload: &serde_json::Value,
payload: Option<&serde_json::Value>,
uri: &str,
method: axum::http::Method,
has_body: bool,
) -> Result<axum::http::Request<axum::body::Body>, axum::http::Error> {
// textsender_api::caller::endpoints::ADD_MESSAGE)
//axum::http::Method::POST)
let body = if has_body {
assert_eq!(
true,
payload.is_some(),
"Has request body and payload has data"
);
axum::body::Body::from(payload.unwrap().to_string())
} else {
axum::body::Body::empty()
};
match axum::http::Request::builder()
.method(method)
.uri(uri)
@@ -319,7 +327,7 @@ mod request {
axum::http::header::AUTHORIZATION,
super::bearer_auth().await,
)
.body(axum::body::Body::from(payload.to_string()))
.body(body)
{
Ok(t) => Ok(t),
Err(err) => Err(err),