well **** me now its fixed

This commit is contained in:
Mika 2025-06-17 13:11:07 +02:00
parent 6e66e89a2e
commit 1472572e3d

View file

@ -10,32 +10,29 @@ mod tests {
#[actix_web::test] #[actix_web::test]
async fn test_auth_with_transaction() { async fn test_auth_with_transaction() {
with_transaction(|_tx| async { let db = get_database().await;
let db = get_database().await;
let app = test::init_service( let app = test::init_service(
App::new() App::new()
.app_data(web::Data::new(db.clone())) .app_data(web::Data::new(db.clone()))
.service(web::scope("/api/v1").configure(controller::register_controllers)), .service(web::scope("/api/v1").configure(controller::register_controllers)),
) )
.await;
let resp = test::TestRequest::get()
.uri("/api/v1/ok")
.send_request(&app)
.await; .await;
let resp = test::TestRequest::get() let resp_status = resp.status();
.uri("/api/v1/ok")
.send_request(&app)
.await;
let resp_status = resp.status(); let resp_body = test::read_body(resp).await;
let resp_body_str = String::from_utf8_lossy(&resp_body);
assert!(
resp_body_str.contains("available"),
"Expected 'available' in response body"
);
let resp_body = test::read_body(resp).await; assert!(resp_status.is_success(), "Expected success response");
let resp_body_str = String::from_utf8_lossy(&resp_body);
assert!(
resp_body_str.contains("available"),
"Expected 'available' in response body"
);
assert!(resp_status.is_success(), "Expected success response");
})
.await;
} }
} }