aboutsummaryrefslogtreecommitdiffstats
path: root/rust/tests/test_api_server.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-08-30 19:21:08 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-08-30 19:21:08 -0700
commit43cb2cdcd3dae5e054f093120940b9aa1e09718a (patch)
treead3ed775c87ef0ee11ab62d4a46ca663918fdc0d /rust/tests/test_api_server.rs
parentcc11d5000910b5fd53e40bfd01056c0db60c35aa (diff)
downloadfatcat-43cb2cdcd3dae5e054f093120940b9aa1e09718a.tar.gz
fatcat-43cb2cdcd3dae5e054f093120940b9aa1e09718a.zip
minimal autoaccept tests
Diffstat (limited to 'rust/tests/test_api_server.rs')
-rw-r--r--rust/tests/test_api_server.rs41
1 files changed, 41 insertions, 0 deletions
diff --git a/rust/tests/test_api_server.rs b/rust/tests/test_api_server.rs
index 02c77413..340fb996 100644
--- a/rust/tests/test_api_server.rs
+++ b/rust/tests/test_api_server.rs
@@ -918,3 +918,44 @@ fn test_contribs() {
None,
);
}
+
+#[test]
+fn test_post_batch_autoaccept() {
+ let (headers, router, _conn) = setup();
+
+ // "true"
+ check_response(
+ request::post(
+ "http://localhost:9411/v0/container/batch?autoaccept=true",
+ headers.clone(),
+ r#"[{"name": "test journal"}, {"name": "another test journal"}]"#,
+ &router,
+ ),
+ status::Created,
+ None,
+ );
+
+ // "n"
+ check_response(
+ request::post(
+ "http://localhost:9411/v0/container/batch?autoaccept=n",
+ headers.clone(),
+ r#"[{"name": "test journal"}, {"name": "another test journal"}]"#,
+ &router,
+ ),
+ status::Created,
+ None,
+ );
+
+ // editgroup
+ check_response(
+ request::post(
+ "http://localhost:9411/v0/container/batch?autoaccept=yes&editgroup=asdf",
+ headers.clone(),
+ r#"[{"name": "test journal"}, {"name": "another test journal"}]"#,
+ &router,
+ ),
+ status::BadRequest,
+ None,
+ );
+}