summaryrefslogtreecommitdiffstats
path: root/rust/tests/test_api_server.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-06-20 09:38:03 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-06-20 09:38:03 -0700
commit381fe70c56b1a936d4eef676ee8ba546f6a3cf30 (patch)
tree5447e70f214c42b0ca3a533f64e828ff9410587f /rust/tests/test_api_server.rs
parentbde5c8f14e13afe4d54e9bfafd8bda8b0f33f804 (diff)
downloadfatcat-381fe70c56b1a936d4eef676ee8ba546f6a3cf30.tar.gz
fatcat-381fe70c56b1a936d4eef676ee8ba546f6a3cf30.zip
handle UUID errors as HTTP 400
Diffstat (limited to 'rust/tests/test_api_server.rs')
-rw-r--r--rust/tests/test_api_server.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/rust/tests/test_api_server.rs b/rust/tests/test_api_server.rs
index 86863f0b..7d63afe9 100644
--- a/rust/tests/test_api_server.rs
+++ b/rust/tests/test_api_server.rs
@@ -440,3 +440,42 @@ fn test_stats() {
Some("merged_editgroups"),
);
}
+
+#[test]
+fn test_400() {
+ let (headers, router, _conn) = setup();
+
+ check_response(
+ request::post(
+ "http://localhost:9411/v0/release",
+ headers,
+ r#"{"title": "secret paper",
+ "release_type": "journal-article",
+ "doi": "10.1234/abcde.781231231239",
+ "volume": "439",
+ "issue": "IV",
+ "pages": "1-399",
+ "work_id": "00000000-0000-0000-5555-00002",
+ "container_id": "00000000-0000-0000-1111-000000001",
+ "refs": [{
+ "index": 3,
+ "raw": "just a string"
+ },{
+ "raw": "just a string"
+ }],
+ "contribs": [{
+ "index": 1,
+ "raw": "textual description of contributor (aka, name)",
+ "creator_id": "00000000-0000-0000-2222-000000000001",
+ "contrib_type": "author"
+ },{
+ "raw": "shorter"
+ }],
+ "extra": { "source": "speculation" }
+ }"#,
+ &router,
+ ),
+ status::BadRequest,
+ None,
+ );
+}