fix tests

This commit is contained in:
marin postma 2021-06-24 16:25:27 +02:00
parent d078cbf39b
commit 8e4928c7ea
No known key found for this signature in database
GPG Key ID: 6088B7721C3E39F9
3 changed files with 13 additions and 12 deletions

View File

@ -44,14 +44,15 @@ pub fn services(cfg: &mut web::ServiceConfig) {
.route(web::put().guard(guard_json).to(update_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(
web::scope("/indexes/{index_uid}/documents/")
.service(
web::resource("{document_id}")
.route(web::get().to(get_document))
.route(web::delete().to(delete_document)),
)
.route("/delete-batch", web::post().to(delete_documents)),
web::resource("/indexes/{index_uid}/documents/{document_id}")
.route(web::get().to(get_document))
.route(web::delete().to(delete_document)),
);
}

View File

@ -3,7 +3,7 @@ use actix_web::{web, HttpResponse};
use crate::error::ResponseError;
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> {

View File

@ -14,8 +14,8 @@ async fn delete_one_unexisting_document() {
let server = Server::new().await;
let index = server.index("test");
index.create(None).await;
let (_response, code) = index.delete_document(0).await;
assert_eq!(code, 202);
let (response, code) = index.delete_document(0).await;
assert_eq!(code, 202, "{}", response);
let update = index.wait_update_id(0).await;
assert_eq!(update["status"], "processed");
}
@ -85,8 +85,8 @@ async fn clear_all_documents_empty_index() {
#[actix_rt::test]
async fn delete_batch_unexisting_index() {
let server = Server::new().await;
let (_response, code) = server.index("test").delete_batch(vec![]).await;
assert_eq!(code, 404);
let (response, code) = server.index("test").delete_batch(vec![]).await;
assert_eq!(code, 404, "{}", response);
}
#[actix_rt::test]