mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 20:07:09 +02:00
refactor the tests suite slightly
This commit is contained in:
parent
2c1d60f79b
commit
056b2c387d
40 changed files with 227 additions and 149 deletions
|
@ -1,8 +1,7 @@
|
|||
use std::{thread, time};
|
||||
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use crate::common::Server;
|
||||
use crate::common::{Server, Value};
|
||||
use crate::json;
|
||||
|
||||
#[actix_rt::test]
|
||||
async fn add_valid_api_key() {
|
||||
|
@ -162,7 +161,7 @@ async fn add_valid_api_key_null_description() {
|
|||
server.use_api_key("MASTER_KEY");
|
||||
|
||||
let content = json!({
|
||||
"description": Value::Null,
|
||||
"description": json!(null),
|
||||
"indexes": ["products"],
|
||||
"actions": ["documents.add"],
|
||||
"expiresAt": "2050-11-13T00:00:00"
|
||||
|
@ -365,7 +364,7 @@ async fn error_add_api_key_invalid_index_uids() {
|
|||
server.use_api_key("MASTER_KEY");
|
||||
|
||||
let content = json!({
|
||||
"description": Value::Null,
|
||||
"description": json!(null),
|
||||
"indexes": ["invalid index # / \\name with spaces"],
|
||||
"actions": [
|
||||
"documents.add"
|
||||
|
@ -507,7 +506,7 @@ async fn error_add_api_key_invalid_parameters_uid() {
|
|||
async fn error_add_api_key_parameters_uid_already_exist() {
|
||||
let mut server = Server::new_auth().await;
|
||||
server.use_api_key("MASTER_KEY");
|
||||
let content = json!({
|
||||
let content: Value = json!({
|
||||
"uid": "4bc0887a-0e41-4f3b-935d-0c451dcee9c8",
|
||||
"indexes": ["products"],
|
||||
"actions": ["search"],
|
||||
|
@ -1146,7 +1145,7 @@ async fn patch_api_key_description() {
|
|||
meili_snap::snapshot!(code, @"200 OK");
|
||||
|
||||
// Remove the description
|
||||
let content = json!({ "description": serde_json::Value::Null });
|
||||
let content = json!({ "description": null });
|
||||
|
||||
let (response, code) = server.patch_api_key(&uid, content).await;
|
||||
meili_snap::snapshot!(meili_snap::json_string!(response, { ".createdAt" => "[ignored]", ".updatedAt" => "[ignored]", ".uid" => "[ignored]", ".key" => "[ignored]" }), @r###"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue