aboutsummaryrefslogtreecommitdiffstats
path: root/askama_poem/tests/basic.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2024-01-24 20:23:18 +0000
committerLibravatar cel 🌸 <cel@blos.sm>2024-01-24 20:23:18 +0000
commitd3b048544eebf7b8402fb585b4e2531de9b28a33 (patch)
tree2e697063854d22aff603ba3691c6453ddf5cd87b /askama_poem/tests/basic.rs
parentef53238ae2ee77becc44bcb0b77c1c4daceca5af (diff)
downloadaskama-d3b048544eebf7b8402fb585b4e2531de9b28a33.tar.gz
askama-d3b048544eebf7b8402fb585b4e2531de9b28a33.tar.bz2
askama-d3b048544eebf7b8402fb585b4e2531de9b28a33.zip
Add poem integrationHEADmain
Diffstat (limited to 'askama_poem/tests/basic.rs')
-rw-r--r--askama_poem/tests/basic.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/askama_poem/tests/basic.rs b/askama_poem/tests/basic.rs
new file mode 100644
index 0000000..406c45f
--- /dev/null
+++ b/askama_poem/tests/basic.rs
@@ -0,0 +1,23 @@
+use askama::Template;
+use poem::{handler, test::TestClient, Route};
+
+#[derive(Template)]
+#[template(path = "hello.html")]
+struct HelloTemplate<'a> {
+ name: &'a str,
+}
+
+#[handler]
+fn hello() -> HelloTemplate<'static> {
+ HelloTemplate { name: "world" }
+}
+
+#[tokio::test]
+async fn test_poem() {
+ let app = Route::new().at("/", hello);
+ let cli = TestClient::new(app);
+
+ let resp = cli.get("/").send().await;
+ resp.assert_status_is_ok();
+ resp.assert_text("Hello, world!").await;
+}