diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3035a499..3ac952d4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -4,7 +4,6 @@ on: push: branches: - master - - origin/ss/test_suite_refactor pull_request: branches: - master diff --git a/tests/query_tests.rs b/tests/query_tests.rs index 466b7b3b..fbe77ba2 100644 --- a/tests/query_tests.rs +++ b/tests/query_tests.rs @@ -6,9 +6,14 @@ pub mod common; pub use common::{bakery_chain::*, setup::*, TestContext}; #[async_std::test] -#[cfg(feature = "sqlx-mysql")] +#[cfg(any( + feature = "sqlx-mysql", + feature = "sqlx-sqlite", + feature = "sqlx-postgres" +))] + pub async fn find_one_with_no_result() { - let ctx = TestContext::new("mysql://root:@localhost", "find_one_with_no_result").await; + let ctx = TestContext::new("find_one_with_no_result").await; let bakery = Bakery::find().one(&ctx.db).await.unwrap(); assert_eq!(bakery, None); @@ -17,9 +22,14 @@ pub async fn find_one_with_no_result() { } #[async_std::test] +#[cfg(any( + feature = "sqlx-mysql", + feature = "sqlx-sqlite", + feature = "sqlx-postgres" +))] #[cfg(feature = "sqlx-mysql")] pub async fn find_one_with_result() { - let ctx = TestContext::new("mysql://root:@localhost", "find_one_with_result").await; + let ctx = TestContext::new("find_one_with_result").await; let bakery = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), @@ -38,9 +48,14 @@ pub async fn find_one_with_result() { } #[async_std::test] +#[cfg(any( + feature = "sqlx-mysql", + feature = "sqlx-sqlite", + feature = "sqlx-postgres" +))] #[cfg(feature = "sqlx-mysql")] pub async fn find_by_id_with_no_result() { - let ctx = TestContext::new("mysql://root:@localhost", "find_by_id_with_no_result").await; + let ctx = TestContext::new("find_by_id_with_no_result").await; let bakery = Bakery::find_by_id(999).one(&ctx.db).await.unwrap(); assert_eq!(bakery, None); @@ -49,9 +64,14 @@ pub async fn find_by_id_with_no_result() { } #[async_std::test] +#[cfg(any( + feature = "sqlx-mysql", + feature = "sqlx-sqlite", + feature = "sqlx-postgres" +))] #[cfg(feature = "sqlx-mysql")] pub async fn find_by_id_with_result() { - let ctx = TestContext::new("mysql://root:@localhost", "find_by_id_with_result").await; + let ctx = TestContext::new("find_by_id_with_result").await; let bakery = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), @@ -74,9 +94,14 @@ pub async fn find_by_id_with_result() { } #[async_std::test] +#[cfg(any( + feature = "sqlx-mysql", + feature = "sqlx-sqlite", + feature = "sqlx-postgres" +))] #[cfg(feature = "sqlx-mysql")] pub async fn find_all_with_no_result() { - let ctx = TestContext::new("mysql://root:@localhost", "find_all_with_no_result").await; + let ctx = TestContext::new("find_all_with_no_result").await; let bakeries = Bakery::find().all(&ctx.db).await.unwrap(); assert_eq!(bakeries.len(), 0); @@ -85,9 +110,14 @@ pub async fn find_all_with_no_result() { } #[async_std::test] +#[cfg(any( + feature = "sqlx-mysql", + feature = "sqlx-sqlite", + feature = "sqlx-postgres" +))] #[cfg(feature = "sqlx-mysql")] pub async fn find_all_with_result() { - let ctx = TestContext::new("mysql://root:@localhost", "find_all_with_result").await; + let ctx = TestContext::new("find_all_with_result").await; let _ = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), @@ -115,9 +145,14 @@ pub async fn find_all_with_result() { } #[async_std::test] +#[cfg(any( + feature = "sqlx-mysql", + feature = "sqlx-sqlite", + feature = "sqlx-postgres" +))] #[cfg(feature = "sqlx-mysql")] pub async fn find_all_filter_no_result() { - let ctx = TestContext::new("mysql://root:@localhost", "find_all_filter_no_result").await; + let ctx = TestContext::new("find_all_filter_no_result").await; let _ = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()), @@ -149,9 +184,14 @@ pub async fn find_all_filter_no_result() { } #[async_std::test] +#[cfg(any( + feature = "sqlx-mysql", + feature = "sqlx-sqlite", + feature = "sqlx-postgres" +))] #[cfg(feature = "sqlx-mysql")] pub async fn find_all_filter_with_results() { - let ctx = TestContext::new("mysql://root:@localhost", "find_all_filter_with_results").await; + let ctx = TestContext::new("find_all_filter_with_results").await; let _ = bakery::ActiveModel { name: Set("SeaSide Bakery".to_owned()),