From 85acc6a3095274cc75d6cde8b598a349bc4b9baf Mon Sep 17 00:00:00 2001 From: shockrah Date: Wed, 12 Aug 2020 19:48:42 -0700 Subject: [PATCH] Helper functions for other tests There are kinda random and really just push away seams from the UT's themselves --- server/src/testing/mod.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 server/src/testing/mod.rs diff --git a/server/src/testing/mod.rs b/server/src/testing/mod.rs new file mode 100644 index 0000000..8a751b8 --- /dev/null +++ b/server/src/testing/mod.rs @@ -0,0 +1,19 @@ +// Functions which are only really useful for the unit tests but which show up +// constantly in the tests themselves + +#[cfg(test)] +pub fn get_pool() -> mysql_async::Pool { + use dotenv::dotenv; + use mysql_async::Pool; + + dotenv().ok(); + return Pool::new(&std::env::var("DATABASE_URL").unwrap()) +} + +#[cfg(test)] +pub fn hyper_resp() -> hyper::Response { + use hyper::{Response, Body}; + + Response::new(Body::empty()) +} +