Test refactor
This commit is contained in:
+3
-46
@@ -353,21 +353,7 @@ mod request {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_create_contact() {
|
||||
let tm_pool = db_mgr::get_pool().await.unwrap();
|
||||
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 (tm_pool, db_name, pool) = db_mgr::get_database_ready().await;
|
||||
let app = init::app(pool).await;
|
||||
|
||||
// Send request
|
||||
@@ -389,21 +375,7 @@ async fn test_create_contact() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_get_contact() {
|
||||
let tm_pool = db_mgr::get_pool().await.unwrap();
|
||||
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 (tm_pool, db_name, pool) = db_mgr::get_database_ready().await;
|
||||
let app = init::app(pool).await;
|
||||
|
||||
// Send request
|
||||
@@ -444,21 +416,7 @@ async fn test_get_contact() {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_update_contact_names() {
|
||||
let tm_pool = db_mgr::get_pool().await.unwrap();
|
||||
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 (tm_pool, db_name, pool) = db_mgr::get_database_ready().await;
|
||||
let app = init::app(pool).await;
|
||||
|
||||
let mut opt_contact: Option<textsender_models::contact::Contact> = None;
|
||||
@@ -563,7 +521,6 @@ async fn test_create_message() {
|
||||
#[tokio::test]
|
||||
async fn test_get_message() {
|
||||
let (tm_pool, db_name, pool) = db_mgr::get_database_ready().await;
|
||||
|
||||
let app = init::app(pool).await;
|
||||
let mut message_result: Option<textsender_models::message::Message> = None;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user