aboutsummaryrefslogtreecommitdiffstats
path: root/testing/tests
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2020-01-28 22:17:22 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2020-01-29 09:25:59 +0100
commit75f32d3967e4d13b86b0d720ebc808c6fd9caa05 (patch)
treeb919cd2796220c74b1d6fd69b363c53505681f3a /testing/tests
parentc6f9a053c7328e6c782508114bd96aa569b5de7d (diff)
downloadaskama-75f32d3967e4d13b86b0d720ebc808c6fd9caa05.tar.gz
askama-75f32d3967e4d13b86b0d720ebc808c6fd9caa05.tar.bz2
askama-75f32d3967e4d13b86b0d720ebc808c6fd9caa05.zip
Move Gotham integration into separate askama_gotham crate
Diffstat (limited to 'testing/tests')
-rw-r--r--testing/tests/gotham.rs42
1 files changed, 0 insertions, 42 deletions
diff --git a/testing/tests/gotham.rs b/testing/tests/gotham.rs
deleted file mode 100644
index 225a0ef..0000000
--- a/testing/tests/gotham.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-#![cfg(feature = "with-gotham")]
-
-use askama::Template;
-use gotham::state::State;
-use gotham::test::TestServer;
-use hyper::StatusCode;
-
-#[derive(Template)]
-#[template(path = "hello.html")]
-struct HelloTemplate<'a> {
- name: &'a str,
-}
-
-fn hello(state: State) -> (State, HelloTemplate<'static>) {
- (state, HelloTemplate { name: "world" })
-}
-
-#[test]
-fn test_gotham() {
- let test_server = TestServer::new(|| Ok(hello)).expect("Failed to mount test router");
-
- let res = test_server
- .client()
- .get("http://localhost/")
- .perform()
- .expect("Failed to send request to gotham");
-
- assert_eq!(res.status(), StatusCode::OK);
- {
- let headers = res.headers();
- let content_type = headers
- .get("content-type")
- .expect("Response did not contain content-type header");
- assert_eq!(
- content_type.to_str().unwrap(),
- mime::TEXT_HTML_UTF_8.to_string()
- );
- }
-
- let body = res.read_utf8_body().expect("failed to read response body");
- assert_eq!(&body, "Hello, world!");
-}