test add document bad primary key

This commit is contained in:
mpostma 2021-02-22 14:55:40 +01:00
parent ded6483173
commit 4bca26298e
No known key found for this signature in database
GPG Key ID: CBC8A7C1D7A28C3A

View File

@ -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");
}