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()) +} +