Helper functions for other tests

There are kinda random and really just push away seams from the UT's themselves
This commit is contained in:
shockrah 2020-08-12 19:48:42 -07:00
parent 14f91e2240
commit 85acc6a309

19
server/src/testing/mod.rs Normal file
View File

@ -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<hyper::Body> {
use hyper::{Response, Body};
Response::new(Body::empty())
}