[−][src]Function preroll::test_utils::create_client
pub async fn create_client<State, RoutesFn>(
state: State,
setup_routes_fn: RoutesFn
) -> TestResult<Client> where
State: Send + Sync + 'static,
RoutesFn: for<'s> Fn(&'s mut Server<Arc<State>>),
Creates a test application with routes and mocks set up, and hands back a client which is already connected to the server.
Example:
// use preroll::test_utils::{self, TestResult}; #[async_std::test] async fn example_test() -> TestResult<()> { let client = test_utils::create_app().await.unwrap(); // ... (test cases) ... Ok(()) }