diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-24 01:31:44 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-05-24 15:21:32 -0700 |
commit | 63db335123d8dde1c4e701668c07805094ff88e8 (patch) | |
tree | 83f0387b6568d09c525330d414b8e21c21d43e03 /rust/tests/test_api_server.rs | |
parent | eb094c1829d1fc9bb48e687921eeff656b69e2c2 (diff) | |
download | fatcat-63db335123d8dde1c4e701668c07805094ff88e8.tar.gz fatcat-63db335123d8dde1c4e701668c07805094ff88e8.zip |
WIP on API spec improvements
Fixes a bunch of i64/i32/isize stuff
Diffstat (limited to 'rust/tests/test_api_server.rs')
-rw-r--r-- | rust/tests/test_api_server.rs | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/rust/tests/test_api_server.rs b/rust/tests/test_api_server.rs index 6126a0a2..02f88ea4 100644 --- a/rust/tests/test_api_server.rs +++ b/rust/tests/test_api_server.rs @@ -1,15 +1,15 @@ +extern crate diesel; extern crate fatcat; extern crate fatcat_api; extern crate iron; extern crate iron_test; -extern crate diesel; -use fatcat::database_schema::*; -use fatcat::api_helpers::*; use diesel::prelude::*; -use iron::{status, Headers}; -use iron::mime::Mime; +use fatcat::api_helpers::*; +use fatcat::database_schema::*; use iron::headers::ContentType; +use iron::mime::Mime; +use iron::{status, Headers}; use iron_test::{request, response}; #[test] @@ -66,7 +66,6 @@ fn test_post_container() { let mime: Mime = "application/json".parse().unwrap(); headers.set(ContentType(mime)); - let response = request::post( "http://localhost:9411/v0/container", headers, @@ -93,25 +92,33 @@ fn test_accept_editgroup() { let c: i64 = container_ident::table .filter(container_ident::is_live.eq(false)) .count() - .get_result(&conn).unwrap(); + .get_result(&conn) + .unwrap(); assert_eq!(c, 0); let c: i64 = changelog::table .filter(changelog::editgroup_id.eq(editgroup_id)) .count() - .get_result(&conn).unwrap(); + .get_result(&conn) + .unwrap(); assert_eq!(c, 0); let response = request::post( "http://localhost:9411/v0/container", headers.clone(), - &format!("{{\"name\": \"test journal 1\", \"editgroup_id\": {}}}", editgroup_id), + &format!( + "{{\"name\": \"test journal 1\", \"editgroup_id\": {}}}", + editgroup_id + ), &router, ).unwrap(); assert_eq!(response.status, Some(status::Created)); let response = request::post( "http://localhost:9411/v0/container", headers.clone(), - &format!("{{\"name\": \"test journal 2\", \"editgroup_id\": {}}}", editgroup_id), + &format!( + "{{\"name\": \"test journal 2\", \"editgroup_id\": {}}}", + editgroup_id + ), &router, ).unwrap(); assert_eq!(response.status, Some(status::Created)); @@ -119,7 +126,8 @@ fn test_accept_editgroup() { let c: i64 = container_ident::table .filter(container_ident::is_live.eq(false)) .count() - .get_result(&conn).unwrap(); + .get_result(&conn) + .unwrap(); assert_eq!(c, 2); let response = request::post( @@ -133,11 +141,13 @@ fn test_accept_editgroup() { let c: i64 = container_ident::table .filter(container_ident::is_live.eq(false)) .count() - .get_result(&conn).unwrap(); + .get_result(&conn) + .unwrap(); assert_eq!(c, 0); let c: i64 = changelog::table .filter(changelog::editgroup_id.eq(editgroup_id)) .count() - .get_result(&conn).unwrap(); + .get_result(&conn) + .unwrap(); assert_eq!(c, 1); } |