MeiliSearch/meilisearch-http/tests/documents_delete.rs

32 lines
935 B
Rust
Raw Normal View History

2020-03-04 15:06:16 +01:00
mod common;
2020-04-16 11:09:47 +02:00
#[actix_rt::test]
async fn delete() {
2020-03-04 15:06:16 +01:00
let mut server = common::Server::with_uid("movies");
2020-04-16 11:09:47 +02:00
server.populate_movies().await;
2020-03-04 15:06:16 +01:00
2020-04-16 11:09:47 +02:00
let (_response, status_code) = server.get_document(419704).await;
2020-03-04 15:06:16 +01:00
assert_eq!(status_code, 200);
2020-04-16 11:09:47 +02:00
server.delete_document(419704).await;
2020-03-04 15:06:16 +01:00
2020-04-16 11:09:47 +02:00
let (_response, status_code) = server.get_document(419704).await;
2020-03-04 15:06:16 +01:00
assert_eq!(status_code, 404);
}
2020-03-05 11:44:30 +01:00
// Resolve teh issue https://github.com/meilisearch/MeiliSearch/issues/493
2020-04-16 11:09:47 +02:00
#[actix_rt::test]
async fn delete_batch() {
2020-03-04 15:06:16 +01:00
let mut server = common::Server::with_uid("movies");
2020-04-16 11:09:47 +02:00
server.populate_movies().await;
2020-03-04 15:06:16 +01:00
2020-04-16 11:09:47 +02:00
let (_response, status_code) = server.get_document(419704).await;
2020-03-04 15:06:16 +01:00
assert_eq!(status_code, 200);
2020-03-10 11:29:56 +01:00
let body = serde_json::json!([419704, 512200, 181812]);
2020-04-16 11:09:47 +02:00
server.delete_multiple_documents(body).await;
2020-03-04 15:06:16 +01:00
2020-04-16 11:09:47 +02:00
let (_response, status_code) = server.get_document(419704).await;
2020-03-04 15:06:16 +01:00
assert_eq!(status_code, 404);
}