aboutsummaryrefslogtreecommitdiffstats
path: root/rust/tests/test_api_server.rs
diff options
context:
space:
mode:
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 4b181188..54639228 100644
--- a/rust/tests/test_api_server.rs
+++ b/rust/tests/test_api_server.rs
@@ -983,3 +983,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,
+ );
+}