aboutsummaryrefslogtreecommitdiffstats
path: root/askama_warp/tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--askama_warp/tests/warp.rs18
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!");
+}