Function trillium_testing::with_server[][src]

pub fn with_server<H, Fun, Fut>(handler: H, tests: Fun) where
    H: Handler,
    Fun: FnOnce(Url) -> Fut,
    Fut: Future<Output = Result<(), Box<dyn Error>>>, 
Expand description

Starts a trillium handler bound to a random available port on localhost, run the async tests provided as the second argument, and then shut down the server. useful for full integration tests that actually exercise the tcp layer.

See trillium_client::Conn for usage examples.

stability note: this doesn’t really feel like it fits in the testing crate, as it would not work well with a tokio-specific handler. it may go away entirely at some point, or be moved to the trillium_smol crate