aboutsummaryrefslogtreecommitdiffstats
path: root/rust/tests
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-09 18:30:48 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-09 18:30:48 -0800
commit7632129c594b9edbae8ee9ba5da6ae35d1af2429 (patch)
treedb1c56b35aa4c81ec1c925d527b80caa30f9c06f /rust/tests
parent8317f6cb38622e36dad6bd4ad34e3cf6dac3bdad (diff)
downloadfatcat-7632129c594b9edbae8ee9ba5da6ae35d1af2429.tar.gz
fatcat-7632129c594b9edbae8ee9ba5da6ae35d1af2429.zip
refactor: FatCatId -> FatcatId
Diffstat (limited to 'rust/tests')
-rw-r--r--rust/tests/helpers.rs9
-rw-r--r--rust/tests/test_api_server_http.rs214
-rw-r--r--rust/tests/test_auth.rs6
-rw-r--r--rust/tests/test_fcid.rs16
4 files changed, 158 insertions, 87 deletions
diff --git a/rust/tests/helpers.rs b/rust/tests/helpers.rs
index 01891eaf..2410aa32 100644
--- a/rust/tests/helpers.rs
+++ b/rust/tests/helpers.rs
@@ -1,5 +1,5 @@
use fatcat::auth::MacaroonAuthMiddleware;
-use fatcat::identifiers::FatCatId;
+use fatcat::identifiers::FatcatId;
use fatcat::server;
use fatcat_api_spec::client::Client;
use fatcat_api_spec::Context;
@@ -9,9 +9,8 @@ use iron::{status, Chain, Headers, Iron, Listening};
use iron_test::response;
use std::str::FromStr;
-
pub static TEST_ADMIN_EDITOR_ID: &str = "aaaaaaaaaaaabkvkaaaaaaaaae";
-//static TEST_ADMIN_EDITOR_ID: FatCatId = FatCatId::from_str("aaaaaaaaaaaabkvkaaaaaaaaae").unwrap();
+//static TEST_ADMIN_EDITOR_ID: FatcatId = FatcatId::from_str("aaaaaaaaaaaabkvkaaaaaaaaae").unwrap();
// A current problem with this method is that if the test fails (eg, panics, assert fails), the
// server never gets closed, and the server thread hangs forever.
@@ -22,7 +21,7 @@ pub fn setup_client() -> (Client, Context, Listening) {
let server = server::create_test_server().unwrap();
// setup auth as admin user
- let admin_id = FatCatId::from_str(TEST_ADMIN_EDITOR_ID).unwrap();
+ let admin_id = FatcatId::from_str(TEST_ADMIN_EDITOR_ID).unwrap();
let token = server
.auth_confectionary
.create_token(admin_id, None)
@@ -59,7 +58,7 @@ pub fn setup_http() -> (
let conn = server.db_pool.get().expect("db_pool error");
// setup auth as admin user
- let admin_id = FatCatId::from_str(TEST_ADMIN_EDITOR_ID).unwrap();
+ let admin_id = FatcatId::from_str(TEST_ADMIN_EDITOR_ID).unwrap();
let token = server
.auth_confectionary
.create_token(admin_id, None)
diff --git a/rust/tests/test_api_server_http.rs b/rust/tests/test_api_server_http.rs
index 4773a44e..17ba6615 100644
--- a/rust/tests/test_api_server_http.rs
+++ b/rust/tests/test_api_server_http.rs
@@ -485,12 +485,15 @@ fn test_reverse_lookups() {
#[test]
fn test_post_container() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/container?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/container?editgroup_id={}",
+ editgroup_id
+ ),
headers,
r#"{"name": "test journal"}"#,
&router,
@@ -519,12 +522,15 @@ fn test_post_batch_container() {
#[test]
fn test_post_creator() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
helpers::check_http_response(
request::post(
- &format!( "http://localhost:9411/v0/creator?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/creator?editgroup_id={}",
+ editgroup_id
+ ),
headers,
r#"{"display_name": "some person"}"#,
&router,
@@ -537,8 +543,8 @@ fn test_post_creator() {
#[test]
fn test_post_file() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
helpers::check_http_response(
request::post(
@@ -607,8 +613,8 @@ fn test_post_file() {
#[test]
fn test_post_fileset() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
helpers::check_http_response(
request::post(
@@ -667,8 +673,8 @@ fn test_post_fileset() {
#[test]
fn test_post_webcapture() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
helpers::check_http_response(
request::post(
@@ -737,8 +743,8 @@ fn test_post_webcapture() {
#[test]
fn test_post_release() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
helpers::check_http_response(
request::post(
@@ -840,12 +846,15 @@ fn test_post_release() {
#[test]
fn test_post_work() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
helpers::check_http_response(
request::post(
- &format!( "http://localhost:9411/v0/work?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/work?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
// TODO: target_work_id
r#"{
@@ -861,12 +870,15 @@ fn test_post_work() {
#[test]
fn test_update_work() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/work?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/work?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{
"extra": { "source": "other speculation" }
@@ -879,10 +891,7 @@ fn test_update_work() {
helpers::check_http_response(
request::post(
- &format!(
- "http://localhost:9411/v0/editgroup/{}/accept",
- editgroup_id
- ),
+ &format!("http://localhost:9411/v0/editgroup/{}/accept", editgroup_id),
headers.clone(),
"",
&router,
@@ -895,12 +904,15 @@ fn test_update_work() {
#[test]
fn test_delete_work() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
helpers::check_http_response(
request::delete(
- &format!("http://localhost:9411/v0/work/aaaaaaaaaaaaavkvaaaaaaaaai?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/work/aaaaaaaaaaaaavkvaaaaaaaaai?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
&router,
),
@@ -923,8 +935,8 @@ fn test_delete_work() {
#[test]
fn test_accept_editgroup() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
let c: i64 = container_ident::table
.filter(container_ident::is_live.eq(false))
@@ -941,7 +953,10 @@ fn test_accept_editgroup() {
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/container?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/container?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
&format!(
"{{\"name\": \"test journal 1\", \"editgroup_id\": \"{}\"}}",
@@ -954,7 +969,10 @@ fn test_accept_editgroup() {
);
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/container?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/container?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
&format!(
"{{\"name\": \"test journal 2\", \"editgroup_id\": \"{}\"}}",
@@ -975,10 +993,7 @@ fn test_accept_editgroup() {
helpers::check_http_response(
request::get(
- &format!(
- "http://localhost:9411/v0/editgroup/{}",
- editgroup_id
- ),
+ &format!("http://localhost:9411/v0/editgroup/{}", editgroup_id),
headers.clone(),
&router,
),
@@ -988,10 +1003,7 @@ fn test_accept_editgroup() {
helpers::check_http_response(
request::post(
- &format!(
- "http://localhost:9411/v0/editgroup/{}/accept",
- editgroup_id
- ),
+ &format!("http://localhost:9411/v0/editgroup/{}/accept", editgroup_id),
headers.clone(),
"",
&router,
@@ -1042,12 +1054,15 @@ fn test_changelog() {
#[test]
fn test_400() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers,
r#"{"title": "secret paper",
"release_type": "article-journal",
@@ -1118,13 +1133,16 @@ fn test_edit_gets() {
#[test]
fn test_bad_external_idents() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
// Bad wikidata QID
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret paper",
"wikidata_qid": "P12345"
@@ -1136,7 +1154,10 @@ fn test_bad_external_idents() {
);
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"name": "my journal",
"wikidata_qid": "P12345"
@@ -1148,7 +1169,10 @@ fn test_bad_external_idents() {
);
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"display_name": "some body",
"wikidata_qid": "P12345"
@@ -1162,7 +1186,10 @@ fn test_bad_external_idents() {
// Bad PMCID
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret paper",
"pmcid": "12345"
@@ -1176,7 +1203,10 @@ fn test_bad_external_idents() {
// Bad PMID
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret paper",
"pmid": "not-a-number"
@@ -1190,7 +1220,10 @@ fn test_bad_external_idents() {
// Bad DOI
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret paper",
"doi": "asdf"
@@ -1204,7 +1237,10 @@ fn test_bad_external_idents() {
// Good identifiers
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret paper",
"doi": "10.1234/abcde.781231231239",
@@ -1222,12 +1258,15 @@ fn test_bad_external_idents() {
#[test]
fn test_abstracts() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "some paper",
"doi": "10.1234/iiiiiii",
@@ -1317,8 +1356,8 @@ fn test_abstracts() {
#[test]
fn test_contribs() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
helpers::check_http_response(
request::post(
@@ -1404,13 +1443,16 @@ fn test_post_batch_autoaccept() {
#[test]
fn test_release_dates() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
// Ok
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret minimal paper",
"release_type": "article-journal",
@@ -1425,7 +1467,10 @@ fn test_release_dates() {
// Ok
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret minimal paper",
"release_type": "article-journal",
@@ -1440,7 +1485,10 @@ fn test_release_dates() {
// Ok; ISO 8601
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret minimal paper",
"release_type": "article-journal",
@@ -1453,7 +1501,10 @@ fn test_release_dates() {
);
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret minimal paper",
"release_type": "article-journal",
@@ -1468,7 +1519,10 @@ fn test_release_dates() {
// Ok
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret minimal paper",
"release_type": "article-journal",
@@ -1484,7 +1538,10 @@ fn test_release_dates() {
// Ok for now, but may be excluded later
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret minimal paper",
"release_type": "article-journal",
@@ -1500,7 +1557,10 @@ fn test_release_dates() {
// Bad: year/month only
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret minimal paper",
"release_type": "article-journal",
@@ -1515,7 +1575,10 @@ fn test_release_dates() {
// Bad: full timestamp
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret minimal paper",
"release_type": "article-journal",
@@ -1530,7 +1593,10 @@ fn test_release_dates() {
// Bad: bogus month/day
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret minimal paper",
"release_type": "article-journal",
@@ -1546,13 +1612,16 @@ fn test_release_dates() {
#[test]
fn test_release_types() {
let (headers, router, conn) = helpers::setup_http();
- let editor_id = FatCatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
- let editgroup_id = FatCatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
+ let editor_id = FatcatId::from_str(helpers::TEST_ADMIN_EDITOR_ID).unwrap();
+ let editgroup_id = FatcatId::from_uuid(&create_editgroup(&conn, editor_id.to_uuid()).unwrap());
// Ok
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret minimal paper",
"release_type": "article-journal"
@@ -1566,7 +1635,10 @@ fn test_release_types() {
// Bad
helpers::check_http_response(
request::post(
- &format!("http://localhost:9411/v0/release?editgroup_id={}", editgroup_id),
+ &format!(
+ "http://localhost:9411/v0/release?editgroup_id={}",
+ editgroup_id
+ ),
headers.clone(),
r#"{"title": "secret minimal paper",
"release_type": "journal-article"
diff --git a/rust/tests/test_auth.rs b/rust/tests/test_auth.rs
index d93051f2..c0d81753 100644
--- a/rust/tests/test_auth.rs
+++ b/rust/tests/test_auth.rs
@@ -1,5 +1,5 @@
use fatcat::auth::AuthConfectionary;
-use fatcat::identifiers::FatCatId;
+use fatcat::identifiers::FatcatId;
use fatcat::{auth, server};
use std::str::FromStr;
@@ -8,7 +8,7 @@ fn test_macaroons() {
// Test everything we can without connecting to database
let c = AuthConfectionary::new_dummy();
- let editor_id = FatCatId::from_str("q3nouwy3nnbsvo3h5klxsx4a7y").unwrap();
+ let editor_id = FatcatId::from_str("q3nouwy3nnbsvo3h5klxsx4a7y").unwrap();
// create token w/o expiration
c.create_token(editor_id, None).unwrap();
@@ -25,7 +25,7 @@ fn test_auth_db() {
let server = server::create_test_server().unwrap();
let conn = server.db_pool.get().expect("db_pool error");
let c = AuthConfectionary::new_dummy();
- let editor_id = FatCatId::from_str("aaaaaaaaaaaabkvkaaaaaaaaae").unwrap();
+ let editor_id = FatcatId::from_str("aaaaaaaaaaaabkvkaaaaaaaaae").unwrap();
// create token
let token = c.create_token(editor_id, None).unwrap();
diff --git a/rust/tests/test_fcid.rs b/rust/tests/test_fcid.rs
index 31f7030a..4feaa940 100644
--- a/rust/tests/test_fcid.rs
+++ b/rust/tests/test_fcid.rs
@@ -3,15 +3,15 @@ extern crate uuid;
// TODO: these should just be in-line in identifiers.rs
-use fatcat::identifiers::{fcid2uuid, uuid2fcid, FatCatId};
+use fatcat::identifiers::{fcid2uuid, uuid2fcid, FatcatId};
use uuid::Uuid;
#[test]
fn test_fcid_conversions() {
let test_uuid = Uuid::parse_str("86daea5b-1b6b-432a-bb67-ea97795f80fe").unwrap();
- let test_str = "q3nouwy3nnbsvo3h5klxsx4a7y";
+ let test_str = "q3nouwy3nnbsvo3h5klxsx4a7y";
- assert_eq!(test_str, uuid2fcid(&test_uuid));
+ assert_eq!(test_str, uuid2fcid(&test_uuid));
assert_eq!(test_uuid, fcid2uuid(test_str).unwrap());
assert_eq!(test_uuid, fcid2uuid(&test_str.to_uppercase()).unwrap());
assert_eq!(test_uuid, fcid2uuid(&uuid2fcid(&test_uuid)).unwrap());
@@ -30,14 +30,14 @@ fn test_fcid_conversions() {
#[test]
fn test_fcid_struct() {
let test_uuid = Uuid::parse_str("86daea5b-1b6b-432a-bb67-ea97795f80fe").unwrap();
- let test_str = "q3nouwy3nnbsvo3h5klxsx4a7y";
- let test_fcid = FatCatId::from_uuid(&test_uuid);
+ let test_str = "q3nouwy3nnbsvo3h5klxsx4a7y";
+ let test_fcid = FatcatId::from_uuid(&test_uuid);
- assert_eq!(test_str, test_fcid.to_string());
- assert_eq!(test_str, format!("{}", test_fcid));
+ assert_eq!(test_str, test_fcid.to_string());
+ assert_eq!(test_str, format!("{}", test_fcid));
assert_eq!(test_uuid, test_fcid.to_uuid());
// Inner UUID isn't public, so this doesn't work
- //let test_fcid2 = FatCatId(test_uuid);
+ //let test_fcid2 = FatcatId(test_uuid);
//assert_eq!(test_fcid, test_fcid2);
}