diff --git a/tests/crud_tests.rs b/tests/crud_tests.rs index 556ebde4..bc2a3c97 100644 --- a/tests/crud_tests.rs +++ b/tests/crud_tests.rs @@ -17,7 +17,7 @@ use sea_orm::DatabaseConnection; ))] async fn main() { let ctx = TestContext::new("bakery_chain_schema_crud_tests").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); create_entities(&ctx.db).await; ctx.delete().await; } diff --git a/tests/parallel_tests.rs b/tests/parallel_tests.rs index 1e4720cd..8eb18dbd 100644 --- a/tests/parallel_tests.rs +++ b/tests/parallel_tests.rs @@ -12,7 +12,7 @@ use sea_orm::{entity::prelude::*, DatabaseConnection, IntoActiveModel, Set}; ))] async fn main() -> Result<(), DbErr> { let ctx = TestContext::new("features_parallel_tests").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await?; crud_in_parallel(&ctx.db).await?; ctx.delete().await; diff --git a/tests/query_tests.rs b/tests/query_tests.rs index 66211696..9d22c7b0 100644 --- a/tests/query_tests.rs +++ b/tests/query_tests.rs @@ -14,7 +14,7 @@ pub use sea_orm::{ConnectionTrait, QueryFilter}; ))] pub async fn find_one_with_no_result() { let ctx = TestContext::new("find_one_with_no_result").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); let bakery = Bakery::find().one(&ctx.db).await.unwrap(); assert_eq!(bakery, None); @@ -30,7 +30,7 @@ pub async fn find_one_with_no_result() { ))] pub async fn find_one_with_result() { let ctx = TestContext::new("find_one_with_result").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); let bakery = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), @@ -56,7 +56,7 @@ pub async fn find_one_with_result() { ))] pub async fn find_by_id_with_no_result() { let ctx = TestContext::new("find_by_id_with_no_result").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); let bakery = Bakery::find_by_id(999).one(&ctx.db).await.unwrap(); assert_eq!(bakery, None); @@ -72,7 +72,7 @@ pub async fn find_by_id_with_no_result() { ))] pub async fn find_by_id_with_result() { let ctx = TestContext::new("find_by_id_with_result").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); let bakery = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), @@ -102,7 +102,7 @@ pub async fn find_by_id_with_result() { ))] pub async fn find_all_with_no_result() { let ctx = TestContext::new("find_all_with_no_result").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); let bakeries = Bakery::find().all(&ctx.db).await.unwrap(); assert_eq!(bakeries.len(), 0); @@ -118,7 +118,7 @@ pub async fn find_all_with_no_result() { ))] pub async fn find_all_with_result() { let ctx = TestContext::new("find_all_with_result").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); let _ = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), @@ -153,7 +153,7 @@ pub async fn find_all_with_result() { ))] pub async fn find_all_filter_no_result() { let ctx = TestContext::new("find_all_filter_no_result").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); let _ = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), @@ -192,7 +192,7 @@ pub async fn find_all_filter_no_result() { ))] pub async fn find_all_filter_with_results() { let ctx = TestContext::new("find_all_filter_with_results").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); let _ = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), diff --git a/tests/relational_tests.rs b/tests/relational_tests.rs index fbbc8278..9778e4c0 100644 --- a/tests/relational_tests.rs +++ b/tests/relational_tests.rs @@ -17,7 +17,7 @@ pub use uuid::Uuid; ))] pub async fn left_join() { let ctx = TestContext::new("test_left_join").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); let bakery = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), @@ -95,7 +95,7 @@ pub async fn left_join() { #[cfg(any(feature = "sqlx-mysql", feature = "sqlx-postgres"))] pub async fn right_join() { let ctx = TestContext::new("test_right_join").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); let bakery = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), @@ -181,7 +181,7 @@ pub async fn right_join() { ))] pub async fn inner_join() { let ctx = TestContext::new("test_inner_join").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); let bakery = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), @@ -271,7 +271,7 @@ pub async fn inner_join() { ))] pub async fn group_by() { let ctx = TestContext::new("test_group_by").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); let bakery = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), @@ -377,7 +377,7 @@ pub async fn group_by() { pub async fn having() { // customers with orders with total equal to $90 let ctx = TestContext::new("test_having").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); let bakery = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), @@ -492,7 +492,7 @@ pub async fn linked() -> Result<(), DbErr> { use sea_orm::{SelectA, SelectB}; let ctx = TestContext::new("test_linked").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await?; // SeaSide Bakery let seaside_bakery = bakery::ActiveModel { diff --git a/tests/sequential_op_tests.rs b/tests/sequential_op_tests.rs index 75bd80fd..30d9b041 100644 --- a/tests/sequential_op_tests.rs +++ b/tests/sequential_op_tests.rs @@ -14,8 +14,8 @@ pub use uuid::Uuid; pub async fn test_multiple_operations() { let ctx = TestContext::new("multiple_sequential_operations").await; - create_tables(&ctx.db).await; - init_setup(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); + seed_data(&ctx.db).await; let baker_least_sales = find_baker_least_sales(&ctx.db).await.unwrap(); assert_eq!(baker_least_sales.name, "Baker 2"); @@ -29,7 +29,7 @@ pub async fn test_multiple_operations() { } #[cfg(any(feature = "sqlx-mysql", feature = "sqlx-postgres"))] -async fn init_setup(db: &DatabaseConnection) { +async fn seed_data(db: &DatabaseConnection) { let bakery = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), profit_margin: Set(10.4), diff --git a/tests/stream_tests.rs b/tests/stream_tests.rs index aebc9081..37e6c21d 100644 --- a/tests/stream_tests.rs +++ b/tests/stream_tests.rs @@ -14,7 +14,7 @@ pub async fn stream() -> Result<(), DbErr> { use futures::StreamExt; let ctx = TestContext::new("stream").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await?; let bakery = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), diff --git a/tests/string_primary_key_tests.rs b/tests/string_primary_key_tests.rs index 63a9069f..c2e8d2db 100644 --- a/tests/string_primary_key_tests.rs +++ b/tests/string_primary_key_tests.rs @@ -12,7 +12,7 @@ use sea_orm::{entity::prelude::*, entity::*, DatabaseConnection}; ))] async fn main() -> Result<(), DbErr> { let ctx = TestContext::new("features_schema_string_primary_key_tests").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await?; create_and_update_repository(&ctx.db).await?; insert_repository(&ctx.db).await?; ctx.delete().await; diff --git a/tests/timestamp_tests.rs b/tests/timestamp_tests.rs index 7c040b7d..f0d6ca77 100644 --- a/tests/timestamp_tests.rs +++ b/tests/timestamp_tests.rs @@ -7,7 +7,7 @@ use sea_orm::{entity::prelude::*, DatabaseConnection, IntoActiveModel}; #[cfg(feature = "sqlx-postgres")] async fn main() -> Result<(), DbErr> { let ctx = TestContext::new("bakery_chain_schema_timestamp_tests").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await?; create_applog(&ctx.db).await?; ctx.delete().await; diff --git a/tests/transaction_tests.rs b/tests/transaction_tests.rs index 38fef19b..6a713e4d 100644 --- a/tests/transaction_tests.rs +++ b/tests/transaction_tests.rs @@ -1,6 +1,6 @@ pub mod common; -pub use common::{features::*, setup::*, TestContext}; +pub use common::{bakery_chain::*, setup::*, TestContext}; pub use sea_orm::entity::*; pub use sea_orm::{ConnectionTrait, QueryFilter}; use sea_orm::{DatabaseTransaction, DbErr}; @@ -13,7 +13,7 @@ use sea_orm::{DatabaseTransaction, DbErr}; ))] pub async fn transaction() { let ctx = TestContext::new("transaction_test").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await.unwrap(); ctx.db .transaction::<_, _, DbErr>(|txn| { @@ -58,6 +58,8 @@ pub async fn transaction() { ))] pub async fn transaction_with_reference() { let ctx = TestContext::new("transaction_with_reference_test").await; + create_tables(&ctx.db).await.unwrap(); + let name1 = "SeaSide Bakery"; let name2 = "Top Bakery"; let search_name = "Bakery"; @@ -111,6 +113,7 @@ fn _transaction_with_reference<'a>( ))] pub async fn transaction_nested() { let ctx = TestContext::new("transaction_nested_test").await; + create_tables(&ctx.db).await.unwrap(); ctx.db .transaction::<_, _, DbErr>(|txn| { diff --git a/tests/uuid_tests.rs b/tests/uuid_tests.rs index bb780e6f..cdda344b 100644 --- a/tests/uuid_tests.rs +++ b/tests/uuid_tests.rs @@ -11,7 +11,7 @@ use sea_orm::{entity::prelude::*, entity::*, DatabaseConnection}; ))] async fn main() -> Result<(), DbErr> { let ctx = TestContext::new("bakery_chain_schema_uuid_tests").await; - create_tables(&ctx.db).await; + create_tables(&ctx.db).await?; create_and_update_metadata(&ctx.db).await?; insert_metadata(&ctx.db).await?; ctx.delete().await;