From 4bca26298ef615594c87049b75286ada871412af Mon Sep 17 00:00:00 2001 From: mpostma Date: Mon, 22 Feb 2021 14:55:40 +0100 Subject: [PATCH] test add document bad primary key --- tests/documents/add_documents.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/documents/add_documents.rs b/tests/documents/add_documents.rs index c17828641..568a3117e 100644 --- a/tests/documents/add_documents.rs +++ b/tests/documents/add_documents.rs @@ -208,3 +208,21 @@ async fn add_larger_dataset() { assert_eq!(response["status"], "processed"); assert_eq!(response["success"]["DocumentsAddition"]["nb_documents"], 77); } + +#[actix_rt::test] +async fn add_documents_bad_primary_key() { + let server = Server::new().await; + let index = server.index("test"); + index.create(Some("docid")).await; + let documents = json!([ + { + "docid": "foo & bar", + "content": "foobar" + } + ]); + index.add_documents(documents, None).await; + index.wait_update_id(0).await; + let (response, code) = index.get_update(0).await; + assert_eq!(code, 200); + assert_eq!(response["status"], "failed"); +}