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