|
|
|
@ -33,8 +33,8 @@ async fn add_valid_api_key() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": "indexing-key",
|
|
|
|
|
"description": "Indexing API key",
|
|
|
|
@ -92,8 +92,8 @@ async fn add_valid_api_key_expired_at() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": "Indexing API key",
|
|
|
|
@ -136,8 +136,8 @@ async fn add_valid_api_key_no_description() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": null,
|
|
|
|
@ -169,8 +169,8 @@ async fn add_valid_api_key_null_description() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": null,
|
|
|
|
@ -199,8 +199,8 @@ async fn error_add_api_key_no_header() {
|
|
|
|
|
"expiresAt": "2050-11-13T00:00:00Z"
|
|
|
|
|
});
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"401");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"401 Unauthorized");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "The Authorization header is missing. It must use the bearer authorization method.",
|
|
|
|
|
"code": "missing_authorization_header",
|
|
|
|
@ -222,8 +222,8 @@ async fn error_add_api_key_bad_key() {
|
|
|
|
|
"expiresAt": "2050-11-13T00:00:00Z"
|
|
|
|
|
});
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"403");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"403 Forbidden");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "The provided API key is invalid.",
|
|
|
|
|
"code": "invalid_api_key",
|
|
|
|
@ -245,8 +245,8 @@ async fn error_add_api_key_missing_parameter() {
|
|
|
|
|
"expiresAt": "2050-11-13T00:00:00Z"
|
|
|
|
|
});
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "Json deserialize error: missing field `indexes` at ``",
|
|
|
|
|
"code": "bad_request",
|
|
|
|
@ -262,8 +262,8 @@ async fn error_add_api_key_missing_parameter() {
|
|
|
|
|
"expiresAt": "2050-11-13T00:00:00Z"
|
|
|
|
|
});
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "Json deserialize error: missing field `actions` at ``",
|
|
|
|
|
"code": "bad_request",
|
|
|
|
@ -279,8 +279,8 @@ async fn error_add_api_key_missing_parameter() {
|
|
|
|
|
"actions": ["documents.add"],
|
|
|
|
|
});
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": "Indexing API key",
|
|
|
|
@ -311,8 +311,8 @@ async fn error_add_api_key_invalid_parameters_description() {
|
|
|
|
|
"expiresAt": "2050-11-13T00:00:00Z"
|
|
|
|
|
});
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "invalid type: Map `{\"name\":\"products\"}`, expected a String at `.description`.",
|
|
|
|
|
"code": "invalid_api_key_description",
|
|
|
|
@ -334,8 +334,8 @@ async fn error_add_api_key_invalid_parameters_name() {
|
|
|
|
|
"expiresAt": "2050-11-13T00:00:00Z"
|
|
|
|
|
});
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "invalid type: Map `{\"name\":\"products\"}`, expected a String at `.name`.",
|
|
|
|
|
"code": "invalid_api_key_name",
|
|
|
|
@ -357,8 +357,8 @@ async fn error_add_api_key_invalid_parameters_indexes() {
|
|
|
|
|
"expiresAt": "2050-11-13T00:00:00Z"
|
|
|
|
|
});
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "invalid type: Map `{\"name\":\"products\"}`, expected a Sequence at `.indexes`.",
|
|
|
|
|
"code": "invalid_api_key_indexes",
|
|
|
|
@ -383,8 +383,8 @@ async fn error_add_api_key_invalid_index_uids() {
|
|
|
|
|
});
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "`invalid index # / \\name with spaces` is not a valid index uid. Index uid can be an integer or a string containing only alphanumeric characters, hyphens (-) and underscores (_). at `.indexes[0]`.",
|
|
|
|
|
"code": "invalid_api_key_indexes",
|
|
|
|
@ -408,8 +408,8 @@ async fn error_add_api_key_invalid_parameters_actions() {
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
assert_eq!(400, code, "{:?}", &response);
|
|
|
|
|
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "invalid type: Map `{\"name\":\"products\"}`, expected a Sequence at `.actions`.",
|
|
|
|
|
"code": "invalid_api_key_actions",
|
|
|
|
@ -428,8 +428,8 @@ async fn error_add_api_key_invalid_parameters_actions() {
|
|
|
|
|
});
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "Json deserialize error: unknown value `doc.add`, expected one of `*`, `search`, `documents.*`, `documents.add`, `documents.get`, `documents.delete`, `indexes.*`, `indexes.create`, `indexes.get`, `indexes.update`, `indexes.delete`, `indexes.swap`, `tasks.*`, `tasks.cancel`, `tasks.delete`, `tasks.get`, `settings.*`, `settings.get`, `settings.update`, `stats.*`, `stats.get`, `metrics.*`, `metrics.get`, `dumps.*`, `dumps.create`, `version`, `keys.create`, `keys.get`, `keys.update`, `keys.delete` at `.actions[0]`.",
|
|
|
|
|
"code": "invalid_api_key_actions",
|
|
|
|
@ -452,8 +452,8 @@ async fn error_add_api_key_invalid_parameters_expires_at() {
|
|
|
|
|
});
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "invalid type: Map `{\"name\":\"products\"}`, expected a String at `.expiresAt`.",
|
|
|
|
|
"code": "invalid_api_key_expires_at",
|
|
|
|
@ -476,7 +476,7 @@ async fn error_add_api_key_invalid_parameters_expires_at_in_the_past() {
|
|
|
|
|
});
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "`2010-11-13T00:00:00Z` is not a valid date. It should follow the RFC 3339 format to represents a date or datetime in the future or specified as a null value. e.g. 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'.\n at `.expiresAt`.",
|
|
|
|
|
"code": "invalid_api_key_expires_at",
|
|
|
|
@ -484,7 +484,7 @@ async fn error_add_api_key_invalid_parameters_expires_at_in_the_past() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#invalid-api-key-expires-at"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -501,7 +501,7 @@ async fn error_add_api_key_invalid_parameters_uid() {
|
|
|
|
|
});
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "invalid length: expected length 32 for simple format, found 13 at `.uid`.",
|
|
|
|
|
"code": "invalid_api_key_uid",
|
|
|
|
@ -509,7 +509,7 @@ async fn error_add_api_key_invalid_parameters_uid() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#invalid-api-key-uid"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -525,7 +525,7 @@ async fn error_add_api_key_parameters_uid_already_exist() {
|
|
|
|
|
|
|
|
|
|
// first creation is valid.
|
|
|
|
|
let (response, code) = server.add_api_key(content.clone()).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": null,
|
|
|
|
@ -542,11 +542,11 @@ async fn error_add_api_key_parameters_uid_already_exist() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
|
|
|
|
|
// uid already exist.
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "`uid` field value `4bc0887a-0e41-4f3b-935d-0c451dcee9c8` is already an existing API key.",
|
|
|
|
|
"code": "api_key_already_exists",
|
|
|
|
@ -554,7 +554,7 @@ async fn error_add_api_key_parameters_uid_already_exist() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#api-key-already-exists"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"409");
|
|
|
|
|
meili_snap::snapshot!(code, @"409 Conflict");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -586,7 +586,7 @@ async fn get_api_key() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": "Indexing API key",
|
|
|
|
@ -615,13 +615,13 @@ async fn get_api_key() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
|
|
|
|
|
let key = response["key"].as_str().unwrap();
|
|
|
|
|
|
|
|
|
|
// get with uid
|
|
|
|
|
let (response, code) = server.get_api_key(&uid).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": "Indexing API key",
|
|
|
|
@ -650,10 +650,10 @@ async fn get_api_key() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"200");
|
|
|
|
|
meili_snap::snapshot!(code, @"200 OK");
|
|
|
|
|
// get with key
|
|
|
|
|
let (response, code) = server.get_api_key(&key).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": "Indexing API key",
|
|
|
|
@ -682,7 +682,7 @@ async fn get_api_key() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"200");
|
|
|
|
|
meili_snap::snapshot!(code, @"200 OK");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -692,7 +692,7 @@ async fn error_get_api_key_no_header() {
|
|
|
|
|
let (response, code) = server
|
|
|
|
|
.get_api_key("d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4")
|
|
|
|
|
.await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "The Authorization header is missing. It must use the bearer authorization method.",
|
|
|
|
|
"code": "missing_authorization_header",
|
|
|
|
@ -700,7 +700,7 @@ async fn error_get_api_key_no_header() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#missing-authorization-header"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"401");
|
|
|
|
|
meili_snap::snapshot!(code, @"401 Unauthorized");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -711,7 +711,7 @@ async fn error_get_api_key_bad_key() {
|
|
|
|
|
let (response, code) = server
|
|
|
|
|
.get_api_key("d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4")
|
|
|
|
|
.await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "The provided API key is invalid.",
|
|
|
|
|
"code": "invalid_api_key",
|
|
|
|
@ -719,7 +719,7 @@ async fn error_get_api_key_bad_key() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#invalid-api-key"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"403");
|
|
|
|
|
meili_snap::snapshot!(code, @"403 Forbidden");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -730,7 +730,7 @@ async fn error_get_api_key_not_found() {
|
|
|
|
|
let (response, code) = server
|
|
|
|
|
.get_api_key("d0552b41d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4")
|
|
|
|
|
.await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "API key `d0552b41d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4` not found.",
|
|
|
|
|
"code": "api_key_not_found",
|
|
|
|
@ -738,7 +738,7 @@ async fn error_get_api_key_not_found() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#api-key-not-found"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"404");
|
|
|
|
|
meili_snap::snapshot!(code, @"404 Not Found");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -768,7 +768,7 @@ async fn list_api_keys() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": "Indexing API key",
|
|
|
|
@ -797,10 +797,10 @@ async fn list_api_keys() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.list_api_keys().await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".results[].createdAt" => "[ignored]", ".results[].updatedAt" => "[ignored]", ".results[].uid" => "[ignored]", ".results[].key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".results[].createdAt" => "[ignored]", ".results[].updatedAt" => "[ignored]", ".results[].uid" => "[ignored]", ".results[].key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"results": [
|
|
|
|
|
{
|
|
|
|
@ -866,7 +866,7 @@ async fn list_api_keys() {
|
|
|
|
|
"total": 3
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"200");
|
|
|
|
|
meili_snap::snapshot!(code, @"200 OK");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -874,7 +874,7 @@ async fn error_list_api_keys_no_header() {
|
|
|
|
|
let server = Server::new_auth().await;
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.list_api_keys().await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "The Authorization header is missing. It must use the bearer authorization method.",
|
|
|
|
|
"code": "missing_authorization_header",
|
|
|
|
@ -882,7 +882,7 @@ async fn error_list_api_keys_no_header() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#missing-authorization-header"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"401");
|
|
|
|
|
meili_snap::snapshot!(code, @"401 Unauthorized");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -891,7 +891,7 @@ async fn error_list_api_keys_bad_key() {
|
|
|
|
|
server.use_api_key("d4000bd7225f77d1eb22cc706ed36772bbc36767c016a27f76def7537b68600d");
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.list_api_keys().await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "The provided API key is invalid.",
|
|
|
|
|
"code": "invalid_api_key",
|
|
|
|
@ -899,7 +899,7 @@ async fn error_list_api_keys_bad_key() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#invalid-api-key"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"403");
|
|
|
|
|
meili_snap::snapshot!(code, @"403 Forbidden");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -929,7 +929,7 @@ async fn delete_api_key() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": "Indexing API key",
|
|
|
|
@ -958,17 +958,17 @@ async fn delete_api_key() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
|
|
|
|
|
let uid = response["uid"].as_str().unwrap();
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.delete_api_key(&uid).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @"null");
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"204");
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @"null");
|
|
|
|
|
meili_snap::snapshot!(code, @"204 No Content");
|
|
|
|
|
|
|
|
|
|
// check if API key no longer exist.
|
|
|
|
|
let (response, code) = server.get_api_key(&uid).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".message" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".message" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "[ignored]",
|
|
|
|
|
"code": "api_key_not_found",
|
|
|
|
@ -976,7 +976,7 @@ async fn delete_api_key() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#api-key-not-found"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"404");
|
|
|
|
|
meili_snap::snapshot!(code, @"404 Not Found");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -987,7 +987,7 @@ async fn error_delete_api_key_no_header() {
|
|
|
|
|
.delete_api_key("d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4")
|
|
|
|
|
.await;
|
|
|
|
|
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "The Authorization header is missing. It must use the bearer authorization method.",
|
|
|
|
|
"code": "missing_authorization_header",
|
|
|
|
@ -995,7 +995,7 @@ async fn error_delete_api_key_no_header() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#missing-authorization-header"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"401");
|
|
|
|
|
meili_snap::snapshot!(code, @"401 Unauthorized");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -1006,7 +1006,7 @@ async fn error_delete_api_key_bad_key() {
|
|
|
|
|
let (response, code) = server
|
|
|
|
|
.delete_api_key("d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4")
|
|
|
|
|
.await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "The provided API key is invalid.",
|
|
|
|
|
"code": "invalid_api_key",
|
|
|
|
@ -1014,7 +1014,7 @@ async fn error_delete_api_key_bad_key() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#invalid-api-key"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"403");
|
|
|
|
|
meili_snap::snapshot!(code, @"403 Forbidden");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -1025,7 +1025,7 @@ async fn error_delete_api_key_not_found() {
|
|
|
|
|
let (response, code) = server
|
|
|
|
|
.delete_api_key("d0552b41d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4")
|
|
|
|
|
.await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "API key `d0552b41d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4` not found.",
|
|
|
|
|
"code": "api_key_not_found",
|
|
|
|
@ -1033,7 +1033,7 @@ async fn error_delete_api_key_not_found() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#api-key-not-found"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"404");
|
|
|
|
|
meili_snap::snapshot!(code, @"404 Not Found");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -1059,7 +1059,7 @@ async fn patch_api_key_description() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": null,
|
|
|
|
@ -1085,7 +1085,7 @@ async fn patch_api_key_description() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
|
|
|
|
|
let uid = response["uid"].as_str().unwrap();
|
|
|
|
|
|
|
|
|
@ -1094,7 +1094,7 @@ async fn patch_api_key_description() {
|
|
|
|
|
|
|
|
|
|
thread::sleep(time::Duration::new(1, 0));
|
|
|
|
|
let (response, code) = server.patch_api_key(&uid, content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": "Indexing API key",
|
|
|
|
@ -1120,13 +1120,13 @@ async fn patch_api_key_description() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"200");
|
|
|
|
|
meili_snap::snapshot!(code, @"200 OK");
|
|
|
|
|
|
|
|
|
|
// Change the description
|
|
|
|
|
let content = json!({ "description": "Product API key" });
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.patch_api_key(&uid, content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": "Product API key",
|
|
|
|
@ -1152,13 +1152,13 @@ async fn patch_api_key_description() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"200");
|
|
|
|
|
meili_snap::snapshot!(code, @"200 OK");
|
|
|
|
|
|
|
|
|
|
// Remove the description
|
|
|
|
|
let content = json!({ "description": serde_json::Value::Null });
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.patch_api_key(&uid, content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": null,
|
|
|
|
@ -1184,7 +1184,7 @@ async fn patch_api_key_description() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"200");
|
|
|
|
|
meili_snap::snapshot!(code, @"200 OK");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -1210,7 +1210,7 @@ async fn patch_api_key_name() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": null,
|
|
|
|
@ -1236,7 +1236,7 @@ async fn patch_api_key_name() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
|
|
|
|
|
let uid = response["uid"].as_str().unwrap();
|
|
|
|
|
let created_at = response["createdAt"].as_str().unwrap();
|
|
|
|
@ -1247,7 +1247,7 @@ async fn patch_api_key_name() {
|
|
|
|
|
|
|
|
|
|
thread::sleep(time::Duration::new(1, 0));
|
|
|
|
|
let (response, code) = server.patch_api_key(&uid, content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": "Indexing API key",
|
|
|
|
|
"description": null,
|
|
|
|
@ -1273,7 +1273,7 @@ async fn patch_api_key_name() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"200");
|
|
|
|
|
meili_snap::snapshot!(code, @"200 OK");
|
|
|
|
|
|
|
|
|
|
assert_ne!(response["updatedAt"].as_str().unwrap(), updated_at);
|
|
|
|
|
assert_eq!(response["createdAt"].as_str().unwrap(), created_at);
|
|
|
|
@ -1282,7 +1282,7 @@ async fn patch_api_key_name() {
|
|
|
|
|
let content = json!({ "name": "Product API key" });
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.patch_api_key(&uid, content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": "Product API key",
|
|
|
|
|
"description": null,
|
|
|
|
@ -1308,13 +1308,13 @@ async fn patch_api_key_name() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"200");
|
|
|
|
|
meili_snap::snapshot!(code, @"200 OK");
|
|
|
|
|
|
|
|
|
|
// Remove the name
|
|
|
|
|
let content = json!({ "name": serde_json::Value::Null });
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.patch_api_key(&uid, content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": null,
|
|
|
|
@ -1340,7 +1340,7 @@ async fn patch_api_key_name() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"200");
|
|
|
|
|
meili_snap::snapshot!(code, @"200 OK");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -1367,7 +1367,7 @@ async fn error_patch_api_key_indexes() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": "Indexing API key",
|
|
|
|
@ -1393,7 +1393,7 @@ async fn error_patch_api_key_indexes() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
|
|
|
|
|
let uid = response["uid"].as_str().unwrap();
|
|
|
|
|
|
|
|
|
@ -1401,7 +1401,7 @@ async fn error_patch_api_key_indexes() {
|
|
|
|
|
|
|
|
|
|
thread::sleep(time::Duration::new(1, 0));
|
|
|
|
|
let (response, code) = server.patch_api_key(&uid, content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "Json deserialize error: unknown field `indexes`, expected one of `description`, `name` at ``.",
|
|
|
|
|
"code": "immutable_field",
|
|
|
|
@ -1409,7 +1409,7 @@ async fn error_patch_api_key_indexes() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#immutable-field"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -1436,7 +1436,7 @@ async fn error_patch_api_key_actions() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": "Indexing API key",
|
|
|
|
@ -1462,7 +1462,7 @@ async fn error_patch_api_key_actions() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
|
|
|
|
|
let uid = response["uid"].as_str().unwrap();
|
|
|
|
|
|
|
|
|
@ -1478,7 +1478,7 @@ async fn error_patch_api_key_actions() {
|
|
|
|
|
|
|
|
|
|
thread::sleep(time::Duration::new(1, 0));
|
|
|
|
|
let (response, code) = server.patch_api_key(&uid, content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "Json deserialize error: unknown field `actions`, expected one of `description`, `name` at ``.",
|
|
|
|
|
"code": "immutable_field",
|
|
|
|
@ -1486,7 +1486,7 @@ async fn error_patch_api_key_actions() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#immutable-field"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -1513,7 +1513,7 @@ async fn error_patch_api_key_expiration_date() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": "Indexing API key",
|
|
|
|
@ -1539,7 +1539,7 @@ async fn error_patch_api_key_expiration_date() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
|
|
|
|
|
let uid = response["uid"].as_str().unwrap();
|
|
|
|
|
|
|
|
|
@ -1547,7 +1547,7 @@ async fn error_patch_api_key_expiration_date() {
|
|
|
|
|
|
|
|
|
|
thread::sleep(time::Duration::new(1, 0));
|
|
|
|
|
let (response, code) = server.patch_api_key(&uid, content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "Json deserialize error: unknown field `expiresAt`, expected one of `description`, `name` at ``.",
|
|
|
|
|
"code": "immutable_field",
|
|
|
|
@ -1555,7 +1555,7 @@ async fn error_patch_api_key_expiration_date() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#immutable-field"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -1569,7 +1569,7 @@ async fn error_patch_api_key_no_header() {
|
|
|
|
|
)
|
|
|
|
|
.await;
|
|
|
|
|
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "The Authorization header is missing. It must use the bearer authorization method.",
|
|
|
|
|
"code": "missing_authorization_header",
|
|
|
|
@ -1577,7 +1577,7 @@ async fn error_patch_api_key_no_header() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#missing-authorization-header"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"401");
|
|
|
|
|
meili_snap::snapshot!(code, @"401 Unauthorized");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -1592,7 +1592,7 @@ async fn error_patch_api_key_bad_key() {
|
|
|
|
|
)
|
|
|
|
|
.await;
|
|
|
|
|
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "The provided API key is invalid.",
|
|
|
|
|
"code": "invalid_api_key",
|
|
|
|
@ -1600,7 +1600,7 @@ async fn error_patch_api_key_bad_key() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#invalid-api-key"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"403");
|
|
|
|
|
meili_snap::snapshot!(code, @"403 Forbidden");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -1615,7 +1615,7 @@ async fn error_patch_api_key_not_found() {
|
|
|
|
|
)
|
|
|
|
|
.await;
|
|
|
|
|
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "API key `d0552b41d0552b41536279a0ad88bd595327b96f01176a60c2243e906c52ac02375f9bc4` not found.",
|
|
|
|
|
"code": "api_key_not_found",
|
|
|
|
@ -1623,7 +1623,7 @@ async fn error_patch_api_key_not_found() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#api-key-not-found"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"404");
|
|
|
|
|
meili_snap::snapshot!(code, @"404 Not Found");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -1641,7 +1641,7 @@ async fn error_patch_api_key_indexes_invalid_parameters() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"name": null,
|
|
|
|
|
"description": "Indexing API key",
|
|
|
|
@ -1658,7 +1658,7 @@ async fn error_patch_api_key_indexes_invalid_parameters() {
|
|
|
|
|
"updatedAt": "[ignored]"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"201");
|
|
|
|
|
meili_snap::snapshot!(code, @"201 Created");
|
|
|
|
|
|
|
|
|
|
let uid = response["uid"].as_str().unwrap();
|
|
|
|
|
|
|
|
|
@ -1668,7 +1668,7 @@ async fn error_patch_api_key_indexes_invalid_parameters() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.patch_api_key(&uid, content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "invalid type: Integer `13`, expected a String at `.description`.",
|
|
|
|
|
"code": "invalid_api_key_description",
|
|
|
|
@ -1676,7 +1676,7 @@ async fn error_patch_api_key_indexes_invalid_parameters() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#invalid-api-key-description"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
|
|
|
|
|
// invalid name
|
|
|
|
|
let content = json!({
|
|
|
|
@ -1684,7 +1684,7 @@ async fn error_patch_api_key_indexes_invalid_parameters() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.patch_api_key(&uid, content).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "invalid type: Integer `13`, expected a String at `.name`.",
|
|
|
|
|
"code": "invalid_api_key_name",
|
|
|
|
@ -1692,7 +1692,7 @@ async fn error_patch_api_key_indexes_invalid_parameters() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#invalid-api-key-name"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"400");
|
|
|
|
|
meili_snap::snapshot!(code, @"400 Bad Request");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
@ -1700,7 +1700,7 @@ async fn error_access_api_key_routes_no_master_key_set() {
|
|
|
|
|
let mut server = Server::new().await;
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(json!({})).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "Meilisearch is running without a master key. To access this API endpoint, you must have set a master key at launch.",
|
|
|
|
|
"code": "missing_master_key",
|
|
|
|
@ -1708,10 +1708,10 @@ async fn error_access_api_key_routes_no_master_key_set() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#missing-master-key"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"401");
|
|
|
|
|
meili_snap::snapshot!(code, @"401 Unauthorized");
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.patch_api_key("content", json!({})).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "Meilisearch is running without a master key. To access this API endpoint, you must have set a master key at launch.",
|
|
|
|
|
"code": "missing_master_key",
|
|
|
|
@ -1719,10 +1719,10 @@ async fn error_access_api_key_routes_no_master_key_set() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#missing-master-key"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"401");
|
|
|
|
|
meili_snap::snapshot!(code, @"401 Unauthorized");
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.get_api_key("content").await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "Meilisearch is running without a master key. To access this API endpoint, you must have set a master key at launch.",
|
|
|
|
|
"code": "missing_master_key",
|
|
|
|
@ -1730,10 +1730,10 @@ async fn error_access_api_key_routes_no_master_key_set() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#missing-master-key"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"401");
|
|
|
|
|
meili_snap::snapshot!(code, @"401 Unauthorized");
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.list_api_keys().await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "Meilisearch is running without a master key. To access this API endpoint, you must have set a master key at launch.",
|
|
|
|
|
"code": "missing_master_key",
|
|
|
|
@ -1741,12 +1741,12 @@ async fn error_access_api_key_routes_no_master_key_set() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#missing-master-key"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"401");
|
|
|
|
|
meili_snap::snapshot!(code, @"401 Unauthorized");
|
|
|
|
|
|
|
|
|
|
server.use_api_key("MASTER_KEY");
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.add_api_key(json!({})).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "Meilisearch is running without a master key. To access this API endpoint, you must have set a master key at launch.",
|
|
|
|
|
"code": "missing_master_key",
|
|
|
|
@ -1754,10 +1754,10 @@ async fn error_access_api_key_routes_no_master_key_set() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#missing-master-key"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"401");
|
|
|
|
|
meili_snap::snapshot!(code, @"401 Unauthorized");
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.patch_api_key("content", json!({})).await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "Meilisearch is running without a master key. To access this API endpoint, you must have set a master key at launch.",
|
|
|
|
|
"code": "missing_master_key",
|
|
|
|
@ -1765,10 +1765,10 @@ async fn error_access_api_key_routes_no_master_key_set() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#missing-master-key"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"401");
|
|
|
|
|
meili_snap::snapshot!(code, @"401 Unauthorized");
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.get_api_key("content").await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "Meilisearch is running without a master key. To access this API endpoint, you must have set a master key at launch.",
|
|
|
|
|
"code": "missing_master_key",
|
|
|
|
@ -1776,10 +1776,10 @@ async fn error_access_api_key_routes_no_master_key_set() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#missing-master-key"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"401");
|
|
|
|
|
meili_snap::snapshot!(code, @"401 Unauthorized");
|
|
|
|
|
|
|
|
|
|
let (response, code) = server.list_api_keys().await;
|
|
|
|
|
meili_snap::insta::assert_json_snapshot!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }, @r###"
|
|
|
|
|
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]" }), @r###"
|
|
|
|
|
{
|
|
|
|
|
"message": "Meilisearch is running without a master key. To access this API endpoint, you must have set a master key at launch.",
|
|
|
|
|
"code": "missing_master_key",
|
|
|
|
@ -1787,5 +1787,5 @@ async fn error_access_api_key_routes_no_master_key_set() {
|
|
|
|
|
"link": "https://docs.meilisearch.com/errors#missing-master-key"
|
|
|
|
|
}
|
|
|
|
|
"###);
|
|
|
|
|
meili_snap::insta::assert_debug_snapshot!(code, @"401");
|
|
|
|
|
meili_snap::snapshot!(code, @"401 Unauthorized");
|
|
|
|
|
}
|
|
|
|
|