Fix some errors

This commit is contained in:
many
2021-10-26 19:36:48 +02:00
parent 61c15b69fb
commit 7464720426
27 changed files with 347 additions and 234 deletions

View File

@ -78,7 +78,7 @@ async fn error_create_existing_index() {
let (response, code) = index.create(Some("primary")).await;
let expected_response = json!({
"message": "Index primary already exists.",
"message": "Index `test` already exists.",
"code": "index_already_exists",
"type": "invalid_request",
"link":"https://docs.meilisearch.com/errors#index_already_exists"
@ -95,7 +95,7 @@ async fn error_create_with_invalid_index_uid() {
let (response, code) = index.create(None).await;
let expected_response = json!({
"message": "test test#! is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_).",
"message": "`test test#!` is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_).",
"code": "invalid_index_uid",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_index_uid"

View File

@ -24,7 +24,7 @@ async fn error_delete_unexisting_index() {
let (response, code) = index.delete().await;
let expected_response = json!({
"message": "Index test not found.",
"message": "Index `test` not found.",
"code": "index_not_found",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#index_not_found"

View File

@ -30,7 +30,7 @@ async fn error_get_unexisting_index() {
let (response, code) = index.get().await;
let expected_response = json!({
"message": "Index test not found.",
"message": "Index `test` not found.",
"code": "index_not_found",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#index_not_found"

View File

@ -53,7 +53,7 @@ async fn error_get_stats_unexisting_index() {
let (response, code) = server.index("test").stats().await;
let expected_response = json!({
"message": "Index test not found.",
"message": "Index `test` not found.",
"code": "index_not_found",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#index_not_found"

View File

@ -44,14 +44,23 @@ async fn update_nothing() {
async fn error_update_existing_primary_key() {
let server = Server::new().await;
let index = server.index("test");
let (_response, code) = index.create(Some("primary")).await;
let (_response, code) = index.create(Some("id")).await;
assert_eq!(code, 201);
let (response, code) = index.update(Some("primary2")).await;
let documents = json!([
{
"id": "11",
"content": "foobar"
}
]);
index.add_documents(documents, None).await;
index.wait_update_id(0).await;
let (response, code) = index.update(Some("primary")).await;
let expected_response = json!({
"message": "Index test already has a primary key.",
"message": "Index already has a primary key: `id`.",
"code": "index_primary_key_already_exists",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#index_primary_key_already_exists"
@ -67,7 +76,7 @@ async fn error_update_unexisting_index() {
let (response, code) = server.index("test").update(None).await;
let expected_response = json!({
"message": "Index test not found.",
"message": "Index `test` not found.",
"code": "index_not_found",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#index_not_found"