From 75d0d2df6c818eaae04f49309bf654b57c432326 Mon Sep 17 00:00:00 2001 From: Balaji Sivaraman Date: Sat, 30 May 2020 17:06:02 +0530 Subject: [PATCH] update documents_delete tests to use the test dataset --- meilisearch-http/tests/documents_delete.rs | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/meilisearch-http/tests/documents_delete.rs b/meilisearch-http/tests/documents_delete.rs index cd0bfc142..b491a044a 100644 --- a/meilisearch-http/tests/documents_delete.rs +++ b/meilisearch-http/tests/documents_delete.rs @@ -2,30 +2,33 @@ mod common; #[actix_rt::test] async fn delete() { - let mut server = common::Server::with_uid("movies"); - server.populate_movies().await; + let mut server = common::Server::test_server().await; - let (_response, status_code) = server.get_document(419704).await; + let (_response, status_code) = server.get_document(50).await; assert_eq!(status_code, 200); - server.delete_document(419704).await; + server.delete_document(50).await; - let (_response, status_code) = server.get_document(419704).await; + let (_response, status_code) = server.get_document(50).await; assert_eq!(status_code, 404); } // Resolve the issue https://github.com/meilisearch/MeiliSearch/issues/493 #[actix_rt::test] async fn delete_batch() { - let mut server = common::Server::with_uid("movies"); - server.populate_movies().await; + let mut server = common::Server::test_server().await; - let (_response, status_code) = server.get_document(419704).await; - assert_eq!(status_code, 200); + let doc_ids = vec!(50, 55, 60); + for doc_id in &doc_ids { + let (_response, status_code) = server.get_document(doc_id).await; + assert_eq!(status_code, 200); + } - let body = serde_json::json!([419704, 512200, 181812]); + let body = serde_json::json!(&doc_ids); server.delete_multiple_documents(body).await; - let (_response, status_code) = server.get_document(419704).await; - assert_eq!(status_code, 404); + for doc_id in &doc_ids { + let (_response, status_code) = server.get_document(doc_id).await; + assert_eq!(status_code, 404); + } }