feat(delta): test harness for web server

This commit is contained in:
Paul Makles
2023-08-27 13:01:21 +01:00
parent 73f7b8f007
commit 0542788567
8 changed files with 76 additions and 28 deletions

View File

@@ -1 +1,2 @@
pub mod ratelimiter;
pub mod test;

View File

@@ -0,0 +1,26 @@
use rocket::local::asynchronous::Client;
use std::ops::Deref;
pub struct TestHarness {
client: Client,
}
impl TestHarness {
pub async fn new() -> TestHarness {
dotenv::dotenv().ok();
let client = Client::tracked(crate::web().await)
.await
.expect("valid rocket instance");
TestHarness { client }
}
}
impl Deref for TestHarness {
type Target = Client;
fn deref(&self) -> &Self::Target {
&self.client
}
}