aboutsummaryrefslogblamecommitdiffstats
path: root/askama_warp/tests/warp.rs
blob: 69a5f234451d2b2504172a396163d9c9711c315d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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!");
}