diff options
author | Bjørn Madsen <bm@aeons.dk> | 2020-01-29 09:32:39 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2020-01-29 11:22:47 +0100 |
commit | 91c2bbf80468c12d0663330cff185f1d7680c91e (patch) | |
tree | 9cadabbc819ffeffb5ff02b1605cb5d614425b47 /askama_warp/tests/warp.rs | |
parent | e507c6faf61488cbce23a16eb823816f45130019 (diff) | |
download | askama-91c2bbf80468c12d0663330cff185f1d7680c91e.tar.gz askama-91c2bbf80468c12d0663330cff185f1d7680c91e.tar.bz2 askama-91c2bbf80468c12d0663330cff185f1d7680c91e.zip |
Add support for warp
Diffstat (limited to '')
-rw-r--r-- | askama_warp/tests/warp.rs | 18 |
1 files changed, 18 insertions, 0 deletions
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!"); +} |