2018-01-19 14:06:01 +03:00
|
|
|
extern crate iron;
|
|
|
|
extern crate iron_test;
|
|
|
|
extern crate martin_lib;
|
|
|
|
|
|
|
|
use std::env;
|
|
|
|
use iron::Headers;
|
|
|
|
use iron_test::{request, response};
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_index() {
|
2018-02-12 13:28:54 +03:00
|
|
|
let conn_string: String = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
|
|
|
let chain = martin_lib::chain(conn_string, 10, 0);
|
2018-01-19 14:06:01 +03:00
|
|
|
|
|
|
|
let headers = Headers::new();
|
|
|
|
let response = request::get("http://localhost:3000/index.json", headers, &chain).unwrap();
|
|
|
|
|
|
|
|
let result_body = response::extract_body_to_bytes(response);
|
2018-02-12 13:28:54 +03:00
|
|
|
assert!(result_body.len() > 0);
|
|
|
|
}
|