aboutsummaryrefslogtreecommitdiffstats
path: root/rust/tests/test_api_server.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-23 20:19:41 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-24 15:21:32 -0700
commitaff11938989901327fdf0198d08f97b7105e7b3b (patch)
treedaa370f45ee809fadf56c95d4b08c26c9c181218 /rust/tests/test_api_server.rs
parentcf937ed89c3fe10d891c41612017301a7ff0fbae (diff)
downloadfatcat-aff11938989901327fdf0198d08f97b7105e7b3b.tar.gz
fatcat-aff11938989901327fdf0198d08f97b7105e7b3b.zip
get_or_create_editgroup() helper for POSTs
Diffstat (limited to 'rust/tests/test_api_server.rs')
-rw-r--r--rust/tests/test_api_server.rs23
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"));
+}