From 294e1a867decbb915aa0f5671023cd31e6d581a2 Mon Sep 17 00:00:00 2001 From: David Rousselie Date: Sat, 19 Feb 2022 14:00:07 +0100 Subject: [PATCH] Refactor the integration test suite --- tests/{ => api}/health_check.rs | 3 +-- tests/{test_helper.rs => api/helpers.rs} | 5 ----- tests/api/main.rs | 3 +++ tests/{ => api}/task.rs | 4 +--- 4 files changed, 5 insertions(+), 10 deletions(-) rename tests/{ => api}/health_check.rs (87%) rename tests/{test_helper.rs => api/helpers.rs} (90%) create mode 100644 tests/api/main.rs rename tests/{ => api}/task.rs (98%) diff --git a/tests/health_check.rs b/tests/api/health_check.rs similarity index 87% rename from tests/health_check.rs rename to tests/api/health_check.rs index 267a852..84839a7 100644 --- a/tests/health_check.rs +++ b/tests/api/health_check.rs @@ -1,6 +1,5 @@ -pub mod test_helper; +use crate::helpers::app_address; use rstest::*; -use test_helper::app_address; #[rstest] #[tokio::test] diff --git a/tests/test_helper.rs b/tests/api/helpers.rs similarity index 90% rename from tests/test_helper.rs rename to tests/api/helpers.rs index a417a99..61594b3 100644 --- a/tests/test_helper.rs +++ b/tests/api/helpers.rs @@ -2,7 +2,6 @@ use contextswitch_api::contextswitch::taskwarrior; use contextswitch_api::observability::{get_subscriber, init_subscriber}; use mktemp::Temp; use rstest::*; -use std::fs; use std::net::TcpListener; use tracing::info; @@ -31,10 +30,6 @@ fn setup_taskwarrior() -> String { task_data_location } -pub fn clear_tasks(task_data_location: String) { - fs::remove_dir_all(task_data_location).unwrap(); -} - #[fixture] #[once] pub fn app_address() -> String { diff --git a/tests/api/main.rs b/tests/api/main.rs new file mode 100644 index 0000000..7de4230 --- /dev/null +++ b/tests/api/main.rs @@ -0,0 +1,3 @@ +mod health_check; +mod helpers; +mod task; diff --git a/tests/task.rs b/tests/api/task.rs similarity index 98% rename from tests/task.rs rename to tests/api/task.rs index 5dcd6c6..20c26b5 100644 --- a/tests/task.rs +++ b/tests/api/task.rs @@ -1,10 +1,8 @@ -pub mod test_helper; - +use crate::helpers::app_address; use contextswitch_api::contextswitch; use contextswitch_types::{Bookmark, ContextswitchData, NewTask, Task, TaskId}; use http::uri::Uri; use rstest::*; -use test_helper::app_address; use uuid::Uuid; #[rstest]