From 91c2bbf80468c12d0663330cff185f1d7680c91e Mon Sep 17 00:00:00 2001 From: Bjørn Madsen Date: Wed, 29 Jan 2020 09:32:39 +0100 Subject: Add support for warp --- askama_warp/tests/warp.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 askama_warp/tests/warp.rs (limited to 'askama_warp/tests/warp.rs') diff --git a/askama_warp/tests/warp.rs b/askama_warp/tests/warp.rs new file mode 100644 index 0000000..69a5f23 --- /dev/null +++ b/askama_warp/tests/warp.rs @@ -0,0 +1,18 @@ +use askama::Template; +use warp::Filter; + +#[derive(Template)] +#[template(path = "hello.html")] +struct HelloTemplate<'a> { + name: &'a str, +} + +#[tokio::test] +async fn test_warp() { + let filter = warp::get().map(|| HelloTemplate { name: "world" }); + + let res = warp::test::request().reply(&filter).await; + + assert_eq!(res.status(), 200); + assert_eq!(res.body(), "Hello, world!"); +} -- cgit