diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-07-20 20:00:39 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-07-20 20:00:39 -0700 |
commit | 634720bbd2a967a4b2a60c215a63070eabd4db06 (patch) | |
tree | 4e2a86dde2869810ffff27eb7905e80dc7f05595 /rust/tests | |
parent | 313f6926a6608e9740924e3ff4fe6dfea2016397 (diff) | |
download | fatcat-634720bbd2a967a4b2a60c215a63070eabd4db06.tar.gz fatcat-634720bbd2a967a4b2a60c215a63070eabd4db06.zip |
editor_id and editgroup_id as idents; revisions as raw UUID
Diffstat (limited to 'rust/tests')
-rw-r--r-- | rust/tests/test_api_server.rs | 23 | ||||
-rw-r--r-- | rust/tests/test_fcid.rs | 6 |
2 files changed, 20 insertions, 9 deletions
diff --git a/rust/tests/test_api_server.rs b/rust/tests/test_api_server.rs index e7ac9585..056c6a0e 100644 --- a/rust/tests/test_api_server.rs +++ b/rust/tests/test_api_server.rs @@ -3,6 +3,7 @@ extern crate fatcat; extern crate fatcat_api; extern crate iron; extern crate iron_test; +extern crate uuid; use diesel::prelude::*; use fatcat::api_helpers::*; @@ -11,6 +12,7 @@ use iron::headers::ContentType; use iron::mime::Mime; use iron::{status, Headers}; use iron_test::{request, response}; +use uuid::Uuid; fn setup() -> ( Headers, @@ -416,7 +418,8 @@ fn test_post_work() { fn test_accept_editgroup() { let (headers, router, conn) = setup(); - let editgroup_id = get_or_create_editgroup(1, &conn).unwrap(); + let editor_id = Uuid::parse_str("00000000-0000-0000-AAAA-000000000001").unwrap(); + let editgroup_id = get_or_create_editgroup(editor_id, &conn).unwrap(); let c: i64 = container_ident::table .filter(container_ident::is_live.eq(false)) @@ -436,8 +439,8 @@ fn test_accept_editgroup() { "http://localhost:9411/v0/container", headers.clone(), &format!( - "{{\"name\": \"test journal 1\", \"editgroup_id\": {}}}", - editgroup_id + "{{\"name\": \"test journal 1\", \"editgroup_id\": \"{}\"}}", + uuid2fcid(&editgroup_id) ), &router, ), @@ -449,8 +452,8 @@ fn test_accept_editgroup() { "http://localhost:9411/v0/container", headers.clone(), &format!( - "{{\"name\": \"test journal 2\", \"editgroup_id\": {}}}", - editgroup_id + "{{\"name\": \"test journal 2\", \"editgroup_id\": \"{}\"}}", + uuid2fcid(&editgroup_id) ), &router, ), @@ -467,7 +470,10 @@ fn test_accept_editgroup() { check_response( request::get( - &format!("http://localhost:9411/v0/editgroup/{}", editgroup_id), + &format!( + "http://localhost:9411/v0/editgroup/{}", + uuid2fcid(&editgroup_id) + ), headers.clone(), &router, ), @@ -477,7 +483,10 @@ fn test_accept_editgroup() { check_response( request::post( - &format!("http://localhost:9411/v0/editgroup/{}/accept", editgroup_id), + &format!( + "http://localhost:9411/v0/editgroup/{}/accept", + uuid2fcid(&editgroup_id) + ), headers.clone(), "", &router, diff --git a/rust/tests/test_fcid.rs b/rust/tests/test_fcid.rs index befca435..4feaef5d 100644 --- a/rust/tests/test_fcid.rs +++ b/rust/tests/test_fcid.rs @@ -14,8 +14,10 @@ fn test_fcid_conversions() { assert_eq!(test_uuid, fcid2uuid(&test_fcid.to_uppercase()).unwrap()); assert_eq!(test_uuid, fcid2uuid(&uuid2fcid(&test_uuid)).unwrap()); - assert_eq!(Uuid::parse_str("10842108-4210-8421-0842-108421084210").unwrap(), - fcid2uuid("ccccccccccccccccccccccccca").unwrap()); + assert_eq!( + Uuid::parse_str("10842108-4210-8421-0842-108421084210").unwrap(), + fcid2uuid("ccccccccccccccccccccccccca").unwrap() + ); assert_eq!(false, fcid2uuid("asdf").is_ok()); assert_eq!(false, fcid2uuid("q3nouwy3nnbsvo3h5klx").is_ok()); |