mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
fix tests
This commit is contained in:
parent
d078cbf39b
commit
8e4928c7ea
@ -44,14 +44,15 @@ pub fn services(cfg: &mut web::ServiceConfig) {
|
|||||||
.route(web::put().guard(guard_json).to(update_documents))
|
.route(web::put().guard(guard_json).to(update_documents))
|
||||||
.route(web::delete().to(clear_all_documents)),
|
.route(web::delete().to(clear_all_documents)),
|
||||||
)
|
)
|
||||||
|
// this route needs to be before the /documents/{document_id} to match properly
|
||||||
|
.route(
|
||||||
|
"/indexes/{index_uid}/documents/delete-batch",
|
||||||
|
web::post().to(delete_documents),
|
||||||
|
)
|
||||||
.service(
|
.service(
|
||||||
web::scope("/indexes/{index_uid}/documents/")
|
web::resource("/indexes/{index_uid}/documents/{document_id}")
|
||||||
.service(
|
.route(web::get().to(get_document))
|
||||||
web::resource("{document_id}")
|
.route(web::delete().to(delete_document)),
|
||||||
.route(web::get().to(get_document))
|
|
||||||
.route(web::delete().to(delete_document)),
|
|
||||||
)
|
|
||||||
.route("/delete-batch", web::post().to(delete_documents)),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ use actix_web::{web, HttpResponse};
|
|||||||
use crate::error::ResponseError;
|
use crate::error::ResponseError;
|
||||||
|
|
||||||
pub fn services(cfg: &mut web::ServiceConfig) {
|
pub fn services(cfg: &mut web::ServiceConfig) {
|
||||||
cfg.route("/healts", web::get().to(get_health));
|
cfg.route("/health", web::get().to(get_health));
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_health() -> Result<HttpResponse, ResponseError> {
|
async fn get_health() -> Result<HttpResponse, ResponseError> {
|
||||||
|
@ -14,8 +14,8 @@ async fn delete_one_unexisting_document() {
|
|||||||
let server = Server::new().await;
|
let server = Server::new().await;
|
||||||
let index = server.index("test");
|
let index = server.index("test");
|
||||||
index.create(None).await;
|
index.create(None).await;
|
||||||
let (_response, code) = index.delete_document(0).await;
|
let (response, code) = index.delete_document(0).await;
|
||||||
assert_eq!(code, 202);
|
assert_eq!(code, 202, "{}", response);
|
||||||
let update = index.wait_update_id(0).await;
|
let update = index.wait_update_id(0).await;
|
||||||
assert_eq!(update["status"], "processed");
|
assert_eq!(update["status"], "processed");
|
||||||
}
|
}
|
||||||
@ -85,8 +85,8 @@ async fn clear_all_documents_empty_index() {
|
|||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn delete_batch_unexisting_index() {
|
async fn delete_batch_unexisting_index() {
|
||||||
let server = Server::new().await;
|
let server = Server::new().await;
|
||||||
let (_response, code) = server.index("test").delete_batch(vec![]).await;
|
let (response, code) = server.index("test").delete_batch(vec![]).await;
|
||||||
assert_eq!(code, 404);
|
assert_eq!(code, 404, "{}", response);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
|
Loading…
Reference in New Issue
Block a user