mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-28 01:01:00 +00:00
Add bad_request error tests
This commit is contained in:
@ -1,18 +1,37 @@
|
||||
use crate::common::Server;
|
||||
use serde_json::json;
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn get_update_unexisting_index() {
|
||||
async fn error_get_update_unexisting_index() {
|
||||
let server = Server::new().await;
|
||||
let (_response, code) = server.index("test").get_update(0).await;
|
||||
let (response, code) = server.index("test").get_update(0).await;
|
||||
|
||||
let expected_response = json!({
|
||||
"message": "Index test not found.",
|
||||
"code": "index_not_found",
|
||||
"type": "invalid_request",
|
||||
"link": "https://docs.meilisearch.com/errors#index_not_found"
|
||||
});
|
||||
|
||||
assert_eq!(response, expected_response);
|
||||
assert_eq!(code, 404);
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn get_unexisting_update_status() {
|
||||
async fn error_get_unexisting_update_status() {
|
||||
let server = Server::new().await;
|
||||
let index = server.index("test");
|
||||
index.create(None).await;
|
||||
let (_response, code) = index.get_update(0).await;
|
||||
let (response, code) = index.get_update(0).await;
|
||||
|
||||
let expected_response = json!({
|
||||
"message": "Task 0 not found.",
|
||||
"code": "task_not_found",
|
||||
"type": "invalid_request",
|
||||
"link": "https://docs.meilisearch.com/errors#task_not_found"
|
||||
});
|
||||
|
||||
assert_eq!(response, expected_response);
|
||||
assert_eq!(code, 404);
|
||||
}
|
||||
|
||||
@ -36,9 +55,18 @@ async fn get_update_status() {
|
||||
}
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn list_updates_unexisting_index() {
|
||||
async fn error_list_updates_unexisting_index() {
|
||||
let server = Server::new().await;
|
||||
let (_response, code) = server.index("test").list_updates().await;
|
||||
let (response, code) = server.index("test").list_updates().await;
|
||||
|
||||
let expected_response = json!({
|
||||
"message": "Index test not found.",
|
||||
"code": "index_not_found",
|
||||
"type": "invalid_request",
|
||||
"link": "https://docs.meilisearch.com/errors#index_not_found"
|
||||
});
|
||||
|
||||
assert_eq!(response, expected_response);
|
||||
assert_eq!(code, 404);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user