aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2020-01-28 22:49:04 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2020-01-29 09:25:59 +0100
commitff24eef1ff7dcf3849fd1e6d9efec0de2bc57005 (patch)
treedb3a606f7cf88b6a932484c799a441cab9dd7996 /testing
parent75f32d3967e4d13b86b0d720ebc808c6fd9caa05 (diff)
downloadaskama-ff24eef1ff7dcf3849fd1e6d9efec0de2bc57005.tar.gz
askama-ff24eef1ff7dcf3849fd1e6d9efec0de2bc57005.tar.bz2
askama-ff24eef1ff7dcf3849fd1e6d9efec0de2bc57005.zip
Move Iron integration into a separate askama_iron crate
Diffstat (limited to 'testing')
-rw-r--r--testing/Cargo.toml6
-rw-r--r--testing/templates/hello.txt1
-rw-r--r--testing/tests/iron.rs37
3 files changed, 1 insertions, 43 deletions
diff --git a/testing/Cargo.toml b/testing/Cargo.toml
index 5517047..ff2b137 100644
--- a/testing/Cargo.toml
+++ b/testing/Cargo.toml
@@ -6,14 +6,10 @@ workspace = ".."
edition = "2018"
[features]
-default = []
-full = ["with-iron", "serde-json"]
-serde-json = ["serde_json", "askama/serde-json"]
-with-iron = ["iron", "askama/with-iron"]
+default = ["serde_json", "askama/serde-json"]
[dependencies]
askama = { path = "../askama", version = "*" }
-iron = { version = "0.6", optional = true }
serde_json = { version = "1.0", optional = true }
[dev-dependencies]
diff --git a/testing/templates/hello.txt b/testing/templates/hello.txt
deleted file mode 100644
index 8149be7..0000000
--- a/testing/templates/hello.txt
+++ /dev/null
@@ -1 +0,0 @@
-Hello, {{ name }}!
diff --git a/testing/tests/iron.rs b/testing/tests/iron.rs
deleted file mode 100644
index f58a609..0000000
--- a/testing/tests/iron.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-#![cfg(feature = "iron")]
-use askama::Template;
-use iron::{status, Response};
-
-#[derive(Template)]
-#[template(path = "hello.html")]
-struct HelloTemplate<'a> {
- name: &'a str,
-}
-
-#[derive(Template)]
-#[template(path = "hello.txt")]
-struct HelloTextTemplate<'a> {
- name: &'a str,
-}
-
-#[test]
-fn test_iron() {
- let rsp = Response::with((status::Ok, HelloTemplate { name: "world" }));
- let mut buf = Vec::new();
- let _ = rsp.body.unwrap().write_body(&mut buf);
- assert_eq!(buf, b"Hello, world!");
-
- let content_type = rsp.headers.get::<iron::headers::ContentType>().unwrap();
- assert_eq!(format!("{}", content_type), "text/html; charset=utf-8");
-}
-
-#[test]
-fn test_iron_non_html() {
- let rsp = Response::with((status::Ok, HelloTextTemplate { name: "world" }));
- let mut buf = Vec::new();
- let _ = rsp.body.unwrap().write_body(&mut buf);
- assert_eq!(buf, b"Hello, world!");
-
- let content_type = rsp.headers.get::<iron::headers::ContentType>();
- assert_eq!(content_type, None);
-}