diff options
Diffstat (limited to 'rust/tests/test_api_server.rs')
-rw-r--r-- | rust/tests/test_api_server.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/rust/tests/test_api_server.rs b/rust/tests/test_api_server.rs index fdabdea2..4c16d4df 100644 --- a/rust/tests/test_api_server.rs +++ b/rust/tests/test_api_server.rs @@ -4,6 +4,8 @@ extern crate iron; extern crate iron_test; use iron::{status, Headers}; +use iron::mime::Mime; +use iron::headers::ContentType; use iron_test::{request, response}; #[test] @@ -51,3 +53,24 @@ fn test_lookups() { let body = response::extract_body_to_string(response); assert!(body.contains("Christine Moran")); } + +#[test] +fn test_post_container() { + let server = fatcat::server().unwrap(); + let router = fatcat_api::router(server); + let mut headers = Headers::new(); + let mime: Mime = "application/json".parse().unwrap(); + headers.set(ContentType(mime)); + + + let response = request::post( + "http://localhost:9411/v0/container", + headers, + r#"{"name": "test journal"}"#, + &router, + ).unwrap(); + assert_eq!(response.status, Some(status::Created)); + let body = response::extract_body_to_string(response); + println!("{}", body); + //assert!(body.contains("test journal")); +} |