Test changes
Rust Build / Test Suite (pull_request) Failing after 48s
Rust Build / Rustfmt (pull_request) Successful in 49s
Rust Build / Clippy (pull_request) Successful in 1m32s
Rust Build / Check (pull_request) Successful in 2m36s
Rust Build / build (pull_request) Successful in 2m17s
Rust Build / Test Suite (pull_request) Failing after 48s
Rust Build / Rustfmt (pull_request) Successful in 49s
Rust Build / Clippy (pull_request) Successful in 1m32s
Rust Build / Check (pull_request) Successful in 2m36s
Rust Build / build (pull_request) Successful in 2m17s
This commit is contained in:
+37
-1
@@ -157,7 +157,43 @@ pub async fn bearer_auth() -> String {
|
|||||||
format!("Bearer {token}")
|
format!("Bearer {token}")
|
||||||
}
|
}
|
||||||
|
|
||||||
mod request {}
|
mod request {
|
||||||
|
// use common_multipart_rfc7578::client::multipart::{
|
||||||
|
// Body as MultipartBody, Form as MultipartForm,
|
||||||
|
// };
|
||||||
|
use tower::ServiceExt;
|
||||||
|
|
||||||
|
pub async fn create_contact(
|
||||||
|
app: &axum::Router,
|
||||||
|
) -> Result<axum::response::Response, std::convert::Infallible> {
|
||||||
|
let payload = serde_json::json!({
|
||||||
|
"phone_number": super::TEST_CONTACT_PHONE_NUMBER,
|
||||||
|
"user_id": super::TEST_USER_ID,
|
||||||
|
});
|
||||||
|
// Create multipart form
|
||||||
|
// let mut form = MultipartForm::default();
|
||||||
|
// let _ = form.add_file("flac", "tests/I/track01.flac");
|
||||||
|
|
||||||
|
// Create request
|
||||||
|
// let content_type = form.content_type();
|
||||||
|
// let body = MultipartBody::from(form);
|
||||||
|
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()))
|
||||||
|
// .body(axum::body::Body::from_stream(body))
|
||||||
|
.unwrap();
|
||||||
|
app.clone().oneshot(req).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test contact phone number
|
||||||
|
pub const TEST_CONTACT_PHONE_NUMBER: &str = "+10123456789";
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_create_contact() {
|
async fn test_create_contact() {
|
||||||
|
|||||||
Reference in New Issue
Block a user