diff --git a/crates/backend/tests/common/test_helpers.rs b/crates/backend/tests/common/test_helpers.rs index c61eef6..a1e5458 100644 --- a/crates/backend/tests/common/test_helpers.rs +++ b/crates/backend/tests/common/test_helpers.rs @@ -1,7 +1,5 @@ use backend::Database; use lazy_static::lazy_static; -use sea_orm::{DatabaseTransaction, TransactionTrait}; -use std::future::Future; use testcontainers::ContainerAsync; use testcontainers_modules::{postgres::Postgres, redis::Redis}; @@ -31,17 +29,3 @@ pub async fn get_database() -> &'static Database { &state.database } - -pub async fn with_transaction(test: F) -> R -where - F: FnOnce(DatabaseTransaction) -> Fut, - Fut: Future, -{ - let db = get_database().await; - let tx = db - .connection() - .begin() - .await - .expect("Failed to start transaction"); - test(tx).await -} diff --git a/crates/backend/tests/endpoints/auth.rs b/crates/backend/tests/endpoints/auth.rs index 1d72664..932c848 100644 --- a/crates/backend/tests/endpoints/auth.rs +++ b/crates/backend/tests/endpoints/auth.rs @@ -2,7 +2,7 @@ use actix_web::{App, http::header, test, web}; use backend::controller; use serde::{Deserialize, Serialize}; -use crate::common::test_helpers::{get_database, with_transaction}; +use crate::common::test_helpers::get_database; #[cfg(test)] mod tests { diff --git a/crates/backend/tests/integration_tests.rs b/crates/backend/tests/integration_tests.rs index e3431fe..8d7d0f3 100644 --- a/crates/backend/tests/integration_tests.rs +++ b/crates/backend/tests/integration_tests.rs @@ -6,10 +6,10 @@ mod tests { use actix_web::{App, test, web}; use backend::controller; - use crate::common::test_helpers::{get_database, with_transaction}; + use crate::common::test_helpers::get_database; #[actix_web::test] - async fn test_auth_with_transaction() { + async fn test_ok() { let db = get_database().await; let app = test::init_service(