This commit is contained in:
2025-04-04 19:02:01 -04:00
parent c9f17b936f
commit 63ecc90bb5

View File

@@ -97,7 +97,7 @@ mod tests {
.expect("Failed to create pool"); .expect("Failed to create pool");
db::migrations(&pool).await; db::migrations(&pool).await;
let mut tx = pool.begin().await.unwrap(); let tx = pool.begin().await.unwrap();
let app = init::routes().await.layer(axum::Extension(pool)); let app = init::routes().await.layer(axum::Extension(pool));
let usr = icarus_auth::models::common::CreateUser { let usr = icarus_auth::models::common::CreateUser {
@@ -105,46 +105,21 @@ mod tests {
password: String::from("Raindown!"), password: String::from("Raindown!"),
}; };
/*
let client = reqwest::Client::new();
let url = icarus_auth::callers::endpoints::REGISTER;
let response = app.oneshot(
println!("Errr")
)
.await.unwrap();
*/
/*
match client.post(url).json(&usr).send().await {
Ok(response) => {}
Err(err) => {
assert!(false, "Error: {:?}", err.to_string());
}
}
*/
let payload = json!({ let payload = json!({
"username": usr.username, "username": usr.username,
"password": usr.password, "password": usr.password,
}); });
assert!(true, "Info: {:?}", payload);
println!("Info: {:?}", payload);
let response = app let response = app
.oneshot( .oneshot(
Request::builder() Request::builder()
.method(axum::http::Method::POST) .method(axum::http::Method::POST)
.uri(callers::endpoints::REGISTER) .uri(callers::endpoints::REGISTER)
.header(axum::http::header::CONTENT_TYPE, "application/json") .header(axum::http::header::CONTENT_TYPE, "application/json")
// .body(Body::new(axum::Json(usr)))
// .body(Body::empty())
.body(Body::from(payload.to_string())) .body(Body::from(payload.to_string()))
// .body(Body::from("{\"username\": \"sssss\",\"theanswer\"}"))
.unwrap(), .unwrap(),
) )
.await; .await;
// .unwrap();
match response { match response {
Ok(resp) => { Ok(resp) => {