Test refactor
Rust Build / Rustfmt (pull_request) Successful in 26s
Rust Build / Test Suite (pull_request) Successful in 1m0s

This commit is contained in:
2026-06-17 17:19:54 -04:00
parent aff351915c
commit cf051c8aa7
+3 -46
View File
@@ -353,21 +353,7 @@ mod request {
#[tokio::test] #[tokio::test]
async fn test_create_contact() { async fn test_create_contact() {
let tm_pool = db_mgr::get_pool().await.unwrap(); let (tm_pool, db_name, pool) = db_mgr::get_database_ready().await;
let db_name = db_mgr::generate_db_name().await;
match db_mgr::create_database(&tm_pool, &db_name).await {
Ok(_) => {
println!("Success");
}
Err(err) => {
assert!(false, "Error: {:?}", err);
}
}
let pool = db_mgr::connect_to_db(&db_name).await.unwrap();
db::migrations(&pool).await;
let app = init::app(pool).await; let app = init::app(pool).await;
// Send request // Send request
@@ -389,21 +375,7 @@ async fn test_create_contact() {
#[tokio::test] #[tokio::test]
async fn test_get_contact() { async fn test_get_contact() {
let tm_pool = db_mgr::get_pool().await.unwrap(); let (tm_pool, db_name, pool) = db_mgr::get_database_ready().await;
let db_name = db_mgr::generate_db_name().await;
match db_mgr::create_database(&tm_pool, &db_name).await {
Ok(_) => {
println!("Success");
}
Err(err) => {
assert!(false, "Error: {:?}", err);
}
}
let pool = db_mgr::connect_to_db(&db_name).await.unwrap();
db::migrations(&pool).await;
let app = init::app(pool).await; let app = init::app(pool).await;
// Send request // Send request
@@ -444,21 +416,7 @@ async fn test_get_contact() {
#[tokio::test] #[tokio::test]
async fn test_update_contact_names() { async fn test_update_contact_names() {
let tm_pool = db_mgr::get_pool().await.unwrap(); let (tm_pool, db_name, pool) = db_mgr::get_database_ready().await;
let db_name = db_mgr::generate_db_name().await;
match db_mgr::create_database(&tm_pool, &db_name).await {
Ok(_) => {
println!("Success");
}
Err(err) => {
assert!(false, "Error: {:?}", err);
}
}
let pool = db_mgr::connect_to_db(&db_name).await.unwrap();
db::migrations(&pool).await;
let app = init::app(pool).await; let app = init::app(pool).await;
let mut opt_contact: Option<textsender_models::contact::Contact> = None; let mut opt_contact: Option<textsender_models::contact::Contact> = None;
@@ -563,7 +521,6 @@ async fn test_create_message() {
#[tokio::test] #[tokio::test]
async fn test_get_message() { async fn test_get_message() {
let (tm_pool, db_name, pool) = db_mgr::get_database_ready().await; let (tm_pool, db_name, pool) = db_mgr::get_database_ready().await;
let app = init::app(pool).await; let app = init::app(pool).await;
let mut message_result: Option<textsender_models::message::Message> = None; let mut message_result: Option<textsender_models::message::Message> = None;